Re: [PATCH 1/1] mm: introduce vm_flags_reset_once to replace WRITE_ONCE vm_flags updates

2023-01-31 Thread Michal Hocko
On Tue 31-01-23 16:01:16, Suren Baghdasaryan wrote: > Provide vm_flags_reset_once() and replace the vm_flags updates which used > WRITE_ONCE() to prevent compiler optimizations. > > Fixes: 0cce31a0aa0e ("mm: replace vma->vm_flags direct modifications with > modifier calls") > Reported-by:

[PATCH v8 8/8] powerpc/kexec: add crash memory hotplug support

2023-01-31 Thread Sourabh Jain
Extend PowerPC arch crash hotplug handler to support memory hotplug events. Since elfcorehdr is used to exchange the memory info between the kernels hence it needs to be recreated to reflect the changes due to memory hotplug events. The way memory hotplug events are handled on PowerPC and the

[PATCH v8 6/8] powerpc/crash: add crash CPU hotplug support

2023-01-31 Thread Sourabh Jain
Introduce powerpc crash hotplug handler to update the necessary kexec segments on CPU/Memory hotplug events. A common crash hotplug handler is triggered from generic infrastructure for both CPU/Memory hot un/plugged events but in this patch, only CPU hot un/plugged events are introduced. The

[PATCH v8 7/8] crash: forward memory_notify args to arch crash hotplug handler

2023-01-31 Thread Sourabh Jain
The way memory hot remove is handled on PowerPC, it is hard to update the elfcorehdr without memory_notify args. On PowePC memblock data structure is used to prepare elfcorehdr for kdump. Since the notifier used for memory hotplug crash handler get initiated before the memblock data structure

[PATCH v8 5/8] crash: pass hotplug action type to arch crash hotplug handler

2023-01-31 Thread Sourabh Jain
On PowerPC, the crash update action for CPU and Memory hotplug events is not the same. Since arch_crash_handle_hotplug_event is a common crash hotplug handler for both CPU and Memory hot un/plug events, it is hard to differentiate which hotplug event triggered the arch crash hotplug handler and

[PATCH v8 1/8] powerpc/kexec: turn some static helper functions public

2023-01-31 Thread Sourabh Jain
Move update_cpus_node and get_crash_memory_ranges functions from kexec/file_load.c to kexec/core_64.c to make these functions usable by other kexec compoenets. Later in the series, both functions are used for in-kernel updates to kexec segments in the event of CPU/Memory hotplug for both

[PATCH v8 4/8] crash: add phdr for possible CPUs in elfcorehdr

2023-01-31 Thread Sourabh Jain
On architectures like PowerPC the crash notes are available for all possible CPUs. So let's populate the elfcorehdr for all possible CPUs having crash notes to avoid updating elfcorehdr during in-kernel crash update on CPU hotplug events. The similar technique is used in kexec-tool for kexec_load

[PATCH v8 3/8] powerpc/crash: update kimage_arch struct

2023-01-31 Thread Sourabh Jain
Add a new member "fdt_index" to kimage_arch struct to hold the index of the FDT (Flattened Device Tree) segment in the kexec segment array. Having direct access to FDT segment will help arch crash hotplug handler to avoid looping kexec segment array to identify the FDT segment index for every FDT

[PATCH v8 2/8] powerpc/crash hp: introduce a new config option CRASH_HOTPLUG

2023-01-31 Thread Sourabh Jain
The config option CRASH_HOTPLUG enables in kernel update to kexec segments due to CPU/Memory hotplug events. By default it is disabled. Signed-off-by: Sourabh Jain --- arch/powerpc/Kconfig | 12 1 file changed, 12 insertions(+) diff --git a/arch/powerpc/Kconfig

[PATCH v8 0/8] In kernel handling of CPU hotplug events for crash kernel

2023-01-31 Thread Sourabh Jain
The Problem: Post hotplug/DLPAR events the capture kernel holds stale information about the system. Dump collection with stale capture kernel might end up in dump capture failure or an inaccurate dump collection. Existing solution: == The existing solution to keep the

