From: Thomas Gleixner <tglx@linutronix.de>
To: John Allen <jallen@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Nathan Fontenot <nfont@linux.vnet.ibm.com>,
Michael Bringmann <mwb@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC] cpu/hotplug: Modify lock status before making cpu hotplug callbacks
Date: Mon, 12 Jun 2017 16:59:13 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1706121653140.1911@nanos> (raw)
In-Reply-To: <fbfb6488-8d65-85eb-e764-d18c9589a0cc@linux.vnet.ibm.com>
On Wed, 7 Jun 2017, John Allen wrote:
> A deadlock has been observed during a cpu hot add on powerpc machines.
>
> The situation is as follows:
> First, in _cpu_up, we take the cpu_hotplug lock and towards the end of _cpu_up,
> we make the cpu hotplug callbacks, one of which is arch_update_cpu_topology.
> For most other architectures, making this call while the parent thread has the
> cpu_hotplug lock seems harmless as most implementations of
> arch_update_cpu_topology appear to be quite simple. However, the powerpc
> implementation is significantly more complex and requires us to make a call to
> stop_machine which in turn attempts to take the cpu_hotplug lock in
> get_online_cpus. We then deadlock as the parent thread is waiting on the child
> to complete and the child is waiting on the parent to release the lock.
>
> This solution attempts to resolve the issue by incrementing the cpu_hotplug
> refcount and releasing the cpu_hotplug mutex in _cpu_up so that the subsequent
> call to get_online_cpus can take the mutex while other invocations of _cpu_up
> are still prevented from executing as the refcount is non-zero. From my testing,
> this seems to resolve the deadlock, but I'm not sure if there is a reason that
> get_online_cpus *should* be locked out at this point.
This is horrible, really.
We have code pending in -next which reworks the hotplug lock to a per cpu
reader writer semaphore, so this hack is not going to work anymore.
See git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp/hotplug
This addresses the issue of calling stomp_machine() from inside a hotplug
locked region, by introducing stop_machine_cpuslocked(). That should solve
your problem nicely.
Thanks,
tglx
prev parent reply other threads:[~2017-06-12 14:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 21:13 John Allen
2017-06-12 14:59 ` Thomas Gleixner [this message]
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=alpine.DEB.2.20.1706121653140.1911@nanos \
--to=tglx@linutronix.de \
--cc=jallen@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mwb@linux.vnet.ibm.com \
--cc=nfont@linux.vnet.ibm.com \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®