Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-24 Thread peterz
On Wed, Sep 23, 2020 at 11:52:51AM -0400, Steven Rostedt wrote: > On Wed, 23 Sep 2020 10:40:32 +0200 > pet...@infradead.org wrote: > > > However, with migrate_disable() we can have each task preempted in a > > migrate_disable() region, worse we can stack them all on the _same_ CPU > > (super

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-23 Thread peterz
On Mon, Sep 21, 2020 at 09:27:57PM +0200, Thomas Gleixner wrote: > Alternatively this could of course be solved with per CPU page tables > which will come around some day anyway I fear. Previously (with PTI) we looked at making the entire kernel map per-CPU, and that takes a 2K copy on

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-23 Thread peterz
On Mon, Sep 21, 2020 at 09:27:57PM +0200, Thomas Gleixner wrote: > On Mon, Sep 21 2020 at 09:24, Linus Torvalds wrote: > > On Mon, Sep 21, 2020 at 12:39 AM Thomas Gleixner wrote: > >> > >> If a task is migrated to a different CPU then the mapping address will > >> change which will explode in

Re: [PATCH] Revert "powerpc/64s: machine check interrupt update NMI accounting"

2020-09-15 Thread peterz
On Tue, Sep 15, 2020 at 08:06:59PM +0200, Michal Suchanek wrote: > This reverts commit 116ac378bb3ff844df333e7609e7604651a0db9d. > > This commit causes the kernel to oops and reboot when injecting a SLB > multihit which causes a MCE. > > Before this commit a SLB multihit was corrected by the

Re: [PATCH v2 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-09-14 Thread peterz
On Mon, Sep 14, 2020 at 02:52:16PM +1000, Nicholas Piggin wrote: > Reading and modifying current->mm and current->active_mm and switching > mm should be done with irqs off, to prevent races seeing an intermediate > state. > > This is similar to commit 38cf307c1f20 ("mm: fix kthread_use_mm() vs

Re: [RFC PATCH v2 1/3] mm/gup: fix gup_fast with dynamic page table folding

2020-09-11 Thread peterz
On Thu, Sep 10, 2020 at 06:59:21PM -0300, Jason Gunthorpe wrote: > So, I suggest pXX_offset_unlocked() Urgh, no. Elsewhere in gup _unlocked() means it will take the lock itself (get_user_pages_unlocked()) -- although often it seems to mean the lock is already held (git grep _unlocked and marvel).

Re: [PATCH -next] fork: silence a false postive warning in __mmdrop

2020-09-08 Thread peterz
On Tue, Sep 08, 2020 at 12:50:44PM -0400, Qian Cai wrote: > > No, you're talking nonsense. We must not free @mm when > > 'current->active_mm == mm', never. > > Yes, you are right. It still trigger this below on powerpc with today's > linux-next by fuzzing for a while (saw a few times on recent

Re: [PATCH 1/4] mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race

2020-08-28 Thread peterz
On Fri, Aug 28, 2020 at 08:00:19PM +1000, Nicholas Piggin wrote: > Closing this race only requires interrupts to be disabled while ->mm > and ->active_mm are being switched, but the TLB problem requires also > holding interrupts off over activate_mm. Unfortunately not all archs > can do that yet,

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-19 Thread peterz
On Wed, Aug 19, 2020 at 05:32:50PM +0200, pet...@infradead.org wrote: > On Wed, Aug 19, 2020 at 08:39:13PM +1000, Alexey Kardashevskiy wrote: > > > > or current upstream? > > > > The upstream 18445bf405cb (13 hours old) also shows the problem. Yours > > 1/2 still fixes it. > > Afaict that just

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-19 Thread peterz
On Wed, Aug 19, 2020 at 08:39:13PM +1000, Alexey Kardashevskiy wrote: > > or current upstream? > > The upstream 18445bf405cb (13 hours old) also shows the problem. Yours > 1/2 still fixes it. Afaict that just reduces the window. Isn't the problem that: arch/powerpc/kernel/exceptions-64e.S

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-18 Thread peterz
On Tue, Aug 18, 2020 at 05:22:33PM +1000, Nicholas Piggin wrote: > Excerpts from pet...@infradead.org's message of August 12, 2020 8:35 pm: > > On Wed, Aug 12, 2020 at 06:18:28PM +1000, Nicholas Piggin wrote: > >> Excerpts from pet...@infradead.org's message of August 7, 2020 9:11 pm: > >> > > >>

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-12 Thread peterz
On Wed, Aug 12, 2020 at 06:18:28PM +1000, Nicholas Piggin wrote: > Excerpts from pet...@infradead.org's message of August 7, 2020 9:11 pm: > > > > What's wrong with something like this? > > > > AFAICT there's no reason to actually try and add IRQ tracing here, it's > > just a hand full of

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-08-07 Thread peterz
What's wrong with something like this? AFAICT there's no reason to actually try and add IRQ tracing here, it's just a hand full of instructions at the most. --- diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 3a0db7b0b46e..6be22c1838e2 100644 ---

Re: [PATCH 1/2] sched/topology: Allow archs to override cpu_smt_mask

2020-08-06 Thread peterz
On Thu, Aug 06, 2020 at 10:25:12PM +1000, Michael Ellerman wrote: > pet...@infradead.org writes: > > On Thu, Aug 06, 2020 at 03:32:25PM +1000, Michael Ellerman wrote: > > > >> That brings with it a bunch of problems, such as existing software that > >> has been developed/configured for Power8 and

Re: [PATCH 1/2] sched/topology: Allow archs to override cpu_smt_mask

2020-08-06 Thread peterz
On Thu, Aug 06, 2020 at 03:32:25PM +1000, Michael Ellerman wrote: > That brings with it a bunch of problems, such as existing software that > has been developed/configured for Power8 and expects to see SMT8. > > We also allow LPARs to be live migrated from Power8 to Power9 (and back), so >

Re: [PATCH 1/2] sched/topology: Allow archs to override cpu_smt_mask

2020-08-04 Thread peterz
On Tue, Aug 04, 2020 at 05:40:07PM +0530, Srikar Dronamraju wrote: > * pet...@infradead.org [2020-08-04 12:45:20]: > > > On Tue, Aug 04, 2020 at 09:03:06AM +0530, Srikar Dronamraju wrote: > > > cpu_smt_mask tracks topology_sibling_cpumask. This would be good for > > > most architectures. One of

Re: [PATCH 2/2] powerpc/topology: Override cpu_smt_mask

2020-08-04 Thread peterz
On Tue, Aug 04, 2020 at 09:03:07AM +0530, Srikar Dronamraju wrote: > On Power9 a pair of cores can be presented by the firmware as a big-core > for backward compatibility reasons, with 4 threads per (small) core and 8 > threads per big-core. cpu_smt_mask() should generally point to the cpu mask >

Re: [PATCH 1/2] sched/topology: Allow archs to override cpu_smt_mask

2020-08-04 Thread peterz
On Tue, Aug 04, 2020 at 09:03:06AM +0530, Srikar Dronamraju wrote: > cpu_smt_mask tracks topology_sibling_cpumask. This would be good for > most architectures. One of the users of cpu_smt_mask(), would be to > identify idle-cores. On Power9, a pair of cores can be presented by the > firmware as a

[PATCH] lockdep: Fix TRACE_IRQFLAGS vs NMIs

2020-07-27 Thread peterz
Prior to commit 859d069ee1dd ("lockdep: Prepare for NMI IRQ state tracking") IRQ state tracking was disabled in NMIs due to nmi_enter() doing lockdep_off() -- with the obvious requirement that NMI entry call nmi_enter() before trace_hardirqs_off(). [ afaict, PowerPC and SH violate this order on

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-07-26 Thread peterz
On Sun, Jul 26, 2020 at 02:14:34PM +1000, Nicholas Piggin wrote: > Excerpts from Peter Zijlstra's message of July 26, 2020 6:26 am: > > Which is 'funny' when it interleaves like: > > > > local_irq_disable(); > > ... > > local_irq_enable() > > trace_hardirqs_on(); > > > >

Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-07-26 Thread peterz
On Sun, Jul 26, 2020 at 02:14:34PM +1000, Nicholas Piggin wrote: > > Now, x86, and at least arm64 call nmi_enter() before > > trace_hardirqs_off(), but AFAICT Power never did that, and that's part > > of the problem. nmi_enter() does lockdep_off() and that _used_ to also > > kill IRQ tracking. >

Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR

2020-07-23 Thread peterz
On Thu, Jul 23, 2020 at 03:04:13PM -0400, Waiman Long wrote: > On 7/23/20 2:47 PM, pet...@infradead.org wrote: > > On Thu, Jul 23, 2020 at 02:32:36PM -0400, Waiman Long wrote: > > > BTW, do you have any comment on my v2 lock holder cpu info qspinlock > > > patch? > > > I will have to update the

Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR

2020-07-23 Thread peterz
On Thu, Jul 23, 2020 at 02:32:36PM -0400, Waiman Long wrote: > BTW, do you have any comment on my v2 lock holder cpu info qspinlock patch? > I will have to update the patch to fix the reported 0-day test problem, but > I want to collect other feedback before sending out v3. I want to say I hate

Re: [PATCH v2 06/10] powerpc/smp: Generalize 2nd sched domain

2020-07-22 Thread peterz
On Wed, Jul 22, 2020 at 10:48:54AM +0200, Peter Zijlstra wrote: > But reading your explanation, it looks like the Linux topology setup > could actually unravel the fused-faux-SMT8 into two independent SMT4 > parts, negating that firmware option. Ah, it looks like that's exactly what you're doing.

Re: [PATCH v2 06/10] powerpc/smp: Generalize 2nd sched domain

2020-07-22 Thread peterz
On Tue, Jul 21, 2020 at 05:08:10PM +0530, Srikar Dronamraju wrote: > Currently "CACHE" domain happens to be the 2nd sched domain as per > powerpc_topology. This domain will collapse if cpumask of l2-cache is > same as SMT domain. However we could generalize this domain such that it > could mean

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-21 Thread peterz
On Tue, Jul 21, 2020 at 08:04:27PM +1000, Nicholas Piggin wrote: > That being said, the x86 sync core gap that I imagined could be fixed > by changing to rq->curr == rq->idle test does not actually exist because > the global membarrier does not have a sync core option. So fixing the >

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-16 Thread peterz
On Thu, Jul 16, 2020 at 08:03:36PM +1000, Nicholas Piggin wrote: > Excerpts from Peter Zijlstra's message of July 16, 2020 6:50 pm: > > On Wed, Jul 15, 2020 at 10:18:20PM -0700, Andy Lutomirski wrote: > >> > On Jul 15, 2020, at 9:15 PM, Nicholas Piggin wrote: > >> But I’m wondering if all this