Re: [RFC PATCH 1/4] powerpc/code-patching: add patch_memory() for writing RO text

2022-09-01 Thread Christophe Leroy
Le 01/09/2022 à 07:58, Benjamin Gray a écrit : > From: Russell Currey > > powerpc allocates a text poke area of one page that is used by > patch_instruction() to modify read-only text when STRICT_KERNEL_RWX > is enabled. > > patch_instruction() is only designed for instructions, > so writing d

Re: [PATCH] powerpc/pci: Enable PCI domains in /proc when PCI bus numbers are not unique

2022-09-01 Thread Pali Rohár
On Thursday 01 September 2022 13:53:56 Michael Ellerman wrote: > Pali Rohár writes: > > On Thursday 25 August 2022 17:49:28 Michael Ellerman wrote: > >> Pali Rohár writes: > >> > On 32-bit powerpc systems with more PCIe controllers and more PCI > >> > domains, > >> > where on more PCI domains ar

Re: [RFC PATCH 3/4] powerpc/64: Add support for out-of-line static calls

2022-09-01 Thread Christophe Leroy
Le 01/09/2022 à 07:58, Benjamin Gray a écrit : > [Vous ne recevez pas souvent de courriers de bg...@linux.ibm.com. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > Implement static call support for 64 bit V2 ABI. This requires > making sure the TOC i

Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-09-01 Thread Gabriel Paubert
On Thu, Sep 01, 2022 at 05:22:32AM +, Christophe Leroy wrote: > > > Le 01/09/2022 à 00:45, Segher Boessenkool a écrit : > > Hi! > > > > On Tue, Aug 30, 2022 at 09:10:02AM +, Christophe Leroy wrote: > >> Le 30/08/2022 à 11:01, Nicholas Piggin a écrit : > >>> On Tue Aug 30, 2022 at 3:24 PM

Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-09-01 Thread Christophe Leroy
Le 01/09/2022 à 09:37, Gabriel Paubert a écrit : > On Thu, Sep 01, 2022 at 05:22:32AM +, Christophe Leroy wrote: >> >> >> Le 01/09/2022 à 00:45, Segher Boessenkool a écrit : >>> Hi! >>> >>> On Tue, Aug 30, 2022 at 09:10:02AM +, Christophe Leroy wrote: Le 30/08/2022 à 11:01, Nicholas

Re: [RFC PATCH 0/4] Out-of-line static calls for powerpc64 ELF V2

2022-09-01 Thread Christophe Leroy
CCing static call maintainers/reviewers. And note that my email address has changed to christophe.le...@csgroup.eu monthes ago. Le 01/09/2022 à 07:58, Benjamin Gray a écrit : > [Vous ne recevez pas souvent de courriers de bg...@linux.ibm.com. Découvrez > pourquoi ceci est important à https://ak

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-09-01 Thread Christophe Leroy
Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : > This patch adds [stub] implementations for required > functions, inorder to enable objtool build on powerpc. > > Signed-off-by: Sathvika Vasireddy > [Christophe Leroy: powerpc: Add missing asm/asm.h for objtool] > Signed-off-by: Christophe L

Re: [PATCH] perf: Rewrite core context handling

2022-09-01 Thread Ravi Bangoria
On 29-Aug-22 8:10 PM, Peter Zijlstra wrote: > On Mon, Aug 29, 2022 at 02:04:33PM +0200, Peter Zijlstra wrote: >> On Mon, Aug 29, 2022 at 05:03:47PM +0530, Ravi Bangoria wrote: >>> @@ -12598,6 +12590,7 @@ EXPORT_SYMBOL_GPL(perf_event_create_kernel_counter); >>> >>> void perf_pmu_migrate_context(s

[PATCH v2] powerpc/64s: add pte_needs_flush and huge_pmd_needs_flush

2022-09-01 Thread Nicholas Piggin
Allow PTE changes to avoid flushing the TLB when access permissions are being relaxed, the dirty bit is being set, and the accessed bit is being changed. Relaxing access permissions and setting dirty and accessed bits do not require a flush because the MMU will re-load the PTE and notice the updat

Re: [PATCH v2] powerpc/64s: add pte_needs_flush and huge_pmd_needs_flush

2022-09-01 Thread Christophe Leroy
Le 01/09/2022 à 13:03, Nicholas Piggin a écrit : > Allow PTE changes to avoid flushing the TLB when access permissions are > being relaxed, the dirty bit is being set, and the accessed bit is being > changed. > > Relaxing access permissions and setting dirty and accessed bits do not > require a

Re: [PATCH] perf: Rewrite core context handling

2022-09-01 Thread Peter Zijlstra
On Thu, Sep 01, 2022 at 04:05:53PM +0530, Ravi Bangoria wrote: > On 29-Aug-22 8:10 PM, Peter Zijlstra wrote: > > On Mon, Aug 29, 2022 at 02:04:33PM +0200, Peter Zijlstra wrote: > >> On Mon, Aug 29, 2022 at 05:03:47PM +0530, Ravi Bangoria wrote: > >>> @@ -12598,6 +12590,7 @@ > >>> EXPORT_SYMBOL_GPL

[PATCH v3 0/6] Implement inline static calls on PPC32 - v3

2022-09-01 Thread Christophe Leroy
This series applies on top of the series v2 "objtool: Enable and implement --mcount option on powerpc" [1] A few modifications are done to core parts to enable powerpc implementation: - R_X86_64_PC32 is abstracted to R_REL32 so that it can then be redefined as R_PPC_REL32. - A call to static_call_

[PATCH v3 4/6] static_call_inline: Provide trampoline address when updating sites

2022-09-01 Thread Christophe Leroy
In preparation of support of inline static calls on powerpc, provide trampoline address when updating sites, so that when the destination function is too far for a direct function call, the call site is patched with a call to the trampoline. Signed-off-by: Christophe Leroy --- arch/x86/kernel/st

[PATCH v3 3/6] init: Call static_call_init() from start_kernel()

2022-09-01 Thread Christophe Leroy
Call static_call_init() just after jump_label_init(). x86 already called it from setup_arch(). This is not a problem as static_call_init() is guarded from double call. Signed-off-by: Christophe Leroy --- init/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/init/main.c b/init/main.c i

[PATCH v3 1/6] Fixup for "objtool/powerpc: Add --mcount specific implementation"

2022-09-01 Thread Christophe Leroy
Make arch_decode_instruction() more future proof and less error prone: - Use local vars for type and imm so that GCC will detect when we forget to update them - Handle imm outside the branch type check - Adapt len for prefixed instructions Handle the four branch types b, bl, ba, bla Part of it sh

[PATCH v3 2/6] objtool: Add architecture specific R_REL32 macro

2022-09-01 Thread Christophe Leroy
In order to allow other architectures than x86 to use 32 bits PC relative relocations (S+A-P), define a R_REL32 macro that each architecture will define, in the same way as already done for R_NONE, R_ABS32 and R_ABS64. For x86 that corresponds to R_X86_64_PC32. For powerpc it is R_PPC_REL32/R_PPC6

[PATCH v3 6/6] powerpc/static_call: Implement inline static calls

2022-09-01 Thread Christophe Leroy
Implement inline static calls: - Put a 'bl' to the destination function ('b' if tail call) - Put a 'nop' when the destination function is NULL ('blr' if tail call) - Put a 'li r3,0' when the destination is the RET0 function and not a tail call. If the destination is too far (over the 32Mb limit),

[PATCH v3 5/6] powerpc: Prepare arch_static_call_transform() for supporting inline static calls

2022-09-01 Thread Christophe Leroy
Reorganise arch_static_call_transform() in order to ease the support of inline static calls in following patch: - remove 'target' to nhide whether it is a 'return 0' or not. - Don't bail out if 'tramp' is NULL, just do nothing until next patch. Note that 'target' was 'tramp + PPC_SCT_RET0', is_sho

Re: [PATCH v5] livepatch: Clear relocation targets on a module removal

2022-09-01 Thread Joe Lawrence
On Thu, Sep 01, 2022 at 01:39:02PM +1000, Michael Ellerman wrote: > Joe Lawrence writes: > > On Thu, Sep 01, 2022 at 08:30:44AM +1000, Michael Ellerman wrote: > >> Joe Lawrence writes: > ... > > > > Hi Michael, > > > > While we're on the topic of klp-relocations and Power, I saw a similar > > acc

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-09-01 Thread Segher Boessenkool
On Thu, Sep 01, 2022 at 09:32:46AM +, Christophe Leroy wrote: > Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : > > +int arch_decode_instruction(struct objtool_file *file, const struct > > section *sec, > > + unsigned long offset, unsigned int maxlen, > > +

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-09-01 Thread Christophe Leroy
Le 01/09/2022 à 17:11, Segher Boessenkool a écrit : > On Thu, Sep 01, 2022 at 09:32:46AM +, Christophe Leroy wrote: >> Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit : >>> +int arch_decode_instruction(struct objtool_file *file, const struct >>> section *sec, >>> + un

Re: [PATCH v2 0/7] Implement inline static calls on PPC32 - v2

2022-09-01 Thread Christophe Leroy
Le 09/07/2022 à 08:52, Ard Biesheuvel a écrit : > Hello Christophe, > > On Fri, 8 Jul 2022 at 19:32, Christophe Leroy > wrote: >> >> This series applies on top of the series v3 "objtool: Enable and >> implement --mcount option on powerpc" [1] rebased on powerpc-next branch >> >> A few modificat

Re: [PATCH v5] livepatch: Clear relocation targets on a module removal

2022-09-01 Thread Song Liu
On Wed, Aug 31, 2022 at 7:05 PM Joe Lawrence wrote: > > On Wed, Aug 31, 2022 at 03:48:26PM -0700, Song Liu wrote: > > On Wed, Aug 31, 2022 at 3:30 PM Michael Ellerman > > wrote: > > > > > > Joe Lawrence writes: > > > > On Tue, Aug 30, 2022 at 11:53:13AM -0700, Song Liu wrote: > > > >> From: Mir

[PATCH v6] livepatch: Clear relocation targets on a module removal

2022-09-01 Thread Song Liu
From: Miroslav Benes Josh reported a bug: When the object to be patched is a module, and that module is rmmod'ed and reloaded, it fails to load with: module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 2, loc ba0302e9, val a03e293c

Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-09-01 Thread Segher Boessenkool
On Thu, Sep 01, 2022 at 07:47:10AM +, Christophe Leroy wrote: > Le 01/09/2022 à 09:37, Gabriel Paubert a écrit : > > Agree, but there is one thing which escapes me: why is r3 listed in the > > outputs section (actually as a read write operand with the "+" > > constraint modifier) but is not use

Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-09-01 Thread Segher Boessenkool
On Thu, Sep 01, 2022 at 09:37:42AM +0200, Gabriel Paubert wrote: > On Thu, Sep 01, 2022 at 05:22:32AM +, Christophe Leroy wrote: > > Le 01/09/2022 à 00:45, Segher Boessenkool a écrit : > > > I would have used real assembler code here (in a .s file). But there > > > probably are reasons to do t

[PATCH 0/3] PCI/AER: Fix and optimize usage of status clear api

2022-09-01 Thread Zhuo Chen
Hello, This series contains some fixes and optimizations of aer api usage. We add some process to clear uncorrectable error status, then add distinction between fatal and nonfatal situations in pcie_do_recovery() and reduce some redundant code. The series involves pci driver and vendor driver. Th

[PATCH 1/3] PCI/AER: Use pci_aer_clear_uncorrect_error_status() to clear uncorrectable error status

2022-09-01 Thread Zhuo Chen
Status bits for ERR_NONFATAL errors only are cleared in pci_aer_clear_nonfatal_status(), but we want clear uncorrectable error status in ntb_hw_idt.c and lpfc_attr.c. So we add pci_aer_clear_uncorrect_error_status() and change to use it. Use pci_aer_clear_nonfatal_status() in dpc_process_error(),

[PATCH 2/3] PCI/ERR: Clear fatal status in pcie_do_recovery()

2022-09-01 Thread Zhuo Chen
When state is pci_channel_io_frozen in pcie_do_recovery(), the severity is fatal and fatal status should be cleared. So we add pci_aer_clear_fatal_status(). Since pcie_aer_is_native() in pci_aer_clear_fatal_status() and pci_aer_clear_nonfatal_status() contains the function of 'if (host->native_aer

[PATCH 3/3] PCI/AER: Use pci_aer_raw_clear_status() to clear root port's AER error status

2022-09-01 Thread Zhuo Chen
Statements clearing AER error status in aer_enable_rootport() has the same function as pci_aer_raw_clear_status(). So we replace them, which has no functional changes. Signed-off-by: Zhuo Chen --- drivers/pci/pcie/aer.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dr

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-09-01 Thread Peter Zijlstra
On Thu, Sep 01, 2022 at 04:38:52PM +, Christophe Leroy wrote: > objtool is a userland app, there is no access to kernel headers here. Please have a look at tools/include/ :-)

Re: [PATCH v2 05/16] powerpc: Skip objtool from running on drivers/crypto/vmx/aesp8-ppc.o

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:12AM +0530, Sathvika Vasireddy wrote: > With objtool enabled, below warnings are seen when trying to build: > > drivers/crypto/vmx/aesp8-ppc.o: warning: objtool: > aes_p8_set_encrypt_key+0x44: unannotated intra-function call > > drivers/crypto/vmx/aesp8-ppc.o: warni

Re: [PATCH v2 07/16] powerpc: Skip objtool from running on VDSO files

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:14AM +0530, Sathvika Vasireddy wrote: > Do not run objtool on VDSO files, by using > OBJECT_FILES_NON_STANDARD > > Suggested-by: Christophe Leroy > Signed-off-by: Sathvika Vasireddy > --- > arch/powerpc/kernel/vdso/Makefile | 2 ++ > 1 file changed, 2 insertions(+)

Re: [PATCH v2 08/16] objtool: Fix SEGFAULT

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:15AM +0530, Sathvika Vasireddy wrote: > From: Christophe Leroy > > find_insn() will return NULL in case of failure. Check insn in order > to avoid a kernel Oops for NULL pointer dereference. > > Signed-off-by: Christophe Leroy > --- > tools/objtool/check.c | 2 +-

Re: [PATCH v2 09/16] objtool: Use target file endianness instead of a compiled constant

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:16AM +0530, Sathvika Vasireddy wrote: > From: Christophe Leroy > > Some architectures like powerpc support both endianness, it's > therefore not possible to fix the endianness via arch/endianness.h > because there is no easy way to get the target endianness at > buil

Re: [PATCH v2 10/16] objtool: Use target file class size instead of a compiled constant

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:17AM +0530, Sathvika Vasireddy wrote: > From: Christophe Leroy > > In order to allow using objtool on cross-built kernels, > determine size of long from elf data instead of using > sizeof(long) at build time. > > For the time being this covers only mcount. > > Sign

Re: [PATCH v2 11/16] objtool: Add --mnop as an option to --mcount

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:18AM +0530, Sathvika Vasireddy wrote: > Architectures can select HAVE_NOP_MCOUNT if they choose > to nop out mcount call sites. If that config option is > selected, then --mnop is passed as an option to objtool, > along with --mcount. > > Also, make sure that --mnop c

Re: [PATCH v2 13/16] objtool: Use macros to define arch specific reloc types

2022-09-01 Thread Peter Zijlstra
On Mon, Aug 29, 2022 at 11:22:20AM +0530, Sathvika Vasireddy wrote: > Make relocation types architecture specific. > > Signed-off-by: Sathvika Vasireddy Acked-by: Peter Zijlstra (Intel)

Re: [PATCH v3 2/6] objtool: Add architecture specific R_REL32 macro

2022-09-01 Thread Peter Zijlstra
On Thu, Sep 01, 2022 at 01:48:21PM +0200, Christophe Leroy wrote: > In order to allow other architectures than x86 to use 32 bits > PC relative relocations (S+A-P), define a R_REL32 macro that each > architecture will define, in the same way as already done for > R_NONE, R_ABS32 and R_ABS64. > > F

Re: [PATCH] powerpc/math_emu/efp: Include module.h

2022-09-01 Thread Segher Boessenkool
On Thu, Sep 01, 2022 at 05:41:33AM +, Christophe Leroy wrote: > I think it would be worth a GCC bug report. We need a stand-alone testcase for this. When you have created one, at least 98% of the time you discover the bug is in user code after all. Which is a very good thing, it means the pr

Re: [RFC PATCH RESEND 23/28] x86/mm: define ARCH_SUPPORTS_PER_VMA_LOCK

2022-09-01 Thread Kent Overstreet
On Thu, Sep 01, 2022 at 10:35:11AM -0700, Suren Baghdasaryan wrote: > Set ARCH_SUPPORTS_PER_VMA_LOCK so that the per-VMA lock support can be > compiled on this architecture. > > Signed-off-by: Suren Baghdasaryan > --- > arch/x86/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/a

Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions

2022-09-01 Thread Kent Overstreet
On Thu, Sep 01, 2022 at 10:34:52AM -0700, Suren Baghdasaryan wrote: > Move mmap_lock assert function definitions up so that they can be used > by other mmap_lock routines. > > Signed-off-by: Suren Baghdasaryan > --- > include/linux/mmap_lock.h | 24 > 1 file changed, 12

Re: [RFC PATCH RESEND 03/28] mm: introduce __find_vma to be used without mmap_lock protection

2022-09-01 Thread Kent Overstreet
On Thu, Sep 01, 2022 at 10:34:51AM -0700, Suren Baghdasaryan wrote: > Add __find_vma function to be used for VMA lookup under rcu protection. So it was news to me that the rb tree code can be used for lockless lookups - not having looked at lib/rbtree.c in over 10 years :) - I still think it shoul

Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions

2022-09-01 Thread Liam Howlett
* Kent Overstreet [220901 16:24]: > On Thu, Sep 01, 2022 at 10:34:52AM -0700, Suren Baghdasaryan wrote: > > Move mmap_lock assert function definitions up so that they can be used > > by other mmap_lock routines. > > > > Signed-off-by: Suren Baghdasaryan > > --- > > include/linux/mmap_lock.h | 2

Re: [RFC PATCH RESEND 00/28] per-VMA locks proposal

2022-09-01 Thread Kent Overstreet
On Thu, Sep 01, 2022 at 10:34:48AM -0700, Suren Baghdasaryan wrote: > Resending to fix the issue with the In-Reply-To tag in the original > submission at [4]. > > This is a proof of concept for per-vma locks idea that was discussed > during SPF [1] discussion at LSF/MM this year [2], which conclud

[PATCH v8 0/4] tpm: Preserve TPM measurement log across kexec (ppc64)

2022-09-01 Thread Stefan Berger
The of-tree subsystem does not currently preserve the IBM vTPM 1.2 and vTPM 2.0 measurement logs across a kexec on PowerVM and PowerKVM. This series fixes this for the kexec_file_load() syscall using the flattened device tree (fdt) to carry the TPM measurement log's buffer across kexec. Stefan

[PATCH v8 1/4] drivers: of: kexec ima: Support 32-bit platforms

2022-09-01 Thread Stefan Berger
From: Palmer Dabbelt RISC-V recently added kexec_file() support, which uses enables kexec IMA. We're the first 32-bit platform to support this, so we found a build bug. Acked-by: Rob Herring Signed-off-by: Palmer Dabbelt Reviewed-by: Mimi Zohar --- drivers/of/kexec.c | 4 ++-- 1 file change

[PATCH v8 2/4] tpm: of: Make of-tree specific function commonly available

2022-09-01 Thread Stefan Berger
Simplify tpm_read_log_of() by moving reusable parts of the code into an inline function that makes it commonly available so it can be used also for kexec support. Call the new of_tpm_get_sml_parameters() function from the TPM Open Firmware driver. Signed-off-by: Stefan Berger Cc: Jarkko Sakkinen

[PATCH v8 3/4] of: kexec: Refactor IMA buffer related functions to make them reusable

2022-09-01 Thread Stefan Berger
Refactor IMA buffer related functions to make them reusable for carrying TPM logs across kexec. Signed-off-by: Stefan Berger Cc: Rob Herring Cc: Frank Rowand Cc: Mimi Zohar Reviewed-by: Mimi Zohar Reviewed-by: Rob Herring Tested-by: Nageswara R Sastry Tested-by: Coiby Xu --- v6: - Add __

[PATCH v8 4/4] tpm/kexec: Duplicate TPM measurement log in of-tree for kexec

2022-09-01 Thread Stefan Berger
The memory area of the TPM measurement log is currently not properly duplicated for carrying it across kexec when an Open Firmware Devicetree is used. Therefore, the contents of the log get corrupted. Fix this for the kexec_file_load() syscall by allocating a buffer and copying the contents of the

Re: [RFC 0/3] Asynchronous EEH recovery

2022-09-01 Thread Jason Gunthorpe
On Tue, Aug 16, 2022 at 08:57:13AM +0530, Ganesh Goudar wrote: > Hi, > > EEH reocvery is currently serialized and these patches shorten > the time taken for EEH recovery by making the recovery to run > in parallel. The original author of these patches is Sam Bobroff, > I have rebased and tested th

Re: [PATCH kernel 0/3] powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains

2022-09-01 Thread Jason Gunthorpe
On Thu, Jul 14, 2022 at 06:18:19PM +1000, Alexey Kardashevskiy wrote: > Here is another take on iommu_ops on POWER to make VFIO work > again on POWERPC64. > > The tree with all prerequisites is here: > https://github.com/aik/linux/tree/kvm-fixes-wip > > The previous discussion is here: > https://

[PATCH v4 1/4] mm/migrate_device.c: Flush TLB while holding PTL

2022-09-01 Thread Alistair Popple
When clearing a PTE the TLB should be flushed whilst still holding the PTL to avoid a potential race with madvise/munmap/etc. For example consider the following sequence: CPU0 CPU1 migrate_vma_collect_pmd() pte_unmap_unlock()

[PATCH v4 2/4] mm/migrate_device.c: Add missing flush_cache_page()

2022-09-01 Thread Alistair Popple
Currently we only call flush_cache_page() for the anon_exclusive case, however in both cases we clear the pte so should flush the cache. Signed-off-by: Alistair Popple Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while collecting pages") Cc: sta...@vger.kernel.org --- Ne

[PATCH v4 3/4] mm/migrate_device.c: Copy pte dirty bit to page

2022-09-01 Thread Alistair Popple
migrate_vma_setup() has a fast path in migrate_vma_collect_pmd() that installs migration entries directly if it can lock the migrating page. When removing a dirty pte the dirty bit is supposed to be carried over to the underlying page to prevent it being lost. Currently migrate_vma_*() can only be

[PATCH v4 4/4] selftests/hmm-tests: Add test for dirty bits

2022-09-01 Thread Alistair Popple
We were not correctly copying PTE dirty bits to pages during migrate_vma_setup() calls. This could potentially lead to data loss, so add a test for this. Signed-off-by: Alistair Popple --- tools/testing/selftests/vm/hmm-tests.c | 124 ++- 1 file changed, 124 insertions(+)

Re: [PATCH v8 2/4] tpm: of: Make of-tree specific function commonly available

2022-09-01 Thread Jarkko Sakkinen
On Thu, Sep 01, 2022 at 05:46:08PM -0400, Stefan Berger wrote: > Simplify tpm_read_log_of() by moving reusable parts of the code into > an inline function that makes it commonly available so it can be > used also for kexec support. Call the new of_tpm_get_sml_parameters() > function from the TPM Op

Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions

2022-09-01 Thread Sebastian Andrzej Siewior
On 2022-09-01 16:24:09 [-0400], Kent Overstreet wrote: > > --- a/include/linux/mmap_lock.h > > +++ b/include/linux/mmap_lock.h > > @@ -60,6 +60,18 @@ static inline void __mmap_lock_trace_released(struct > > mm_struct *mm, bool write) > > > > #endif /* CONFIG_TRACING */ > > > > +static inline

Re: [PATCH v4 2/4] mm/migrate_device.c: Add missing flush_cache_page()

2022-09-01 Thread David Hildenbrand
On 02.09.22 02:35, Alistair Popple wrote: > Currently we only call flush_cache_page() for the anon_exclusive case, > however in both cases we clear the pte so should flush the cache. > > Signed-off-by: Alistair Popple > Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while >

Re: [PATCH v4 1/4] mm/migrate_device.c: Flush TLB while holding PTL

2022-09-01 Thread David Hildenbrand
On 02.09.22 02:35, Alistair Popple wrote: > When clearing a PTE the TLB should be flushed whilst still holding the > PTL to avoid a potential race with madvise/munmap/etc. For example > consider the following sequence: > > CPU0 CPU1 >

Re: [PATCH v4 3/4] mm/migrate_device.c: Copy pte dirty bit to page

2022-09-01 Thread David Hildenbrand
On 02.09.22 02:35, Alistair Popple wrote: > migrate_vma_setup() has a fast path in migrate_vma_collect_pmd() that > installs migration entries directly if it can lock the migrating page. > When removing a dirty pte the dirty bit is supposed to be carried over > to the underlying page to prevent it