Re: Latest Git kernel doesn't compile because of the LINUX_VERSION_CODE issue

2021-02-26 Thread Christophe Leroy
Le 27/02/2021 à 08:13, Christian Zigotzky a écrit : Hello Christophe, Thanks a lot for compiling the latest git kernel. I have solved the compiling issue through setting up a value for the SUBLEVEL variable in "a/Makefile". Before it wasn't necessary to set up a value for the SUBLEVEL variab

Re: Latest Git kernel doesn't compile because of the LINUX_VERSION_CODE issue

2021-02-26 Thread Christian Zigotzky
Hello Christophe, Thanks a lot for compiling the latest git kernel. I have solved the compiling issue through setting up a value for the SUBLEVEL variable in "a/Makefile". Before it wasn't necessary to set up a value for the SUBLEVEL variable. Cheers, Christian On 26 February 21 at 5:10 pm,

[PATCH v7 10/10] powerpc/signal: Use __get_user() to copy sigset_t

2021-02-26 Thread Christopher M. Riedl
Usually sigset_t is exactly 8B which is a "trivial" size and does not warrant using __copy_from_user(). Use __get_user() directly in anticipation of future work to remove the trivial size optimizations from __copy_from_user(). The ppc32 implementation of get_sigset_t() previously called copy_from_

[PATCH v7 06/10] powerpc/signal64: Replace setup_sigcontext() w/ unsafe_setup_sigcontext()

2021-02-26 Thread Christopher M. Riedl
Previously setup_sigcontext() performed a costly KUAP switch on every uaccess operation. These repeated uaccess switches cause a significant drop in signal handling performance. Rewrite setup_sigcontext() to assume that a userspace write access window is open by replacing all uaccess functions wit

[PATCH v7 07/10] powerpc/signal64: Replace restore_sigcontext() w/ unsafe_restore_sigcontext()

2021-02-26 Thread Christopher M. Riedl
Previously restore_sigcontext() performed a costly KUAP switch on every uaccess operation. These repeated uaccess switches cause a significant drop in signal handling performance. Rewrite restore_sigcontext() to assume that a userspace read access window is open by replacing all uaccess functions

[PATCH v7 08/10] powerpc/signal64: Rewrite handle_rt_signal64() to minimise uaccess switches

2021-02-26 Thread Christopher M. Riedl
From: Daniel Axtens Add uaccess blocks and use the 'unsafe' versions of functions doing user access where possible to reduce the number of times uaccess has to be opened/closed. There is no 'unsafe' version of copy_siginfo_to_user, so move it slightly to allow for a "longer" uaccess block. Sign

[PATCH v7 00/10] Improve signal performance on PPC64 with KUAP

2021-02-26 Thread Christopher M. Riedl
As reported by Anton, there is a large penalty to signal handling performance on radix systems using KUAP. The signal handling code performs many user access operations, each of which needs to switch the KUAP permissions bit to open and then close user access. This involves a costly 'mtspr' operati

[PATCH v7 05/10] powerpc/signal64: Remove TM ifdefery in middle of if/else block

