Re: RFC on writel and writel_relaxed

2018-03-28 Thread Arnd Bergmann
On Wed, Mar 28, 2018 at 8:56 AM, Benjamin Herrenschmidt wrote: > On Wed, 2018-03-28 at 06:53 +, Linus Torvalds wrote: >> On Tue, Mar 27, 2018, 20:43 Benjamin Herrenschmidt >> wrote: >> That's why in/out were *so* slow, and why nobody uses them any more >> (well, the address size limitations

Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

2018-03-28 Thread Mathieu Malaterre
On Tue, Mar 27, 2018 at 7:33 PM, LEROY Christophe wrote: > LEROY Christophe a écrit : > > >> Mathieu Malaterre a écrit : >> >>> Christophe, >>> >>> On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe >>> wrote: Mathieu Malaterre a écrit : > On Fri, Mar 23, 2018 at 1:19 PM

Re: [PATCH v9 01/24] mm: Introduce CONFIG_SPECULATIVE_PAGE_FAULT

2018-03-28 Thread Laurent Dufour
Hi David, Thanks a lot for your deep review on this series. On 25/03/2018 23:50, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> This configuration variable will be used to build the code needed to >> handle speculative page fault. >> >> By default it is turned off, and a

Re: [PATCH v9 05/24] mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE

2018-03-28 Thread Laurent Dufour
On 25/03/2018 23:50, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> When handling page fault without holding the mmap_sem the fetch of the >> pte lock pointer and the locking will have to be done while ensuring >> that the VMA is not touched in our back. >> >> So move the

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 09:11 +0200, Arnd Bergmann wrote: > On Wed, Mar 28, 2018 at 8:56 AM, Benjamin Herrenschmidt > wrote: > > On Wed, 2018-03-28 at 06:53 +, Linus Torvalds wrote: > > > On Tue, Mar 27, 2018, 20:43 Benjamin Herrenschmidt > > > wrote: > > > That's why in/out were *so* slow, an

Re: [PATCH v9 06/24] mm: make pte_unmap_same compatible with SPF

2018-03-28 Thread Laurent Dufour
On 27/03/2018 23:18, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index 2f3e98edc94a..b6432a261e63 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -1199,6 +1199,7 @@ static inline void clear_p

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Linus Torvalds
On Tue, Mar 27, 2018, 20:43 Benjamin Herrenschmidt wrote: > > > > Of course, you'd have to be pretty odd to want to start a DMA with a > > read anyway - partly exactly because it's bad for performance since > > reads will be synchronous and not buffered like a write). > > I have bad memories of o

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Will Deacon
On Wed, Mar 28, 2018 at 08:29:45AM +1100, Benjamin Herrenschmidt wrote: > On Tue, 2018-03-27 at 15:36 +0100, Will Deacon wrote: > > > Can we say the same thing for iowrite32() and iowrite32be(). I also see > > > wmb() > > > in front of these. > > > > I don't think so. My reading of memory-barrier

RE: RFC on writel and writel_relaxed

2018-03-28 Thread David Laight
From: Will Deacon > Sent: 28 March 2018 09:54 ... > > > I don't think so. My reading of memory-barriers.txt says that writeX might > > > expand to outX, and outX is not ordered with respect to other types of > > > memory. > > > > Ugh ? > > > > My understanding of HW at least is the exact opposite.

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Will Deacon
On Wed, Mar 28, 2018 at 05:42:56PM +1100, Benjamin Herrenschmidt wrote: > On Tue, 2018-03-27 at 20:26 -1000, Linus Torvalds wrote: > > On Tue, Mar 27, 2018 at 6:33 PM, Benjamin Herrenschmidt > > wrote: > > > > > > This is why, I want (with your agreement) to define clearly and once > > > and for

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Will Deacon
On Wed, Mar 28, 2018 at 09:00:01AM +, David Laight wrote: > From: Will Deacon > > Sent: 28 March 2018 09:54 > ... > > > > I don't think so. My reading of memory-barriers.txt says that writeX > > > > might > > > > expand to outX, and outX is not ordered with respect to other types of > > > > me

Re: [PATCH v2 10/10] powerpc/64s: Wire up cpu_show_spectre_v2()

2018-03-28 Thread Diana Madalina Craciun
Why is the speculation barrier specific to Spectre v2? Can't the barrier be used as a mitigation for Spectre v1 as well? Regards, Diana On 3/27/2018 3:32 PM, Michael Ellerman wrote: > Add a definition for cpu_show_spectre_v2() to override the generic > version. This has several permuations, thoug

[PATCH 0/5] remove PURR read from context switch and timer

2018-03-28 Thread Nicholas Piggin
And some associated cleanups to the timer code as a result Nicholas Piggin (5): powerpc/64: remove start_tb and accum_tb from thread_struct powerpc/pseries: lparcfg calculate PURR on demand powerpc: clockevents broadcast receiver use tick_receive_broadcast powerpc: move timer broadcast

[PATCH 1/5] powerpc/64: remove start_tb and accum_tb from thread_struct

2018-03-28 Thread Nicholas Piggin
These fields are only written to. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/processor.h | 4 arch/powerpc/kernel/process.c| 6 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/proc