[PATCH v8 0/8] In kernel handling of CPU hotplug events for crash kernel

2023-01-31 Thread Sourabh Jain
The Problem: Post hotplug/DLPAR events the capture kernel holds stale information about the system. Dump collection with stale capture kernel might end up in dump capture failure or an inaccurate dump collection. Existing solution: == The existing solution to keep the

[PATCH v8 1/8] powerpc/kexec: turn some static helper functions public

2023-01-31 Thread Sourabh Jain
Move update_cpus_node and get_crash_memory_ranges functions from kexec/file_load.c to kexec/core_64.c to make these functions usable by other kexec compoenets. Later in the series, both functions are used for in-kernel updates to kexec segments in the event of CPU/Memory hotplug for both

Re: [PATCH v5 23/25] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-31 Thread Andrew Donnellan
On Tue, 2023-01-31 at 12:11 -0500, Stefan Berger wrote: > > +static int plpks_get_variable(const char *key, u64 key_len, u8 > > *data, > > + u64 *data_size) > > +{ > > +   struct plpks_var var = {0}; > > +   int rc = 0; > > + > > +   // We subtract 1 from

Re: [PATCH] powerpc/kexec_file: print error string on usable memory property update failure

2023-01-31 Thread Sourabh Jain
The only place on kexec/kdump path where we don't print reason for FDT operation failure. This patch fix that. Will this be a good candidate for next rc? Thanks, Sourabh On 16/12/22 17:57, Sourabh Jain wrote: Print the FDT error description along with the error message if failed to set the

[PATCH v2 5/5] powerpc: kcsan: Add KCSAN Support

2023-01-31 Thread Rohan McLure
Enable HAVE_ARCH_KCSAN on all powerpc platforms, permitting use of the kernel concurrency sanitiser through the CONFIG_KCSAN_* kconfig options. See documentation in Documentation/dev-tools/kcsan.rst for more information. Signed-off-by: Rohan McLure --- arch/powerpc/Kconfig | 1 + 1 file

[PATCH v2 4/5] powerpc: kcsan: Prevent recursive instrumentation with IRQ save/restores

2023-01-31 Thread Rohan McLure
Instrumented memory accesses provided by KCSAN will access core-local memories (which will save and restore IRQs) as well as restoring IRQs directly. Avoid recursive instrumentation by applying __no_kcsan annotation to IRQ restore routines. Signed-off-by: Rohan McLure ---

[PATCH v2 3/5] powerpc: kcsan: Memory barriers semantics

2023-01-31 Thread Rohan McLure
Annotate memory barriers *mb() with calls to kcsan_mb(), signaling to compilers supporting KCSAN that the respective memory barrier has been issued. Rename memory barrier *mb() to __*mb() to opt in for asm-generic/barrier.h to generate the respective *mb() macro. Signed-off-by: Rohan McLure ---

[PATCH v2 2/5] powerpc: kcsan: Exclude udelay to prevent recursive instrumentation

2023-01-31 Thread Rohan McLure
In order for KCSAN to increase its likelihood of observing a data race, it sets a watchpoint on memory accesses and stalls, allowing for detection of conflicting accesses by other kernel threads or interrupts. Stalls are implemented by injecting a call to udelay in instrumented code. To prevent

[PATCH v2 1/5] powerpc: kcsan: Add exclusions from instrumentation

2023-01-31 Thread Rohan McLure
Exclude various incompatible compilation units from KCSAN instrumentation. Signed-off-by: Rohan McLure --- arch/powerpc/kernel/Makefile | 10 ++ arch/powerpc/kernel/trace/Makefile | 1 + arch/powerpc/kernel/vdso/Makefile | 1 + arch/powerpc/lib/Makefile | 2 ++

[PATCH v2 0/5] powerpc: Add KCSAN support

2023-01-31 Thread Rohan McLure
Add Kernel Concurrency Sanitiser support for powerpc. Doing so involves exclusion of a number of compilation units from instrumentation, as was done with KASAN. KCSAN uses watchpoints on memory accesses to enforce the semantics of the Linux kernel memory model, notifying the user of observed data

Re: [PATCH] powerpc/kexec_file: Fix division by zero in extra size estimation

2023-01-31 Thread Sourabh Jain
On 01/02/23 07:25, Michael Ellerman wrote: Sourabh Jain writes: On 30/01/23 07:17, Michael Ellerman wrote: In kexec_extra_fdt_size_ppc64() there's logic to estimate how much extra space will be needed in the device tree for some memory related properties. That logic uses the size of RAM

Re: [PATCH v4 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-31 Thread Andrew Donnellan
On Tue, 2023-01-31 at 18:55 +1000, Nicholas Piggin wrote: > > > > +   var.datalen = 1; > > > > +   var.data = kzalloc(1, GFP_KERNEL); > > > > > > This could just point to a u8 on stack I think? > > > > Until we get VMAP_STACK and we'll have to switch back. > > AFAIKS plpks_read_var does

Re: [PATCH] powerpc/kexec_file: Fix division by zero in extra size estimation

2023-01-31 Thread Michael Ellerman
Sourabh Jain writes: > On 30/01/23 07:17, Michael Ellerman wrote: >> In kexec_extra_fdt_size_ppc64() there's logic to estimate how much >> extra space will be needed in the device tree for some memory related >> properties. >> >> That logic uses the size of RAM divided by drmem_lmb_size() to do

[powerpc:fixes] BUILD SUCCESS 111bcb37385353f0510e5847d5abcd1c613dba23

2023-01-31 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes branch HEAD: 111bcb37385353f0510e5847d5abcd1c613dba23 powerpc/64s/radix: Fix RWX mapping with relocated kernel elapsed time: 745m configs tested: 61 configs skipped: 101 The following configs have been built

[powerpc:next-test] BUILD SUCCESS 5746ca131e2496ccd5bb4d7a0244d6c38070cbf5

2023-01-31 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test branch HEAD: 5746ca131e2496ccd5bb4d7a0244d6c38070cbf5 powerpc/64: Don't recurse irq replay elapsed time: 720m configs tested: 2 configs skipped: 115 The following configs have been built successfully.

[powerpc:fixes-test] BUILD SUCCESS 37e5bf9657c8af85b91dda79c14eee5b7e0406d7

2023-01-31 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: 37e5bf9657c8af85b91dda79c14eee5b7e0406d7 powerpc/64s: Reconnect tlb_flush() to hash__tlb_flush() elapsed time: 745m configs tested: 69 configs skipped: 106 The following configs have been

[PATCH 0/5] powerpc: Add KCSAN support

2023-01-31 Thread Rohan McLure
Add Kernel Concurrency Sanitiser support for powerpc. Doing so involves exclusion of a number of compilation units from instrumentation, as was done with KASAN. KCSAN uses watchpoints on memory accesses to enforce the semantics of the Linux kernel memory model, notifying the user of observed data

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Suren Baghdasaryan
On Tue, Jan 31, 2023 at 3:12 PM Andrew Morton wrote: > > On Tue, 31 Jan 2023 13:08:19 -0800 Suren Baghdasaryan > wrote: > > > On Tue, Jan 31, 2023 at 12:54 PM Andrew Morton > > wrote: > > > > > > On Tue, 31 Jan 2023 10:54:22 -0800 Suren Baghdasaryan > > > wrote: > > > > > > > > > -

[PATCH 1/1] mm: introduce vm_flags_reset_once to replace WRITE_ONCE vm_flags updates

2023-01-31 Thread Suren Baghdasaryan
Provide vm_flags_reset_once() and replace the vm_flags updates which used WRITE_ONCE() to prevent compiler optimizations. Fixes: 0cce31a0aa0e ("mm: replace vma->vm_flags direct modifications with modifier calls") Reported-by: Hyeonggon Yoo <42.hye...@gmail.com> Signed-off-by: Suren Baghdasaryan

[PATCH 5/5] powerpc: kcsan: Add KCSAN Support

2023-01-31 Thread Rohan McLure
Enable HAVE_ARCH_KCSAN on all powerpc platforms, permitting use of the kernel concurrency sanitiser through the CONFIG_KCSAN_* kconfig options. See documentation in Documentation/dev-tools/kcsan.rst for more information. Signed-off-by: Rohan McLure --- arch/powerpc/Kconfig | 1 + 1 file

[PATCH 4/5] powerpc: kcsan: Prevent recursive instrumentation with IRQ save/restores

2023-01-31 Thread Rohan McLure
Instrumented memory accesses provided by KCSAN will access core-local memories (which will save and restore IRQs) as well as restoring IRQs directly. Avoid recursive instrumentation by applying __no_kcsan annotation to IRQ restore routines. Signed-off-by: Rohan McLure ---

[PATCH 3/5] powerpc: kcsan: Memory barriers semantics

2023-01-31 Thread Rohan McLure
Annotate memory barriers *mb() with calls to kcsan_mb(), signaling to compilers supporting KCSAN that the respective memory barrier has been issued. Rename memory barrier *mb() to __*mb() to opt in for asm-generic/barrier.h to generate the respective *mb() macro. Signed-off-by: Rohan McLure ---

[PATCH 2/5] powerpc: kcsan: Exclude udelay to prevent recursive instrumentation

2023-01-31 Thread Rohan McLure
In order for KCSAN to increase its likelihood of observing a data race, it sets a watchpoint on memory accesses and stalls, allowing for detection of conflicting accesses by other kernel threads or interrupts. Stalls are implemented by injecting a call to udelay in instrumented code. To prevent

[PATCH 1/5] powerpc: kcsan: Add exclusions from instrumentation

2023-01-31 Thread Rohan McLure
Exclude various incompatible compilation units from KCSAN instrumentation. Signed-off-by: Rohan McLure --- arch/powerpc/kernel/Makefile | 10 ++ arch/powerpc/kernel/trace/Makefile | 1 + arch/powerpc/kernel/vdso/Makefile | 1 + arch/powerpc/lib/Makefile | 2 ++

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Andrew Morton
On Tue, 31 Jan 2023 13:08:19 -0800 Suren Baghdasaryan wrote: > On Tue, Jan 31, 2023 at 12:54 PM Andrew Morton > wrote: > > > > On Tue, 31 Jan 2023 10:54:22 -0800 Suren Baghdasaryan > > wrote: > > > > > > > - vma->vm_flags &= ~VM_MAYWRITE; > > > > > +

Re: [PATCH] powerpc/tlb: Implement book3s/32/tlbflush.h local_flush_tlb_page_psize

2023-01-31 Thread Benjamin Gray
On Tue, 2023-01-31 at 06:33 +, Christophe Leroy wrote: > I still think it is not the correct fix. You are putting the problem > under the carpet instead of fixing it. There are many other places > where > radix_enabled() or other mmu_has_feature() are used with the > expectation > that one

Re: (subset) [PATCH 00/35] Documentation: correct lots of spelling errors (series 1)

2023-01-31 Thread Catalin Marinas
On Thu, 26 Jan 2023 22:39:30 -0800, Randy Dunlap wrote: > Correct many spelling errors in Documentation/ as reported by codespell. > > Maintainers of specific kernel subsystems are only Cc-ed on their > respective patches, not the entire series. [if all goes well] > > These patches are based on

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Suren Baghdasaryan
On Tue, Jan 31, 2023 at 12:54 PM Andrew Morton wrote: > > On Tue, 31 Jan 2023 10:54:22 -0800 Suren Baghdasaryan > wrote: > > > > > - vma->vm_flags &= ~VM_MAYWRITE; > > > > + vm_flags_clear(vma, VM_MAYSHARE); > > > > } > > > > > > I think it should be: > > >

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Andrew Morton
On Tue, 31 Jan 2023 10:54:22 -0800 Suren Baghdasaryan wrote: > > > - vma->vm_flags &= ~VM_MAYWRITE; > > > + vm_flags_clear(vma, VM_MAYSHARE); > > > } > > > > I think it should be: > > s/VM_MAYSHARE/VM_MAYWRITE/ > I added the fixup. Much better than

