[PATCH 12/19] kvm/book3s_64_vio: Convert account_locked_vm() to vm_account_pinned()

2023-02-05 Thread Alistair Popple
book3s_64_vio currently accounts for pinned pages with account_locked_vm() which charges the pages to mm->locked_vm. To make this consistent with other drivers switch to using vm_account_pinned(). Signed-off-by: Alistair Popple Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc:

[PATCH 08/19] vfio/spapr_tce: Convert accounting to pinned_vm

2023-02-05 Thread Alistair Popple
Convert from accounting pages against locked_vm to accounting them to pinned_vm. This allows struct vm_account to be used to track the mm_struct used to charge the pages. A future change also uses this to track a cgroup for controlling pinned pages. Signed-off-by: Alistair Popple Cc: Michael Elle

[PATCH 01/19] mm: Introduce vm_account

2023-02-05 Thread Alistair Popple
Kernel drivers that pin pages should account these pages against either user->locked_vm and/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 to update the atomic variables and check

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

2023-02-05 Thread Sourabh Jain
On 03/02/23 02:31, Eric DeVolder wrote: On 2/2/23 09:37, Eric DeVolder wrote: On 2/1/23 00:38, Sourabh Jain wrote: 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

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

2023-02-05 Thread Sourabh Jain
On 02/02/23 21:07, Eric DeVolder wrote: On 2/1/23 00:38, Sourabh Jain wrote: 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

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

2023-02-05 Thread Sourabh Jain
On 02/02/23 21:07, Eric DeVolder wrote: On 2/1/23 00:38, Sourabh Jain wrote: 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

Re: [PATCH] tools/perf/tests: Add system wide check for perf bench workload in all metric test

2023-02-05 Thread Athira Rajeev
> On 02-Feb-2023, at 10:14 PM, Kajol Jain wrote: > > Testcase stat_all_metrics.sh fails in powerpc: > > 92: perf all metrics test : FAILED! > > Logs with verbose: > > [command]# ./perf test 92 -vv > 92: perf all metrics test : > --- start --- > test

[PATCH] powerpc/64s/interrupt: Fix interrupt exit race with security mitigation switch

2023-02-05 Thread Nicholas Piggin
The RFI and STF security mitigation options can flip the interrupt_exit_not_reentrant static branch condition concurrently with the interrupt exit code which tests that branch. Interrupt exit tests this condition to set MSR[EE|RI] for exit, then again in the case a soft-masked interrupt is found p

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

2023-02-05 Thread Athira Rajeev
> On 02-Feb-2023, at 6:27 AM, Arnaldo Carvalho de Melo wrote: > > Em Tue, Jan 31, 2023 at 07:20:01PM +0530, Athira Rajeev escreveu: >> "bpf" tests fails in environment with missing libtraceevent >> support as below: >> >> # ./perf test 36 >> 36: BPF filter

Re: [PATCH 05/22] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-05 Thread Guo Ren
On Sat, Feb 4, 2023 at 10:29 AM Josh Poimboeuf wrote: > > On Sat, Feb 04, 2023 at 09:12:31AM +0800, Guo Ren wrote: > > On Sat, Feb 4, 2023 at 6:05 AM Josh Poimboeuf wrote: > > > > > > arch_cpu_idle_dead() doesn't return. Make that more explicit with a > > > BUG(). > > > > > > BUG() is preferable

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

2023-02-05 Thread Rohan McLure
Enable HAVE_ARCH_KCSAN on all powerpc platforms, permitting use of the kernel concurrency sanitiser through the CONFIG_KCSAN_* kconfig options. KCSAN requires compiler builtins __atomic_* 64-bit values, and so only report support on PPC64. See documentation in Documentation/dev-tools/kcsan.rst for

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

2023-02-05 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 re

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

2023-02-05 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 --- arch/powerpc/kernel/irq

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

2023-02-05 Thread Rohan McLure
Add Kernel Concurrency Sanitiser support for PPC64. 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 ra

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

2023-02-05 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 --- v

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

2023-02-05 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 ++ arch/po

Re: [PATCH 0/2] powerpc: Fix livepatch module re-patching issue

2023-02-05 Thread Josh Poimboeuf
On Sun, Feb 05, 2023 at 11:46:12AM +1100, Michael Ellerman wrote: > Josh Poimboeuf writes: > > On Tue, Jan 24, 2023 at 07:38:03PM -0800, Josh Poimboeuf wrote: > >> Fix a livepatch bug seen when reloading a patched module. > >> > >> This is the powerpc counterpart to Song Liu's fix for a similar i