[PATCH 2/5] powerpc/pseries: lparcfg calculate PURR on demand

2018-03-28 Thread Nicholas Piggin
For SPLPAR, lparcfg provides a sum of PURR registers for all CPUs. Currently this is done by reading PURR in context switch and timer interrupt, and storing that into a per-CPU variable. These are summed to provide the value. This does not work with all timer schemes (e.g., NO_HZ_FULL), and it is

[PATCH 3/5] powerpc: clockevents broadcast receiver use tick_receive_broadcast

2018-03-28 Thread Nicholas Piggin
The broadcast tick recipient can call tick_receive_broadcast rather than re-running the full timer interrupt. It does not not have to check for the next event time, because the sender already determined the timer has expired. It does not have to test irq_work_pending, because that's a direct decre

[PATCH 4/5] powerpc: move timer broadcast code under GENERIC_CLOCKEVENTS_BROADCAST ifdef

2018-03-28 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/smp.c | 8 arch/powerpc/kernel/time.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index de5ac63b4ad6..17c6abed3def 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/p

[PATCH 5/5] powerpc: move a stray NMI IPI case under NMI_IPI ifdef

2018-03-28 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 17c6abed3def..6185b7245e9e 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -193,7 +193,9 @@ cons

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 09:53 +0100, Will Deacon wrote: > For arm/arm64 these end up behaving exactly the same as readX/writeX, but > I'm nervous about changing the documentation without understanding why it's > like it is currently. Maybe another ia64 thing?. I doubt it ... the Intel ancestry here

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Arnd Bergmann
On Wed, Mar 28, 2018 at 11:50 AM, Benjamin Herrenschmidt wrote: > On Wed, 2018-03-28 at 09:53 +0100, Will Deacon wrote: >> For arm/arm64 these end up behaving exactly the same as readX/writeX, but >> I'm nervous about changing the documentation without understanding why it's >> like it is currentl

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 10:07 +0100, Will Deacon wrote: > > For arm/arm64 we guarantee ordering for (1) but not for (2) -- you'd need to > add an mb() to make it work. > > Do both of these work on power? Yes. There's even another quirk, see further down ;-) > If so, I guess I can make readl even

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 10:09 +0100, Will Deacon wrote: > On Wed, Mar 28, 2018 at 09:00:01AM +, David Laight wrote: > > From: Will Deacon > > > Sent: 28 March 2018 09:54 > > > > ... > > > > > I don't think so. My reading of memory-barriers.txt says that writeX > > > > > might > > > > > expand t

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 11:55 +0200, Arnd Bergmann wrote: > > powerpc and ARM can't quite make them synchronous I think, but at least > > they should have the same semantics as writel. > > One thing that ARM does IIRC is that it only guarantees to order writel() > within > one device, and the memor

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Will Deacon
On Wed, Mar 28, 2018 at 09:01:27PM +1100, Benjamin Herrenschmidt wrote: > On Wed, 2018-03-28 at 11:55 +0200, Arnd Bergmann wrote: > > > powerpc and ARM can't quite make them synchronous I think, but at least > > > they should have the same semantics as writel. > > > > One thing that ARM does IIRC

Re: [PATCH v9 01/24] mm: Introduce CONFIG_SPECULATIVE_PAGE_FAULT

2018-03-28 Thread David Rientjes
On Wed, 28 Mar 2018, Laurent Dufour wrote: > >> This configuration variable will be used to build the code needed to > >> handle speculative page fault. > >> > >> By default it is turned off, and activated depending on architecture > >> support. > >> > >> Suggested-by: Thomas Gleixner > >> Signed

Aw: Re: RFC on writel and writel_relaxed

2018-03-28 Thread Lino Sanfilippo
Hi, > > Yeah so that other trick I'm talking about is also used for timing > accuracy. > > For example, let's say I have a device with a reset bit and the spec > says the reset bit needs to be set for at least 10us. > > This is wrong: > > writel(1, RESET_REG); > usleep(10); >

Re: [PATCH v9 06/24] mm: make pte_unmap_same compatible with SPF

2018-03-28 Thread David Rientjes
On Wed, 28 Mar 2018, Laurent Dufour wrote: > >> @@ -2913,7 +2921,8 @@ int do_swap_page(struct vm_fault *vmf) > >>int exclusive = 0; > >>int ret = 0; > > > > Initialization is now unneeded. > > I'm sorry, what "initialization" are you talking about here ? > The initialization of the ret

Re: [PATCH v9 04/24] mm: Prepare for FAULT_FLAG_SPECULATIVE

2018-03-28 Thread Laurent Dufour
On 25/03/2018 23:50, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> From: Peter Zijlstra >> >> When speculating faults (without holding mmap_sem) we need to validate >> that the vma against which we loaded pages is still valid when we're >> ready to install the new PTE. >

Re: [PATCH] powerpc: Clear branch trap (MSR.BE) before delivering SIGTRAP

2018-03-28 Thread Matt Evans
Howdy Michael, > On 28 Mar 2018, at 06:54, Michael Ellerman wrote: > > Matt Evans writes: > >> When using SIG_DBG_BRANCH_TRACING, MSR.BE is left enabled in the >> user context when single_step_exception() prepares the SIGTRAP >> delivery. The resulting branch-trap-within-the-SIGTRAP-handler >