Re: [PATCH v2 4/4] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-31 Thread Conor Dooley
Hi Mike, On Tue, Jan 31, 2023 at 08:41:49PM +0200, Mike Rapoport wrote: > On Tue, Jan 31, 2023 at 05:47:24PM +, Conor Dooley wrote: > > On Sun, Jan 29, 2023 at 02:42:35PM +0200, Mike Rapoport wrote: > > > From: "Mike Rapoport (IBM)" > > > > > > Every architecture that supports FLATMEM

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Suren Baghdasaryan
On Tue, Jan 31, 2023 at 12:32 AM Hyeonggon Yoo <42.hye...@gmail.com> wrote: > > On Thu, Jan 26, 2023 at 11:37:49AM -0800, Suren Baghdasaryan wrote: > > Replace direct modifications to vma->vm_flags with calls to modifier > > functions to be able to track flag changes and to keep vma locking > >

[PATCH] powerpc/hv-24x7: Fix pvr check when setting interface version

2023-01-31 Thread Kajol Jain
Commit ec3eb9d941a9 ("powerpc/perf: Use PVR rather than oprofile field to determine CPU version") added usage of pvr value instead of oprofile field to determine the platform. In hv-24x7 pmu driver code, pvr check uses PVR_POWER8 when assigning the interface version for power8 platform. But power8