[PATCH v6 7/7] PCI: Work around PCIe link training failures

2023-02-05 Thread Maciej W. Rozycki
Attempt to handle cases such as with a downstream port of the ASMedia ASM2824 PCIe switch where link training never completes and the link continues switching between speeds indefinitely with the data link layer never reaching the active state. It has been observed with a downstream port of the

[PATCH v6 3/7] PCI: Initialize `link_active_reporting' earlier

2023-02-05 Thread Maciej W. Rozycki
Determine whether Data Link Layer Link Active Reporting is available ahead of calling any fixups so that the cached value can be used there and later on. Signed-off-by: Maciej W. Rozycki --- New change in v6. --- drivers/pci/probe.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-)

[PATCH v6 0/7] pci: Work around ASMedia ASM2824 PCIe link training failures

2023-02-05 Thread Maciej W. Rozycki
Hi, This is v6 of the change to work around a PCIe link training phenomenon where a pair of devices both capable of operating at a link speed above 2.5GT/s seems unable to negotiate the link speed and continues training indefinitely with the Link Training bit switching on and off repeatedly a

[PATCH v6 6/7] PCI: pciehp: Rely on `link_active_reporting'

2023-02-05 Thread Maciej W. Rozycki
Use `link_active_reporting' to determine whether Data Link Layer Link Active Reporting is available rather than re-retrieving the capability. Signed-off-by: Maciej W. Rozycki --- NB this has been compile-tested only with PPC64LE and x86-64 configurations. New change in v6. --- drivers/pci/hotp

[PATCH v6 5/7] net/mlx5: Rely on `link_active_reporting'

2023-02-05 Thread Maciej W. Rozycki
Use `link_active_reporting' to determine whether Data Link Layer Link Active Reporting is available rather than re-retrieving the capability. Signed-off-by: Maciej W. Rozycki --- NB this has been compile-tested only with PPC64LE and x86-64 configurations. New change in v6. --- drivers/net/eth

[PATCH v6 4/7] powerpc/eeh: Rely on `link_active_reporting'

2023-02-05 Thread Maciej W. Rozycki
Use `link_active_reporting' to determine whether Data Link Layer Link Active Reporting is available rather than re-retrieving the capability. Signed-off-by: Maciej W. Rozycki --- NB this has been compile-tested only with a PPC64LE configuration. New change in v6. --- arch/powerpc/kernel/eeh_pe

[PATCH v6 2/7] PCI: Execute `quirk_enable_clear_retrain_link' earlier

2023-02-05 Thread Maciej W. Rozycki
Make `quirk_enable_clear_retrain_link' `pci_fixup_early' so that any later fixups can rely on `clear_retrain_link' to have been already initialised. Signed-off-by: Maciej W. Rozycki --- No change from v5. New change in v5. --- drivers/pci/quirks.c |6 +++--- 1 file changed, 3 insertions(+)

[PATCH v6 1/7] PCI: Export PCI link retrain timeout