Re: Aw: Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 12:13 +0200, Lino Sanfilippo wrote: > Hi, > > > > > > Yeah so that other trick I'm talking about is also used for timing > > accuracy. > > > > For example, let's say I have a device with a reset bit and the spec > > says the reset bit needs to be set for at least 10us. > >

Re: [PATCH v9 06/24] mm: make pte_unmap_same compatible with SPF

2018-03-28 Thread Laurent Dufour
On 28/03/2018 12:20, David Rientjes wrote: > On Wed, 28 Mar 2018, Laurent Dufour wrote: > @@ -2913,7 +2921,8 @@ int do_swap_page(struct vm_fault *vmf) int exclusive = 0; int ret = 0; >>> >>> Initialization is now unneeded. >> >> I'm sorry, what "initialization" are you talki

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Yury Norov
On Tue, Mar 27, 2018 at 11:21:17AM +0100, Will Deacon wrote: > On Sun, Mar 25, 2018 at 08:50:04PM +0300, Yury Norov wrote: > > kick_all_cpus_sync() forces all CPUs to sync caches by sending broadcast > > IPI. > > If CPU is in extended quiescent state (idle task or nohz_full userspace), > > this >

Re: [PATCH v9 01/24] mm: Introduce CONFIG_SPECULATIVE_PAGE_FAULT

2018-03-28 Thread Laurent Dufour
On 28/03/2018 12:16, David Rientjes wrote: > On Wed, 28 Mar 2018, Laurent Dufour wrote: > This configuration variable will be used to build the code needed to handle speculative page fault. By default it is turned off, and activated depending on architecture support. >>>

RE: RFC on writel and writel_relaxed

2018-03-28 Thread David Laight
From: Benjamin Herrenschmidt > Sent: 28 March 2018 10:56 ... > For example, let's say I have a device with a reset bit and the spec > says the reset bit needs to be set for at least 10us. > > This is wrong: > > writel(1, RESET_REG); > usleep(10); > writel(0, RESET_REG); > > Bec

Re: RFC on writel and writel_relaxed

2018-03-28 Thread okaya
On 2018-03-28 02:14, Linus Torvalds wrote: On Tue, Mar 27, 2018 at 5:24 PM, Sinan Kaya wrote: Basically changing it to dma_buffer->foo = 1;/* WB */ wmb() writel_relaxed(KICK, DMA_KICK_REGISTER);/* UC */ mmiowb() Why? Why not just remove the wmb(), and keep the

Re: [PATCH 14/19] powerpc/altivec: Add missing prototypes for altivec

2018-03-28 Thread Mathieu Malaterre
On Wed, Mar 28, 2018 at 9:26 AM, Mathieu Malaterre wrote: > On Tue, Mar 27, 2018 at 7:33 PM, LEROY Christophe > wrote: >> LEROY Christophe a écrit : >> >> >>> Mathieu Malaterre a écrit : >>> Christophe, On Sat, Mar 24, 2018 at 9:10 PM, LEROY Christophe wrote: > > Ma

Re: [PATCH 01/16] initrd: Add generic code path for common initrd unloading logic.

2018-03-28 Thread Christoph Hellwig
> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD > +void free_initrd_mem(unsigned long start, unsigned long end) > +{ > + free_reserved_area((void *)start, (void *)end, -1, "initrd"); > +} > +#endif Given how trivial this is and how many architectures can use it I'd reverse the polarity and add a C

Re: [PATCH 01/16] initrd: Add generic code path for common initrd unloading logic.

2018-03-28 Thread Geert Uytterhoeven
On Wed, Mar 28, 2018 at 2:04 PM, Christoph Hellwig wrote: >> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD >> +void free_initrd_mem(unsigned long start, unsigned long end) >> +{ >> + free_reserved_area((void *)start, (void *)end, -1, "initrd"); >> +} >> +#endif > > Given how trivial this is and ho

Re: [PATCH] powerpc: Fix smp_wmb barrier definition use use lwsync consistently

2018-03-28 Thread Michael Ellerman
Nicholas Piggin writes: > asm/barrier.h is not always included after asm/synch.h, which meant > it was missing __SUBARCH_HAS_LWSYNC, so in some files smp_wmb() would > be eieio when it should be lwsync. kernel/time/hrtimer.c is one case. Wow nice catch. Only broken since 2008 presumably. Some d

[GIT PULL] Please pull powerpc/linux.git powerpc-4.16-6 tag

2018-03-28 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull some more powerpc fixes for 4.16. Apologies if this is a bit big at rc7, but they're all reasonably important fixes. None are actually for new code, so they aren't indicative of 4.16 being in bad shape from our point of view.

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Yury Norov
On Mon, Mar 26, 2018 at 02:57:35PM -0400, Steven Rostedt wrote: > On Mon, 26 Mar 2018 10:53:13 +0200 > Andrea Parri wrote: > > > > --- a/kernel/smp.c > > > +++ b/kernel/smp.c > > > @@ -724,6 +724,30 @@ void kick_all_cpus_sync(void) > > > } > > > EXPORT_SYMBOL_GPL(kick_all_cpus_sync); > > > >