2021-02-26 Thread Christopher M. Riedl
Both rt_sigreturn() and handle_rt_signal_64() contain TM-related ifdefs which break-up an if/else block. Provide stubs for the ifdef-guarded TM functions and remove the need for an ifdef in rt_sigreturn(). Rework the remaining TM ifdef in handle_rt_signal64() similar to commit f1cf4f93de2f ("power

[PATCH v7 03/10] powerpc/signal64: Remove non-inline calls from setup_sigcontext()

2021-02-26 Thread Christopher M. Riedl
The majority of setup_sigcontext() can be refactored to execute in an "unsafe" context assuming an open uaccess window except for some non-inline function calls. Move these out into a separate prepare_setup_sigcontext() function which must be called first and before opening up a uaccess window. Non

[PATCH v7 04/10] powerpc: Reference parameter in MSR_TM_ACTIVE() macro

2021-02-26 Thread Christopher M. Riedl
Unlike the other MSR_TM_* macros, MSR_TM_ACTIVE does not reference or use its parameter unless CONFIG_PPC_TRANSACTIONAL_MEM is defined. This causes an 'unused variable' compile warning unless the variable is also guarded with CONFIG_PPC_TRANSACTIONAL_MEM. Reference but do nothing with the argument

[PATCH v7 02/10] powerpc/signal: Add unsafe_copy_{vsx, fpr}_from_user()

2021-02-26 Thread Christopher M. Riedl
Reuse the "safe" implementation from signal.c but call unsafe_get_user() directly in a loop to avoid the intermediate copy into a local buffer. Signed-off-by: Christopher M. Riedl Reviewed-by: Daniel Axtens --- arch/powerpc/kernel/signal.h | 26 ++ 1 file changed, 26 ins

[PATCH v7 09/10] powerpc/signal64: Rewrite rt_sigreturn() to minimise uaccess switches

2021-02-26 Thread Christopher M. Riedl
From: Daniel Axtens Add uaccess blocks and use the 'unsafe' versions of functions doing user access where possible to reduce the number of times uaccess has to be opened/closed. Signed-off-by: Daniel Axtens Co-developed-by: Christopher M. Riedl Signed-off-by: Christopher M. Riedl --- arch/po

[PATCH v7 01/10] powerpc/uaccess: Add unsafe_copy_from_user()

2021-02-26 Thread Christopher M. Riedl
Use the same approach as unsafe_copy_to_user() but instead call unsafe_get_user() in a loop. Signed-off-by: Christopher M. Riedl --- v7: * Change implementation to call unsafe_get_user() and remove dja's 'Reviewed-by' tag --- arch/powerpc/include/asm/uaccess.h | 21

Re: [PATCH v2 23/37] KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C

2021-02-26 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of February 27, 2021 10:21 am: > Excerpts from Fabiano Rosas's message of February 27, 2021 8:37 am: >> Nicholas Piggin writes: >> >> Hi, thanks for this. It helped me clarify a bunch of details that I >> haven't understood while reading the asm code. > >

Re: [PATCH v2 23/37] KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C

2021-02-26 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of February 27, 2021 8:37 am: > Nicholas Piggin writes: > > Hi, thanks for this. It helped me clarify a bunch of details that I > haven't understood while reading the asm code. Yes, me too :) >> +/* >> + * void kvmppc_p9_enter_guest(struct vcpu *vcpu); >> +

Re: [PATCH v2 17/37] KVM: PPC: Book3S HV P9: Move setting HDEC after switching to guest LPCR

2021-02-26 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of February 27, 2021 2:38 am: > Nicholas Piggin writes: > >> LPCR[HDICE]=0 suppresses hypervisor decrementer exceptions on some >> processors, so it must be enabled before HDEC is set. >> >> Rather than set it in the host LPCR then setting HDEC, move the HDEC

Re: [PATCH v2 16/37] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path

2021-02-26 Thread Nicholas Piggin
Excerpts from Cédric Le Goater's message of February 26, 2021 12:51 am: > On 2/25/21 2:46 PM, Nicholas Piggin wrote: >> In the interest of minimising the amount of code that is run in >> "real-mode", don't handle hcalls in real mode in the P9 path. >> >> POWER8 and earlier are much more expensive

Re: [PATCH v2 13/37] KVM: PPC: Book3S HV P9: Move radix MMU switching instructions together

2021-02-26 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of February 27, 2021 1:56 am: > Nicholas Piggin writes: > >> Switching the MMU from radix<->radix mode is tricky particularly as the >> MMU can remain enabled and requires a certain sequence of SPR updates. >> Move these together into their own functions. >>

Re: [PATCH v2 05/37] KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR

2021-02-26 Thread Nicholas Piggin
Excerpts from Daniel Axtens's message of February 26, 2021 4:06 pm: > Hi Nick, > >> void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) >> { >> +/* >> + * Guest must always run with machine check interrupt >> + * enabled. >> + */ >> +if (!(msr & MSR_ME)) >> +ms

Re: [PATCH v2 04/37] powerpc/64s: remove KVM SKIP test from instruction breakpoint handler

2021-02-26 Thread Nicholas Piggin
Excerpts from Daniel Axtens's message of February 26, 2021 3:44 pm: > Nicholas Piggin writes: > >> The code being executed in KVM_GUEST_MODE_SKIP is hypervisor code with >> MSR[IR]=0, so the faults of concern are the d-side ones caused by access >> to guest context by the hypervisor. >> >> Instru

Re: [PATCH v2 01/37] KVM: PPC: Book3S 64: remove unused kvmppc_h_protect argument

2021-02-26 Thread Nicholas Piggin
Excerpts from Daniel Axtens's message of February 26, 2021 3:01 pm: > Hi Nick, > >> The va argument is not used in the function or set by its asm caller, >> so remove it to be safe. > > Huh, so it isn't. I tracked the original implementation down to commit > a8606e20e41a ("KVM: PPC: Handle some P

Re: [PATCH v2 23/37] KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C

2021-02-26 Thread Fabiano Rosas
Nicholas Piggin writes: Hi, thanks for this. It helped me clarify a bunch of details that I haven't understood while reading the asm code. Some comments below: > Almost all logic is moved to C, by introducing a new in_guest mode that > selects and branches very early in the interrupt handler to

Re: [PATCH v4 5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM

2021-02-26 Thread Brian King
Reviewed-by: Brian King -- Brian King Power Linux I/O IBM Linux Technology Center

Re: [PATCH v2 17/37] KVM: PPC: Book3S HV P9: Move setting HDEC after switching to guest LPCR

2021-02-26 Thread Fabiano Rosas
Nicholas Piggin writes: > LPCR[HDICE]=0 suppresses hypervisor decrementer exceptions on some > processors, so it must be enabled before HDEC is set. > > Rather than set it in the host LPCR then setting HDEC, move the HDEC > update to after the guest MMU context (including LPCR) is loaded. > There

Re: [PATCH v4 2/5] ibmvfc: fix invalid sub-CRQ handles after hard reset

2021-02-26 Thread Brian King
Reviewed-by: Brian King -- Brian King Power Linux I/O IBM Linux Technology Center

Re: Freeing page tables through RCU

2021-02-26 Thread Jason Gunthorpe
On Fri, Feb 26, 2021 at 04:03:54PM +, Matthew Wilcox wrote: > On Fri, Feb 26, 2021 at 10:42:00AM -0400, Jason Gunthorpe wrote: > > On Thu, Feb 25, 2021 at 08:58:20PM +, Matthew Wilcox wrote: > > > > > I'd like to hear better ideas than this. > > > > You didn't like my suggestion to put a

Re: Freeing page tables through RCU

2021-02-26 Thread Gerald Schaefer
On Thu, 25 Feb 2021 20:58:20 + Matthew Wilcox wrote: > In order to walk the page tables without the mmap semaphore, it must > be possible to prevent them from being freed and reused (eg if munmap() > races with viewing /proc/$pid/smaps). > > There is various commentary within the mm on how t

Re: Latest Git kernel doesn't compile because of the LINUX_VERSION_CODE issue

2021-02-26 Thread Christophe Leroy
Le 26/02/2021 à 13:34, Christian Zigotzky a écrit : Hello, I tried to compile the latest Git kernel today. Unfortunately it doesn't compile. I have no such problem with latest git kernel. Christophe Error messages:   CC  arch/powerpc/kernel/udbg_16550.o In file included from ./in

Re: Freeing page tables through RCU

2021-02-26 Thread Matthew Wilcox
On Fri, Feb 26, 2021 at 10:42:00AM -0400, Jason Gunthorpe wrote: > On Thu, Feb 25, 2021 at 08:58:20PM +, Matthew Wilcox wrote: > > > I'd like to hear better ideas than this. > > You didn't like my suggestion to put a sleepable lock around the > freeing of page tables during flushing? > > I s

Re: [PATCH v2 13/37] KVM: PPC: Book3S HV P9: Move radix MMU switching instructions together

2021-02-26 Thread Fabiano Rosas
Nicholas Piggin writes: > Switching the MMU from radix<->radix mode is tricky particularly as the > MMU can remain enabled and requires a certain sequence of SPR updates. > Move these together into their own functions. > > This also includes the radix TLB check / flush because it's tied in to > M

Re: Freeing page tables through RCU

2021-02-26 Thread Jason Gunthorpe
On Thu, Feb 25, 2021 at 08:58:20PM +, Matthew Wilcox wrote: > I'd like to hear better ideas than this. You didn't like my suggestion to put a sleepable lock around the freeing of page tables during flushing? I still don't see how you convert the sleepable page walkers to use rcu?? Jason

Re: [PATCH V2 1/2] powerpc/perf: Infrastructure to support checking of attr.config*

2021-02-26 Thread Paul A. Clarke
Another drive-by review... just some minor nits, below... On Fri, Feb 26, 2021 at 12:20:24PM +0530, Madhavan Srinivasan wrote: > Introduce code to support the checking of attr.config* for > values which are reserved for a given platform. > Performance Monitoring Unit (PMU) configuration registers

Latest Git kernel doesn't compile because of the LINUX_VERSION_CODE issue

2021-02-26 Thread Christian Zigotzky
Hello, I tried to compile the latest Git kernel today. Unfortunately it doesn't compile. Error messages:   CC  arch/powerpc/kernel/udbg_16550.o In file included from ./include/linux/stackprotector.h:10:0, from arch/powerpc/kernel/smp.c:35: ./arch/powerpc/include/asm/stack

Re: [PATCH] powerpc/sstep: Fix VSX instruction emulation

2021-02-26 Thread Ravi Bangoria
On 2/25/21 8:49 AM, Jordan Niethe wrote: Commit af99da74333b ("powerpc/sstep: Support VSX vector paired storage access instructions") added loading and storing 32 word long data into adjacent VSRs. However the calculation used to determine if two VSRs needed to be loaded/stored inadvertently p

Re: [PATCH v4 12/14] swiotlb: Add restricted DMA alloc/free support.

2021-02-26 Thread Claire Chang
On Fri, Feb 26, 2021 at 1:17 PM Christoph Hellwig wrote: > > On Fri, Feb 26, 2021 at 12:17:50PM +0800, Claire Chang wrote: > > Do you think I should fix this and rebase on the latest linux-next > > now? I wonder if there are more factor and clean up coming and I > > should wait after that. > > Her

Re: [PATCH V2] powerpc/perf: Fix handling of privilege level checks in perf interrupt context

2021-02-26 Thread Peter Zijlstra
On Thu, Feb 25, 2021 at 05:10:39AM -0500, Athira Rajeev wrote: > diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c > index 4b4319d8..c8be44c 100644 > --- a/arch/powerpc/perf/core-book3s.c > +++ b/arch/powerpc/perf/core-book3s.c > @@ -222,7 +222,7 @@ static inline void p

Re: [PATCH] perf bench numa: Fix the condition checks for max number of numa nodes

2021-02-26 Thread Srikar Dronamraju
* Athira Rajeev [2021-02-25 11:50:02]: > In systems having higher node numbers available like node > 255, perf numa bench will fail with SIGABORT. > > <<>> > perf: bench/numa.c:1416: init: Assertion `!(g->p.nr_nodes > 64 || > g->p.nr_nodes < 0)' failed. > Aborted (core dumped) > <<>> > Looks