From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Will Deacon <will@kernel.org>
Cc: Stefan Wiehler <stefan.wiehler@nokia.com>,
Joel Fernandes <joel@joelfernandes.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Boqun Feng <boqun.feng@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang1211@gmail.com>,
linux-arm-kernel@lists.infradead.org, rcu@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm: smp: Avoid false positive CPU hotplug Lockdep-RCU splat
Date: Tue, 12 Mar 2024 22:39:30 +0000 [thread overview]
Message-ID: <ZfDZolTDQa76hhaS@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240312221440.GA29419@willie-the-truck>
On Tue, Mar 12, 2024 at 10:14:40PM +0000, Will Deacon wrote:
> Hi Russell,
>
> On Sat, Mar 09, 2024 at 09:57:04AM +0000, Russell King (Oracle) wrote:
> > On Sat, Mar 09, 2024 at 08:45:35AM +0100, Stefan Wiehler wrote:
> > > diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
> > > index 4204ffa2d104..4fc2c559f1b6 100644
> > > --- a/arch/arm/mm/context.c
> > > +++ b/arch/arm/mm/context.c
> > > @@ -254,7 +254,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
> > > && atomic64_xchg(&per_cpu(active_asids, cpu), asid))
> > > goto switch_mm_fastpath;
> > >
> > > - raw_spin_lock_irqsave(&cpu_asid_lock, flags);
> > > + local_irq_save(flags);
> > > + arch_spin_lock(&cpu_asid_lock.raw_lock);
> > > /* Check that our ASID belongs to the current generation. */
> > > asid = atomic64_read(&mm->context.id);
> > > if ((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS) {
> > > @@ -269,7 +270,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
> > >
> > > atomic64_set(&per_cpu(active_asids, cpu), asid);
> > > cpumask_set_cpu(cpu, mm_cpumask(mm));
> > > - raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
> > > + arch_spin_unlock(&cpu_asid_lock.raw_lock);
> > > + local_irq_restore(flags);
> > >
> > > switch_mm_fastpath:
> > > cpu_switch_mm(mm->pgd, mm);
> > >
> > > @Russell, what do you think?
> >
> > I think this is Will Deacon's code, so we ought to hear from Will...
>
> Thanks for adding me in.
>
> Using arch_spin_lock() really feels like a bodge to me. This code isn't
> run only on the hot-unplug path, but rather this is part of switch_mm()
> and we really should be able to have lockdep work properly there for
> the usual case.
>
> Now, do we actually need to worry about the ASID when switching to the
> init_mm? I'd have thought that would be confined to global (kernel)
> mappings, so I wonder whether we could avoid this slow path code
> altogether like we do on arm64 in __switch_mm(). But I must confess that
> I don't recall the details of the pre-LPAE MMU configuration...
As the init_mm shouldn't have any userspace mappings, isn't the ASID
entirely redundant? Couldn't check_and_switch_context() just simply
do the vmalloc seq check, set the reserved ASID, and then head to
switch_mm_fastpath to call the mm switch code?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-03-12 22:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 16:09 [PATCH] arm: smp: Avoid false positive CPU hotplug Lockdep-RCU splat Stefan Wiehler
2024-03-07 17:45 ` Paul E. McKenney
2024-03-07 17:49 ` Paul E. McKenney
2024-03-07 18:54 ` Russell King (Oracle)
2024-03-07 19:08 ` Paul E. McKenney
2024-03-07 18:49 ` Boqun Feng
2024-03-08 10:20 ` Stefan Wiehler
2024-03-08 14:57 ` Joel Fernandes
2024-03-09 7:45 ` Stefan Wiehler
2024-03-09 9:57 ` Russell King (Oracle)
2024-03-12 22:14 ` Will Deacon
2024-03-12 22:39 ` Russell King (Oracle) [this message]
2024-03-13 0:32 ` Will Deacon
2024-03-13 9:58 ` Russell King (Oracle)
2024-08-09 13:37 ` Stefan Wiehler
2024-08-09 13:48 ` Russell King (Oracle)
2024-08-09 14:06 ` Stefan Wiehler
2024-03-11 16:08 ` Russell King (Oracle)
2024-03-11 16:17 ` Stefan Wiehler
2024-03-11 19:01 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZfDZolTDQa76hhaS@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=boqun.feng@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=stefan.wiehler@nokia.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).