Re: [mm] b1f0502d04: INFO:trying_to_register_non-static_key

2018-03-28 Thread Laurent Dufour
On 26/03/2018 00:10, David Rientjes wrote: > On Wed, 21 Mar 2018, Laurent Dufour wrote: > >> I found the root cause of this lockdep warning. >> >> In mmap_region(), unmap_region() may be called while vma_link() has not been >> called. This happens during the error path if call_mmap() failed. >> >>

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Yury Norov
On Mon, Mar 26, 2018 at 05:45:55AM -0700, Paul E. McKenney wrote: > On Sun, Mar 25, 2018 at 11:11:54PM +0300, Yury Norov wrote: > > On Sun, Mar 25, 2018 at 12:23:28PM -0700, Paul E. McKenney wrote: > > > On Sun, Mar 25, 2018 at 08:50:04PM +0300, Yury Norov wrote: > > > > kick_all_cpus_sync() forces

Re: [PATCH] powerpc: Fix smp_wmb barrier definition use use lwsync consistently

2018-03-28 Thread Nicholas Piggin
On Wed, 28 Mar 2018 23:40:05 +1100 Michael Ellerman wrote: > Nicholas Piggin writes: > > > asm/barrier.h is not always included after asm/synch.h, which meant > > it was missing __SUBARCH_HAS_LWSYNC, so in some files smp_wmb() would > > be eieio when it should be lwsync. kernel/time/hrtimer.c i

Re: powerpc/64: Call H_REGISTER_PROC_TBL when running as a HPT guest on POWER9

2018-03-28 Thread Michael Ellerman
On Thu, 2017-02-16 at 05:03:39 UTC, Paul Mackerras wrote: > On POWER9, since commit cc3d2940133d ("powerpc/64: Enable use of radix > MMU under hypervisor on POWER9", 2017-01-30), we set both the radix and > HPT bits in the client-architecture-support (CAS) vector, which tells > the hypervisor that

Re: [kernel] powerpc/init: Do not advertise radix during client-architecture-support

2018-03-28 Thread Michael Ellerman
On Tue, 2018-01-09 at 05:45:20 UTC, Alexey Kardashevskiy wrote: > Currently the pseries kernel advertises radix MMU support even if > the actual support is disabled via the CONFIG_PPC_RADIX_MMU option. > > This adds a check for CONFIG_PPC_RADIX_MMU to avoid advertising radix > to the hypervisor. >

Re: [kernel] powerpc/lpar/debug: Initialize flags before printing debug message

2018-03-28 Thread Michael Ellerman
On Tue, 2018-01-09 at 05:52:14 UTC, Alexey Kardashevskiy wrote: > With enabled DEBUG, there is a compile error: > "error: ‘flags’ is used uninitialized in this function". > > This moves pr_devel() little further where @flags are initialized. > > Signed-off-by: Alexey Kardashevskiy Applied t

Re: [kernel] powerpc/mm: Fix typo in comments

2018-03-28 Thread Michael Ellerman
On Thu, 2018-02-01 at 05:07:25 UTC, Alexey Kardashevskiy wrote: > Fixes: 912cc87a6 "powerpc/mm/radix: Add LPID based tlb flush helpers" > Signed-off-by: Alexey Kardashevskiy Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/b574df94883df4d37f1b9d648867d6 cheers

Re: [kernel] powerpc/npu: Do not try invalidating 32bit table when 64bit table is enabled

2018-03-28 Thread Michael Ellerman
On Tue, 2018-02-13 at 05:51:35 UTC, Alexey Kardashevskiy wrote: > GPUs and the corresponding NVLink bridges get different PEs as they have > separate translation validation entries (TVEs). We put these PEs to > the same IOMMU group so they cannot be passed through separately. > So the iommu_table_g

Re: [1/3] powerpc/perf: Infrastructure to support addition of blacklisted events

2018-03-28 Thread Michael Ellerman
On Sun, 2018-03-04 at 11:56:26 UTC, Madhavan Srinivasan wrote: > Introduce code to support addition of blacklisted events for a > processor version. A 'pointer' and 'int' variable to hold the > number of events are added to 'struct power_pmu', along with a > generic function to loop through the lis

Re: powerpc/mm: Fix section mismatch warning in stop_machine_change_mapping()

