From: Nathan Lynch <nathanl@linux.ibm.com>
To: Thiago Jung Bauermann <bauerman@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
Michael Bringmann <mwb@linux.vnet.ibm.com>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Thiago Jung Bauermann <bauerman@linux.ibm.com>
Subject: Re: [PATCH v4] powerpc/pseries: Remove limit in wait for dying CPU
Date: Tue, 30 Apr 2019 11:34:25 -0500 [thread overview]
Message-ID: <877ebbsb8u.fsf@linux.ibm.com> (raw)
In-Reply-To: <20190423223914.3882-1-bauerman@linux.ibm.com>
Thiago Jung Bauermann <bauerman@linux.ibm.com> writes:
> This can be a problem because if the busy loop finishes too early, then the
> kernel may offline another CPU before the previous one finished dying,
> which would lead to two concurrent calls to rtas-stop-self, which is
> prohibited by the PAPR.
>
> Since the hotplug machinery already assumes that cpu_die() is going to
> work, we can simply loop until the CPU stops.
>
> Also change the loop to wait 100 µs between each call to
> smp_query_cpu_stopped() to avoid querying RTAS too often.
[...]
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index 97feb6e79f1a..d75cee60644c 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -214,13 +214,17 @@ static void pseries_cpu_die(unsigned int cpu)
> msleep(1);
> }
> } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
> -
> - for (tries = 0; tries < 25; tries++) {
> + /*
> + * rtas_stop_self() panics if the CPU fails to stop and our
> + * callers already assume that we are going to succeed, so we
> + * can just loop until the CPU stops.
> + */
> + while (true) {
> cpu_status = smp_query_cpu_stopped(pcpu);
> if (cpu_status == QCSS_STOPPED ||
> cpu_status == QCSS_HARDWARE_ERROR)
> break;
> - cpu_relax();
> + udelay(100);
> }
> }
I agree with looping indefinitely but doesn't it need a cond_resched()
or similar check?
next prev parent reply other threads:[~2019-04-30 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 22:39 [PATCH v4] powerpc/pseries: Remove limit in wait for dying CPU Thiago Jung Bauermann
2019-04-30 16:34 ` Nathan Lynch [this message]
2019-04-30 19:59 ` Thiago Jung Bauermann
2019-05-01 14:57 ` Nathan Lynch
2019-05-01 23:12 ` Nicholas Piggin
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=877ebbsb8u.fsf@linux.ibm.com \
--to=nathanl@linux.ibm.com \
--cc=bauerman@linux.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mwb@linux.vnet.ibm.com \
--cc=npiggin@gmail.com \
--cc=svaidy@linux.vnet.ibm.com \
--cc=tyreld@linux.vnet.ibm.com \
/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).