linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/1] hotplug-cpu.c: show 'last online CPU' error in dlpar_cpu_remove()
Date: Thu, 18 Mar 2021 06:59:39 -0300	[thread overview]
Message-ID: <c2fdbf4e-995b-fec8-7dc3-41beb7d66daa@gmail.com> (raw)
In-Reply-To: <20210305173845.451158-1-danielhb413@gmail.com>

Ping

On 3/5/21 2:38 PM, Daniel Henrique Barboza wrote:
> Of all the reasons that dlpar_cpu_remove() can fail, the 'last online
> CPU' is one that can be caused directly by the user offlining CPUs
> in a partition/virtual machine that has hotplugged CPUs. Trying to
> reclaim a hotplugged CPU can fail if the CPU is now the last online in
> the system. This is easily reproduced using QEMU [1].
> 
> Throwing a more specific error message for this case, instead of just
> "Failed to offline CPU", makes it clearer that the error is in fact a
> known error situation instead of other generic/unknown cause.
> 
> [1] https://bugzilla.redhat.com/1911414
> 
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index 12cbffd3c2e3..134f393f09e1 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -514,7 +514,17 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index)
>   
>   	rc = dlpar_offline_cpu(dn);
>   	if (rc) {
> -		pr_warn("Failed to offline CPU %pOFn, rc: %d\n", dn, rc);
> +		/* dlpar_offline_cpu will return -EBUSY from cpu_down() (via
> +		 * device_offline()) in 2 cases: cpu_hotplug_disable is true or
> +		 * there is only one CPU left. Warn the user about the second
> +		 * since this can happen with user offlining CPUs and then
> +		 * attempting hotunplugs.
> +		 */
> +		if (rc == -EBUSY && num_online_cpus() == 1)
> +			pr_warn("Unable to remove last online CPU %pOFn\n", dn);
> +		else
> +			pr_warn("Failed to offline CPU %pOFn, rc: %d\n", dn, rc);
> +
>   		return -EINVAL;
>   	}
>   
> 

  reply	other threads:[~2021-03-18 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 17:38 [PATCH 1/1] hotplug-cpu.c: show 'last online CPU' error in dlpar_cpu_remove() Daniel Henrique Barboza
2021-03-18  9:59 ` Daniel Henrique Barboza [this message]
2021-03-19 11:26   ` Michael Ellerman
2021-03-22 23:30     ` Daniel Henrique Barboza

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=c2fdbf4e-995b-fec8-7dc3-41beb7d66daa@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.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).