2018-03-28 Thread Michael Ellerman
On Fri, 2018-03-09 at 20:45:58 UTC, Mauricio Faria de Oliveira wrote: > Fix the warning messages for stop_machine_change_mapping(), and a number > of other affected functions in its call chain. > > All modified functions are under CONFIG_MEMORY_HOTPLUG, so __meminit > is okay (keeps them / does no

Re: [v3, 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code

2018-03-28 Thread Michael Ellerman
On Wed, 2018-03-14 at 22:40:38 UTC, Mauricio Faria de Oliveira wrote: > From: Michael Ellerman > > rfi_flush_enable() includes a check to see if we're already > enabled (or disabled), and in that case does nothing. > > But that means calling setup_rfi_flush() a 2nd time doesn't actually > work,

Re: [v2,1/9] powerpc/eeh: Remove eeh_handle_event()

2018-03-28 Thread Michael Ellerman
On Mon, 2018-03-19 at 02:46:20 UTC, Sam Bobroff wrote: > The function eeh_handle_event(pe) does nothing other than switching > between calling eeh_handle_normal_event(pe) and > eeh_handle_special_event(). However it is only called in two places, > one where pe can't be NULL and the other where it m

Re: [v2] powerpc/perf: Fix kernel address leaks via Sampling registers

2018-03-28 Thread Michael Ellerman
On Wed, 2018-03-21 at 11:40:24 UTC, Madhavan Srinivasan wrote: > From: Michael Ellerman > > Current code in power_pmu_disable() does not clear the sampling > registers like Sampling Instruction Address Register (SAIR) and > Sampling Data Address Register (SDAR) after disabling the PMU. > Since th

Re: [v2] powerpc/perf: Fix kernel address leak to userspace via BHRB buffer

2018-03-28 Thread Michael Ellerman
On Wed, 2018-03-21 at 11:40:25 UTC, Madhavan Srinivasan wrote: > The current Branch History Rolling Buffer (BHRB) code does > not check for any privilege levels before updating the data > from BHRB. This leaks kernel addresses to userspace even when > profiling only with userspace privileges. Add p

Re: [v2] powerpc/perf: Fix the kernel address leak to userspace via SDAR

2018-03-28 Thread Michael Ellerman
On Wed, 2018-03-21 at 11:40:26 UTC, Madhavan Srinivasan wrote: > Sampled Data Address Register (SDAR) is a 64-bit > register that contains the effective address of > the storage operand of an instruction that was > being executed, possibly out-of-order, at or around > the time that the Performance

Re: [v3,1/8] powerpc: Add ppc_breakpoint_available()

2018-03-28 Thread Michael Ellerman
On Tue, 2018-03-27 at 04:37:17 UTC, Michael Neuling wrote: > Add ppc_breakpoint_available() to determine if a breakpoint is > available currently via the DAWR or DABR. > > Signed-off-by: Michael Neuling Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/404b27d66ed657ebccb

Re: [v2, 01/10] powerpc: Add security feature flags for Spectre/Meltdown

2018-03-28 Thread Michael Ellerman
On Tue, 2018-03-27 at 12:01:44 UTC, Michael Ellerman wrote: > This commit adds security feature flags to reflect the settings we > receive from firmware regarding Spectre/Meltdown mitigations. > > The feature names reflect the names we are given by firmware on bare > metal machines. See the hostbo

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Yury Norov
On Wed, Mar 28, 2018 at 06:56:17AM -0700, Paul E. McKenney wrote: > On Wed, Mar 28, 2018 at 04:36:05PM +0300, Yury Norov wrote: > > On Mon, Mar 26, 2018 at 05:45:55AM -0700, Paul E. McKenney wrote: > > > On Sun, Mar 25, 2018 at 11:11:54PM +0300, Yury Norov wrote: > > > > On Sun, Mar 25, 2018 at 12:

Re: [PATCH v3 39/41] cxlflash: Synchronize reset and remove ops

2018-03-28 Thread Matthew R. Ochs
On Mon, Mar 26, 2018 at 11:35:27AM -0500, Uma Krishnan wrote: > The following Oops can be encountered if a device removal or system > shutdown is initiated while an EEH recovery is in process: > > [c00ff2f479c0] c00815256f18 cxlflash_pci_slot_reset+0xa0/0x100 >

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Paul E. McKenney
On Wed, Mar 28, 2018 at 05:41:40PM +0300, Yury Norov wrote: > On Wed, Mar 28, 2018 at 06:56:17AM -0700, Paul E. McKenney wrote: > > On Wed, Mar 28, 2018 at 04:36:05PM +0300, Yury Norov wrote: > > > On Mon, Mar 26, 2018 at 05:45:55AM -0700, Paul E. McKenney wrote: > > > > On Sun, Mar 25, 2018 at 11:

Re: [PATCH v3 40/41] cxlflash: Remove commmands from pending list on timeout

2018-03-28 Thread Matthew R. Ochs
On Mon, Mar 26, 2018 at 11:35:34AM -0500, Uma Krishnan wrote: > The following Oops can occur if an internal command sent to the AFU does > not complete within the timeout: > > [c00ff101b810] c00816020d94 term_mc+0xfc/0x1b0 [cxlflash] > [c00ff101b8a0] c00816020fb0 term_afu+0x168/0x2

Re: [PATCH v3 41/41] cxlflash: Handle spurious interrupts

2018-03-28 Thread Matthew R. Ochs
On Mon, Mar 26, 2018 at 11:35:42AM -0500, Uma Krishnan wrote: > The following Oops can occur when there is heavy I/O traffic and the host > is reset by a tool such as sg_reset. > > [c000200fff3fbc90] c0081690117c process_cmd_doneq+0x104/0x500 >[cxlflash]

[RFC PATCH 0/3] powerpc tlbie reductions again

2018-03-28 Thread Nicholas Piggin
Last time this came up, there was concern about whether we can trim the mm cpumask, and what concurrency there is vs use_mm(). I've had more of a look and still think this is okay. I haven't thought of a good way to add debug checks to ensure it though. When doing a parallel kernel build on a 2 so

[RFC PATCH 1/3] powerpc/64s: do not flush TLB when relaxing access

2018-03-28 Thread Nicholas Piggin
Book3S does not require TLB flushing when protection is being relaxed. >From Power ISA v3.0B, p.1090: Setting a Reference or Change Bit or Upgrading Access Authority (PTE Subject to Atomic Hardware Updates) If the only change being made to a valid PTE that is subject to atomic har

[RFC PATCH 2/3] powerpc/64s/radix: reset mm_cpumask for single thread process when possible

2018-03-28 Thread Nicholas Piggin
When a single-threaded process has a non-local mm_cpumask and requires a full PID tlbie invalidation, use that as an opportunity to reset the cpumask back to the current CPU we're running on. No other thread can concurrently switch to this mm, because it must have had a reference on mm_users befor

[RFC PATCH 3/3] powerpc/64s: always flush non-local CPUs from single threaded mms

2018-03-28 Thread Nicholas Piggin
Go one step further, if we're going to put a tlbie on the bus at all, make it count. Always flush all others and restore our mm to a local one. --- arch/powerpc/mm/tlb-radix.c | 45 +++-- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/arch/p

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 11:30 +, David Laight wrote: > From: Benjamin Herrenschmidt > > Sent: 28 March 2018 10:56 > > ... > > For example, let's say I have a device with a reset bit and the spec > > says the reset bit needs to be set for at least 10us. > > > > This is wrong: > > > > writel

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Benjamin Herrenschmidt
On Wed, 2018-03-28 at 07:41 -0400, ok...@codeaurora.org wrote: > Yes, we want to get there indeed. It is because of some arch not > implementing writel properly. Maintainers want to play safe. > > That is why I asked if IA64 and other well known archs follow the > strongly ordered rule at this m

Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync()

2018-03-28 Thread Paul E. McKenney
On Wed, Mar 28, 2018 at 04:36:05PM +0300, Yury Norov wrote: > On Mon, Mar 26, 2018 at 05:45:55AM -0700, Paul E. McKenney wrote: > > On Sun, Mar 25, 2018 at 11:11:54PM +0300, Yury Norov wrote: > > > On Sun, Mar 25, 2018 at 12:23:28PM -0700, Paul E. McKenney wrote: > > > > On Sun, Mar 25, 2018 at 08:

Re: RFC on writel and writel_relaxed

2018-03-28 Thread David Miller
From: Benjamin Herrenschmidt Date: Thu, 29 Mar 2018 02:13:16 +1100 > Let's fix all archs, it's way easier than fixing all drivers. Half of > the archs are unused or dead anyway. Agreed.

RE: RFC on writel and writel_relaxed

2018-03-28 Thread David Laight
From: Benjamin Herrenschmidt > Sent: 28 March 2018 16:13 ... > > I've always wondered exactly what the twi;isync were for - always seemed > > very heavy handed for most mmio reads. > > Particularly if you are doing mmio reads from a data fifo. > > If you do that you should use the "s" version of t

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Nicholas Piggin
On Wed, 28 Mar 2018 11:55:09 -0400 (EDT) David Miller wrote: > From: Benjamin Herrenschmidt > Date: Thu, 29 Mar 2018 02:13:16 +1100 > > > Let's fix all archs, it's way easier than fixing all drivers. Half of > > the archs are unused or dead anyway. > > Agreed. While we're making decrees her

Re: [PATCH v9 08/24] mm: Protect VMA modifications using VMA sequence count

2018-03-28 Thread Laurent Dufour
On 27/03/2018 23:45, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c >> index 65ae54659833..a2d9c87b7b0b 100644 >> --- a/fs/proc/task_mmu.c >> +++ b/fs/proc/task_mmu.c >> @@ -1136,8 +1136,11 @@ static ssize_t clear_refs_w

Re: RFC on writel and writel_relaxed

2018-03-28 Thread Jason Gunthorpe
On Wed, Mar 28, 2018 at 11:13:45AM +0100, Will Deacon wrote: > On Wed, Mar 28, 2018 at 09:01:27PM +1100, Benjamin Herrenschmidt wrote: > > On Wed, 2018-03-28 at 11:55 +0200, Arnd Bergmann wrote: > > > > powerpc and ARM can't quite make them synchronous I think, but at least > > > > they should have

Re: [PATCH 6/6] doc/devicetree: NVDIMM region documentation

2018-03-28 Thread Rob Herring
On Tue, Mar 27, 2018 at 9:53 AM, Oliver wrote: > On Tue, Mar 27, 2018 at 9:24 AM, Rob Herring wrote: >> On Fri, Mar 23, 2018 at 07:12:09PM +1100, Oliver O'Halloran wrote: >>> Add device-tree binding documentation for the nvdimm region driver. >>> >>> Cc: devicet...@vger.kernel.org >>> Signed-off-

Re: [RFC PATCH] powerpc/xmon: Use OPAL_DEBUG to debug srest in OPAL

2018-03-28 Thread Vasant Hegde
On 03/27/2018 12:58 PM, Nicholas Piggin wrote: On Tue, 27 Mar 2018 12:42:32 +0530 Vasant Hegde wrote: On 03/26/2018 08:39 PM, Nicholas Piggin wrote: xmon can be entered via sreset NMI (from a management sreset, or an NMI IPI), which can interrupt OPAL. Add checks to xmon to see if pc or sp ar

Re: [PATCH v9 08/24] mm: Protect VMA modifications using VMA sequence count

2018-03-28 Thread Laurent Dufour
On 27/03/2018 23:57, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> diff --git a/mm/mmap.c b/mm/mmap.c >> index 5898255d0aeb..d6533cb85213 100644 >> --- a/mm/mmap.c >> +++ b/mm/mmap.c >> @@ -847,17 +847,18 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned >> long

Re: [PATCH] powerpc/powernv/nvram: opal_nvram_write handle unknown OPAL errors

2018-03-28 Thread Vasant Hegde
On 03/27/2018 01:08 PM, Nicholas Piggin wrote: On Tue, 27 Mar 2018 12:47:31 +0530 Vasant Hegde wrote: On 03/26/2018 08:32 PM, Nicholas Piggin wrote: opal_nvram_write currently just assumes success if it encounters an error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO on other

Re: [PATCH 6/6] doc/devicetree: NVDIMM region documentation

2018-03-28 Thread Dan Williams
On Wed, Mar 28, 2018 at 10:06 AM, Rob Herring wrote: [..] > >> Are DIMMs always going to be the only form factor for NV memory? > >> > >> And if you have multiple DIMMs, does each DT node correspond to a DIMM? > > > > A nvdimm-region might correspond to a single NVDIMM, a set of > > interleaved NV

Re: [PATCH v9 07/24] mm: VMA sequence count

2018-03-28 Thread Laurent Dufour
On 27/03/2018 23:30, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> diff --git a/mm/mmap.c b/mm/mmap.c >> index faf85699f1a1..5898255d0aeb 100644 >> --- a/mm/mmap.c >> +++ b/mm/mmap.c >> @@ -558,6 +558,10 @@ void __vma_link_rb(struct mm_struct *mm, struct >> vm_area_str

Re: [PATCH v9 09/24] mm: protect mremap() against SPF hanlder

2018-03-28 Thread Laurent Dufour
On 28/03/2018 00:12, David Rientjes wrote: > On Tue, 13 Mar 2018, Laurent Dufour wrote: > >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index 88042d843668..ef6ef0627090 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -2189,16 +2189,24 @@ void anon_vma_interval_t

[PATCH v2] powerpc/altivec: Add missing prototypes for altivec

2018-03-28 Thread Mathieu Malaterre
Some functions prototypes were missing for the non-altivec code. Add the missing prototypes in a new header file, fix warnings treated as errors with W=1: arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes] arch/powerpc/lib/xor_v

[PATCH v3] powerpc/altivec: Add missing prototypes for altivec

2018-03-28 Thread Mathieu Malaterre
Some functions prototypes were missing for the non-altivec code. Add the missing prototypes in a new header file, fix warnings treated as errors with W=1: arch/powerpc/lib/xor_vmx_glue.c:18:6: error: no previous prototype for ‘xor_altivec_2’ [-Werror=missing-prototypes] arch/powerpc/lib/xor_v

Re: [PATCH 11/19] powerpc/powermac: Move pmac_pfunc_base_install prototype to header file

2018-03-28 Thread Mathieu Malaterre
On Fri, Mar 23, 2018 at 1:13 PM, christophe leroy wrote: > > > Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit : >> >> The pmac_pfunc_base_install prototype was declared in powermac/smp.c since >> function was used there, move it to pmac_pfunc.h header to be visible in >> pfunc_base.c. Fix a warn

Re: [PATCH 15/19] powerpc: Add missing prototype

2018-03-28 Thread Mathieu Malaterre
On Fri, Mar 23, 2018 at 1:20 PM, christophe leroy wrote: > > > Le 22/03/2018 à 21:20, Mathieu Malaterre a écrit : >> >> Add one missing prototype for function rh_dump_blk. Fix warning treated as >> error in W=1: >> >>arch/powerpc/lib/rheap.c:740:6: error: no previous prototype for >> ‘rh_dump_

[PATCH v2 01/19] powerpc/powermac: Mark variable x as unused

2018-03-28 Thread Mathieu Malaterre
Since the value of x is never intended to be read, declare it with gcc attribute as unused. Fix warning treated as error with W=1: arch/powerpc/platforms/powermac/bootx_init.c:471:21: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable] Signed-off-by: Mathieu Malaterre --- v

[PATCH v2 02/19] powerpc/powermac: Mark variable x as unused

2018-03-28 Thread Mathieu Malaterre
Since the value of x is never intended to be read, remove it. Fix warning treated as error with W=1: arch/powerpc/platforms/powermac/udbg_scc.c:76:9: error: variable ‘x’ set but not used [-Werror=unused-but-set-variable] Suggested-by: Christophe Leroy Signed-off-by: Mathieu Malaterre --- v2:

[PATCH v2 03/19] powerpc: Mark variables as unused

2018-03-28 Thread Mathieu Malaterre
Add gcc attribute unused for two variables. Fix warnings treated as errors with W=1: arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable] Suggested-by: Christophe Leroy Signed-off-by: Mathieu Malaterre --- v2: move path within ifde