Re: [PATCH v2 4/4] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-31 Thread Mike Rapoport
Hi Conor, On Tue, Jan 31, 2023 at 05:47:24PM +, Conor Dooley wrote: > Hey Mike, > > On Sun, Jan 29, 2023 at 02:42:35PM +0200, Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > > > Every architecture that supports FLATMEM memory model defines its own > > version of pfn_valid() that

Re: [PATCH v2 4/4] mm, arch: add generic implementation of pfn_valid() for FLATMEM

2023-01-31 Thread Conor Dooley
Hey Mike, On Sun, Jan 29, 2023 at 02:42:35PM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (IBM)" > > Every architecture that supports FLATMEM memory model defines its own > version of pfn_valid() that essentially compares a pfn to max_mapnr. > > Use mips/powerpc version implemented as

Re: [PATCH v5 25/25] integrity/powerpc: Support loading keys from PLPKS

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Add support for loading keys from the PLPKS on pseries machines, with the "ibm,plpks-sb-v1" format. The object format is expected to be the same, so there shouldn't be any functional differences between objects retrieved on

Re: [PATCH v5 23/25] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The pseries platform can support dynamic secure boot (i.e. secure boot using user-defined keys) using variables contained with the PowerVM LPAR Platform KeyStore (PLPKS). Using the powerpc secvar API, expose the relevant