2023-02-05 Thread Maciej W. Rozycki
Rename LINK_RETRAIN_TIMEOUT to PCIE_LINK_RETRAIN_TIMEOUT and make it available via "pci.h" for PCI drivers to use. Signed-off-by: Maciej W. Rozycki --- No change from v5. New change in v5. --- drivers/pci/pci.h |2 ++ drivers/pci/pcie/aspm.c |4 +--- 2 files changed, 3 insertions(

Re: [merge] WARN arch/powerpc/kernel/irq_64.c:278

2023-02-05 Thread Sachin Sant
> On 03-Feb-2023, at 3:55 PM, Nicholas Piggin wrote: > > On Fri Feb 3, 2023 at 4:26 PM AEST, Sachin Sant wrote: >> I am observing an intermittent crash while running powerpc/security >> selftests on a Power10 LPAR booted with powerpc/merge branch code. >> >> [ cut here ]--

Re: [PATCH] powerpc/kexec_file: fix implicit decl error

2023-02-05 Thread Sourabh Jain
On 04/02/23 22:52, Randy Dunlap wrote: kexec (PPC64) code calls memory_hotplug_max(). Add the header declaration for it from . Using does not work since the #include for depends on CONFIG_NUMA=y, which is not set in this kernel config file. I didn't realize that linux/mmzone.h includes asm/

[powerpc:fixes-test] BUILD SUCCESS e33416fca8a2313b8650bd5807aaf34354d39a4c

2023-02-05 Thread kernel test robot
rhel-8.3 x86_64 rhel-8.3-func x86_64rhel-8.3-kselftests clang tested configs: riscvrandconfig-r042-20230205 s390 randconfig-r044-20230205 hexagon randconfig-r045-20230205 hexagon randconfig

[powerpc:fixes] BUILD SUCCESS 1665c027afb225882a5a0b014c45e84290b826c2

2023-02-05 Thread kernel test robot
defconfig x86_64 allyesconfig x86_64 rhel-8.3 clang tested configs: riscvrandconfig-r042-20230205 s390 randconfig-r044-20230205 hexagon randconfig-r045-20230205 hexagon randconfig

Re: [PATCH v2] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2023-02-05 Thread Michael Ellerman
On Tue, 31 Jan 2023 08:36:15 +0530, Sourabh Jain wrote: > On Systems where online memory is lesser compared to max memory, the > kexec_file_load system call may fail to load the kdump kernel with the > below errors: > > "Failed to update fdt with linux,drconf-usable-memory property" > "Err

Re: [PATCH] powerpc/kvm: Fix objtool warning for unannotated intra-function call in booke.o

2023-02-05 Thread Michael Ellerman
On Sat, 28 Jan 2023 18:11:58 +0530, Sathvika Vasireddy wrote: > Objtool throws the following warning: > arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30: > unannotated intra-function call > > Fix this warning by allowing the function to set the value of 'nip' field > using _TH

Re: [PATCH v2] powerpc/64: Fix perf profiling asynchronous interrupt handlers

2023-02-05 Thread Michael Ellerman
On Sat, 21 Jan 2023 20:01:56 +1000, Nicholas Piggin wrote: > Interrupt entry sets the soft mask to IRQS_ALL_DISABLED to match the > hard irq disabled state. So when should_hard_irq_enable() returns true > because we want PMI interrupts in irq handlers, MSR[EE] is enabled but > PMIs just get soft-ma

Re: [PATCH] powerpc/64s: Fix local irq disable when PMIs are disabled

2023-02-05 Thread Michael Ellerman
On Sat, 21 Jan 2023 19:53:52 +1000, Nicholas Piggin wrote: > When PMI interrupts are soft-masked, local_irq_save() will clear the PMI > mask bit, allowing PMIs in and causing a race condition. This causes a > deadlock in native_hpte_insert via hash_preload, which depends on PMIs > being disabled si

Re: [PATCH] powerpc: Fix objtool warning for unannotated intra-function call in head_85xx.o

2023-02-05 Thread Michael Ellerman
On Sat, 28 Jan 2023 18:11:38 +0530, Sathvika Vasireddy wrote: > Objtool throws the following warning: > arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c: > unannotated intra-function call > > Fix this warning by annotating KernelSPE symbol with SYM_FUNC_START_LOCAL > and SYM_FU

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

2023-02-05 Thread Michael Ellerman
On Mon, 30 Jan 2023 12:47:07 +1100, 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 > estimat

Re: [PATCH] powerpc/imc-pmu: Revert nest_init_lock to being a mutex

2023-02-05 Thread Michael Ellerman
On Mon, 30 Jan 2023 12:44:01 +1100, Michael Ellerman wrote: > The recent commit 76d588dddc45 ("powerpc/imc-pmu: Fix use of mutex in > IRQs disabled section") fixed warnings (and possible deadlocks) in the > IMC PMU driver by converting the locking to use spinlocks. > > It also converted the init-t

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

2023-02-05 Thread Michael Ellerman
On Tue, 31 Jan 2023 22:14:07 +1100, Michael Ellerman wrote: > 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'

Re: [PATCH 1/2] powerpc/64s/radix: Fix crash with unaligned relocated kernel

2023-02-05 Thread Michael Ellerman
On Tue, 10 Jan 2023 23:47:52 +1100, Michael Ellerman wrote: > If a relocatable kernel is loaded at an address that is not 2MB aligned > and told not to relocate to zero, the kernel can crash due to > mark_rodata_ro() incorrectly changing some read-write data to read-only. > > Scenarios where the m