[PATCH v2 05/19] powerpc/chrp/setup: Add attribute unused and make some functions static

2018-03-28 Thread Mathieu Malaterre
Remove variable declaration idu_size and associated code since not used. These functions can all be static, make it so. Fix warnings treated as errors with W=1: arch/powerpc/platforms/chrp/setup.c:97:6: error: no previous prototype for ‘chrp_show_cpuinfo’ [-Werror=missing-prototypes] arch/po

[PATCH v2 07/19] powerpc/powermac: Make some functions static

2018-03-28 Thread Mathieu Malaterre
These functions can all be static, make it so. Fix warnings treated as errors with W=1: arch/powerpc/platforms/powermac/pci.c:1022:6: error: no previous prototype for ‘pmac_pci_fixup_ohci’ [-Werror=missing-prototypes] arch/powerpc/platforms/powermac/pci.c:1057:6: error: no previous prototype

[PATCH v2 04/19] powerpc/kvm: Prefer fault_in_pages_readable function

2018-03-28 Thread Mathieu Malaterre
Directly use fault_in_pages_readable instead of manual __get_user code. Fix warning treated as error with W=1: arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] Suggested-by: Christophe Leroy Signed-off-by: Mathieu Malaterre --- v2: use

[PATCH v4 14/16] powerpc: Use generic free_initrd_mem.