[PATCH 8/8] powerpc: copy_thread don't set ppr in user interrupt frame regs

2023-01-31 Thread Nicholas Piggin
syscalls do not set the PPR field in their interrupt frame and return from syscall always sets the default PPR for userspace, so setting the value in the ret_from_fork frame is not necessary and mildly inconsistent. Remove it. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 5

[PATCH 7/8] powerpc: copy_thread don't set _TIF_RESTOREALL

2023-01-31 Thread Nicholas Piggin
In the kernel user thread path, don't set _TIF_RESTOREALL because the thread is required to call kernel_execve() before it returns, which will set _TIF_RESTOREALL if necessary via start_thread(). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/interrupt_64.S | 5 +

[PATCH 6/8] powerpc: differentiate kthread from user kernel thread start

2023-01-31 Thread Nicholas Piggin
Kernel created user threads start similarly to kernel threads in that they call a kernel function after first returning from _switch, so they share ret_from_kernel_thread for this. Kernel threads never return from that function though, whereas user threads often do (although some don't, e.g., IO

[PATCH 5/8] powerpc: copy_thread differentiate kthreads and user mode threads

2023-01-31 Thread Nicholas Piggin
When copy_thread is given a kernel function to run in arg->fn, this does not necessarily mean it is a kernel thread. User threads can be created this way (e.g., kernel_init, see also x86's copy_thread). These user threads run a kernel function which may kernel_execve and return, which then returns

[PATCH 4/8] powerpc/64: ret_from_fork avoid restoring regs twice

2023-01-31 Thread Nicholas Piggin
If the system call return path always restores NVGPRs then there is no need for ret_from_fork to do it. The HANDLER_RESTORE_NVGPRS does the right thing for this. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/interrupt_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH 3/8] powerpc: use switch frame for ret_from_kernel_thread parameters

2023-01-31 Thread Nicholas Piggin
The kernel thread path in copy_thread creates a user interrupt frame on stack and stores the function and arg parameters there, and ret_from_kernel_thread loads them. This is a slightly confusing way to overload that frame. Non-volatile registers are loaded from the switch frame, so the parameters

[PATCH 2/8] powerpc: copy_thread make ret_from_fork register setup consistent

2023-01-31 Thread Nicholas Piggin
The ret_from_fork code for 64e and 32-bit set r3 for syscall_exit_prepare the same way that 64s does, so there should be no need to special-case them in copy_thread. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_32.S | 2 +- arch/powerpc/kernel/process.c | 3 --- 2 files

[PATCH 1/8] powerpc: copy_thread remove unused pkey code

2023-01-31 Thread Nicholas Piggin
The pkey registers (AMR, IAMR) do not get loaded from the switch frame so it is pointless to save anything there. Remove the dead code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/process.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git

[PATCH 0/8] powerpc: improve copy_thread

2023-01-31 Thread Nicholas Piggin
The way copy_thread works, particularly with kernel threads and kernel created user threads is a bit muddled and confusing. This series tries to straighten things out a bit. Thanks, Nick Nicholas Piggin (8): powerpc: copy_thread remove unused pkey code powerpc: copy_thread make ret_from_fork

Re: [PATCH v5 22/25] powerpc/pseries: Pass PLPKS password on kexec

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Before interacting with the PLPKS, we ask the hypervisor to generate a password for the current boot, which is then required for most further PLPKS operations. If we kexec into a new kernel, the new kernel will try and fail to

Re: [PATCH v5 21/25] powerpc/pseries: Add helper to get PLPKS password length

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Add helper function to get the PLPKS password length. This will be used in a later patch to support passing the password between kernels over kexec. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan Reviewed-by:

Re: [PATCH v5 20/25] powerpc/pseries: Turn PSERIES_PLPKS into a hidden option

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: It seems a bit unnecessary for the PLPKS code to have a user-visible config option when it doesn't do anything on its own, and there's existing options for enabling Secure Boot-related features. It should be enabled by PPC_SECURE_BOOT, which will

Re: [PATCH v5 19/25] powerpc/pseries: Make caller pass buffer to plpks_read_var()

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: Currently, plpks_read_var() allocates a buffer to pass to the H_PKS_READ_OBJECT hcall, then allocates another buffer, of the caller's -> buffer of the (no comma) preferred size if necessary, into which the data is copied, and returns that buffer

Re: [PATCH v5 18/25] powerpc/pseries: Log hcall return codes for PLPKS debug

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The plpks code converts hypervisor return codes into their Linux equivalents so that users can understand them. Having access to the original return codes is really useful for debugging, so add a pr_debug() so we don't lose

Re: [PATCH v5 17/25] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Nayna Jain The Platform Keystore provides a signed update interface which can be used to create, replace or append to certain variables in the PKS in a secure fashion, with the hypervisor requiring that the update be signed using the Platform

Re: [PATCH v5 16/25] powerpc/pseries: Expose PLPKS config values, support additional fields

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Nayna Jain The plpks driver uses the H_PKS_GET_CONFIG hcall to retrieve configuration and status information about the PKS from the hypervisor. Update _plpks_get_config() to handle some additional fields. Add getter functions to allow the PKS

Re: [PATCH v5 15/25] powerpc/pseries: Move PLPKS constants to header file

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Move the constants defined in plpks.c to plpks.h, and standardise their naming, so that PLPKS consumers can make use of them later on. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew

Re: [PATCH v5 14/25] powerpc/pseries: Move plpks.h to include directory

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Move plpks.h from platforms/pseries/ to include/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New

Re: [PATCH v5 13/25] powerpc/secvar: Don't print error on ENOENT when reading variables

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: If attempting to read the size or data attributes of a non-existent variable (which will be possible after a later patch to expose the PLPKS via the secvar interface), don't spam the kernel log with error messages. Only print errors for return codes

Re: [PATCH v5 12/25] powerpc/secvar: Warn when PAGE_SIZE is smaller than max object size

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: Due to sysfs constraints, when writing to a variable, we can only handle writes of up to PAGE_SIZE. It's possible that the maximum object size is larger than PAGE_SIZE, in which case, print a warning on boot so that the user is aware. Signed-off-by:

Re: [PATCH v5 11/25] powerpc/secvar: Allow backend to populate static list of variable names

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: Currently, the list of variables is populated by calling secvar_ops->get_next() repeatedly, which is explicitly modelled on the OPAL API (including the keylen parameter). For the upcoming PLPKS backend, we have a static list of variable names. It is

Re: [PATCH v5 10/25] powerpc/secvar: Extend sysfs to include config vars

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The forthcoming pseries consumer of the secvar API wants to expose a number of config variables. Allowing secvar implementations to provide their own sysfs attributes makes it easy for consumers to expose what they need to.

Re: [PATCH v5 09/25] powerpc/secvar: Clean up init error messages

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: Remove unnecessary prefixes from error messages in secvar_sysfs_init() (the file defines pr_fmt, so putting "secvar:" in every message is unnecessary). Make capitalisation and punctuation more consistent. Signed-off-by: Andrew Donnellan

Re: [PATCH v5 08/25] powerpc/secvar: Handle max object size in the consumer

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey Currently the max object size is handled in the core secvar code with an entirely OPAL-specific implementation, so create a new max_size() op and move the existing implementation into the powernv platform. Should be no

Re: [PATCH v5 07/25] powerpc/secvar: Handle format string in the consumer

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The code that handles the format string in secvar-sysfs.c is entirely OPAL specific, so create a new "format" op in secvar_operations to make the secvar code more generic. No functional change. Signed-off-by: Russell Currey

Re: [PATCH v5 06/25] powerpc/secvar: Use sysfs_emit() instead of sprintf()

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The secvar format string and object size sysfs files are both ASCII text, and should use sysfs_emit(). No functional change. Suggested-by: Greg Kroah-Hartman Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan

Re: [PATCH v5 03/25] powerpc/secvar: Fix incorrect return in secvar_sysfs_load()

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey secvar_ops->get_next() returns -ENOENT when there are no more variables to return, which is expected behaviour. Fix this by returning 0 if get_next() returns -ENOENT. This fixes an issue introduced in commit bd5d9c743d38

Re: [PATCH v5 05/25] powerpc/secvar: Warn and error if multiple secvar ops are set

2023-01-31 Thread Stefan Berger
On 1/31/23 01:39, Andrew Donnellan wrote: From: Russell Currey The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey Co-developed-by: Andrew

Re: [RFC PATCH 01/19] mm: Introduce vm_account

2023-01-31 Thread David Hildenbrand
On 24.01.23 06:42, Alistair Popple wrote: Kernel drivers that pin pages should account these pages against either user->locked_vm or mm->pinned_vm and fail the pinning if RLIMIT_MEMLOCK is exceeded and CAP_IPC_LOCK isn't held. Currently drivers open-code this accounting and use various methods

[PATCH] tests/bpf: Fix the bpf test to check for libtraceevent support

2023-01-31 Thread Athira Rajeev
"bpf" tests fails in environment with missing libtraceevent support as below: # ./perf test 36 36: BPF filter : 36.1: Basic BPF filtering : FAILED! 36.2: BPF pinning

[PATCH] tools/perf: Fix usage of perf probe when libtraceevent is missing

2023-01-31 Thread Athira Rajeev
While parsing the tracepoint events in parse_events_add_tracepoint() function, code checks for HAVE_LIBTRACEEVENT support. This is needed since libtraceevent is necessary for tracepoint. But while adding probe points, check for LIBTRACEEVENT is not done in case of perf probe. Hence, in environment

Re: [PATCH v2] powerpc/mce: log the error for all unrecoverable errors

2023-01-31 Thread Michael Ellerman
Ganesh Goudar writes: > For all unrecoverable errors we are missing to log the > error, Since machine_check_log_err() is not getting called > for unrecoverable errors. > > Raise irq work in save_mce_event() for unrecoverable errors, > So that we log the error from MCE event handling block in >

[PATCH] powerpc/64s: Reconnect tlb_flush() to hash__tlb_flush()

2023-01-31 Thread Michael Ellerman
Commit baf1ed24b27d ("powerpc/mm: Remove empty hash__ functions") removed some empty hash MMU flushing routines, but got a bit overeager and also removed the call to hash__tlb_flush() from tlb_flush(). In regular use this doesn't lead to any noticable breakage, which is a little concerning.

Re: [PATCH v1 06/10] powerpc/bpf: Perform complete extra passes to update addresses

2023-01-31 Thread Christophe Leroy
Le 10/01/2023 à 09:44, Naveen N. Rao a écrit : > Christophe Leroy wrote: >> >> >> Le 13/12/2022 à 11:23, Naveen N. Rao a écrit : >>> Christophe Leroy wrote: BPF core calls the jit compiler again for an extra pass in order to properly set subprog addresses. Unlike other

Re: [PATCH] powerpc/kexec_file: Fix division by zero in extra size estimation

2023-01-31 Thread Sourabh Jain
Hello Michael, On 30/01/23 07:17, Michael Ellerman wrote: In kexec_extra_fdt_size_ppc64() there's logic to estimate how much extra space will be needed in the device tree for some memory related properties. That logic uses the size of RAM divided by drmem_lmb_size() to do the estimation.

Re: [PATCH v4 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-31 Thread Nicholas Piggin
On Tue Jan 31, 2023 at 12:54 PM AEST, Andrew Donnellan wrote: > On Tue, 2023-01-24 at 15:17 +1000, Nicholas Piggin wrote: > > > +static const char * const plpks_var_names[] = { > > > +   "PK", > > > +   "KEK", > > > +   "db", > > > +   "dbx", > > > +   "grubdb", > > > +   

Re: [PATCH v4 4/7] mm: replace vma->vm_flags direct modifications with modifier calls

2023-01-31 Thread Hyeonggon Yoo
On Thu, Jan 26, 2023 at 11:37:49AM -0800, Suren Baghdasaryan wrote: > Replace direct modifications to vma->vm_flags with calls to modifier > functions to be able to track flag changes and to keep vma locking > correctness. > > Signed-off-by: Suren Baghdasaryan > Acked-by: Michal Hocko >

Re: [PATCH v2] powerpc: Implement arch_within_stack_frames

2023-01-31 Thread Michael Ellerman
Nicholas Miehlbradt writes: > Walks the stack when copy_{to,from}_user address is in the stack to > ensure that the object being copied is entirely within a single stack > frame. ... and that it exists above the parameter save area, so is not pointing at any stack metadata right? > Substatially