2018-03-28 Thread Shea Levy
Signed-off-by: Shea Levy --- arch/powerpc/mm/mem.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index fe8c61149fb8..e85b2a3cd264 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -404,13 +404,6 @@ void free_initmem(void)

Re: [PATCH] powerpc/64: Fix checksum folding in csum_add

2018-03-28 Thread Paul Mackerras
On Tue, Mar 27, 2018 at 05:22:32PM +0200, LEROY Christophe wrote: > Shile Zhang a écrit : > > >fix the missed point in Paul's patch: > >"powerpc/64: Fix checksum folding in csum_tcpudp_nofold and > >ip_fast_csum_nofold" > > > >Signed-off-by: Shile Zhang > >--- > > arch/powerpc/include/asm/checks

Re: [PATCH v4 14/16] powerpc: Use generic free_initrd_mem.

2018-03-28 Thread Joe Perches
On Wed, 2018-03-28 at 16:36 -0400, Shea Levy wrote: > Signed-off-by: Shea Levy Most people seem to want some form of commit message and not just your sign-off. And btw: It seems you used get_maintainer to determine who to send these patches to. I suggest you add --nogit and --nogit-fallback to

Re: [PATCH v12 07/22] selftests/vm: fixed bugs in pkey_disable_clear()

2018-03-28 Thread Thiago Jung Bauermann
Dave Hansen writes: > On 02/21/2018 05:55 PM, Ram Pai wrote: >> --- a/tools/testing/selftests/vm/protection_keys.c >> +++ b/tools/testing/selftests/vm/protection_keys.c >> @@ -461,7 +461,7 @@ void pkey_disable_clear(int pkey, int flags) >> pkey, pkey, pkey_rights); >> p

Re: [PATCH v4 14/16] powerpc: Use generic free_initrd_mem.

2018-03-28 Thread Shea Levy
Joe Perches writes: > On Wed, 2018-03-28 at 16:36 -0400, Shea Levy wrote: >> Signed-off-by: Shea Levy > > Most people seem to want some form of commit message > and not just your sign-off. > Ah, if the subject is insufficient I can add some more detail. > > And btw: > > It seems you used get_m

Re: [PATCH v12 07/22] selftests/vm: fixed bugs in pkey_disable_clear()

2018-03-28 Thread Dave Hansen
On 03/28/2018 01:47 PM, Thiago Jung Bauermann wrote: >>> if (flags) >>> - assert(rdpkey_reg() > orig_pkey_reg); >>> + assert(rdpkey_reg() < orig_pkey_reg); >>> } >>> >>> void pkey_write_allow(int pkey) >> This seems so horribly wrong that I wonder how it worked in the firs

Re: [PATCH v9 01/24] mm: Introduce CONFIG_SPECULATIVE_PAGE_FAULT

2018-03-28 Thread David Rientjes
On Wed, 28 Mar 2018, Laurent Dufour wrote: > > Putting this in mm/Kconfig is definitely the right way to go about it > > instead of any generic option in arch/*. > > > > My question, though, was making this configurable by the user: > > > > config SPECULATIVE_PAGE_FAULT > > bool "Speculativ

Re: [PATCH v9 09/24] mm: protect mremap() against SPF hanlder

2018-03-28 Thread David Rientjes
On Wed, 28 Mar 2018, Laurent Dufour wrote: > >> @@ -326,7 +336,10 @@ static unsigned long move_vma(struct vm_area_struct > >> *vma, > >>mremap_userfaultfd_prep(new_vma, uf); > >>arch_remap(mm, old_addr, old_addr + old_len, > >> new_addr, new_addr + ne

  1   2   >