linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Lynch <nathanl@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: tyreld@linux.ibm.com, ldufour@linux.ibm.com,
	aneesh.kumar@linux.ibm.com, danielhb413@gmail.com
Subject: [PATCH v2 2/4] powerpc/cpuhp: BUG -> WARN conversion in offline path
Date: Mon, 27 Sep 2021 15:19:31 -0500	[thread overview]
Message-ID: <20210927201933.76786-3-nathanl@linux.ibm.com> (raw)
In-Reply-To: <20210927201933.76786-1-nathanl@linux.ibm.com>

If, due to bugs elsewhere, we get into unregister_cpu_online() with a CPU
that isn't marked hotpluggable, we can emit a warning and return an
appropriate error instead of crashing.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 arch/powerpc/kernel/sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index defecb3b1b15..08d8072d6e7a 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -928,7 +928,8 @@ static int unregister_cpu_online(unsigned int cpu)
 	struct device_attribute *attrs, *pmc_attrs;
 	int i, nattrs;
 
-	BUG_ON(!c->hotpluggable);
+	if (WARN_RATELIMIT(!c->hotpluggable, "cpu %d can't be offlined\n", cpu))
+		return -EBUSY;
 
 #ifdef CONFIG_PPC64
 	if (cpu_has_feature(CPU_FTR_SMT))
-- 
2.31.1


  parent reply	other threads:[~2021-09-27 20:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 20:19 [PATCH v2 0/4] CPU DLPAR/hotplug for v5.16 Nathan Lynch
2021-09-27 20:19 ` [PATCH v2 1/4] powerpc/pseries/cpuhp: cache node corrections Nathan Lynch
2021-09-27 20:19 ` Nathan Lynch [this message]
2021-09-27 20:19 ` [PATCH v2 3/4] powerpc/pseries/cpuhp: delete add/remove_by_count code Nathan Lynch
2021-09-27 20:19 ` [PATCH v2 4/4] powerpc/pseries/cpuhp: remove obsolete comment from pseries_cpu_die Nathan Lynch
2021-09-29  0:14   ` Daniel Henrique Barboza
2021-09-29  5:45     ` Michael Ellerman
2021-09-29 12:06       ` Nathan Lynch
2021-10-11 12:34         ` Michael Ellerman
2021-10-11 12:06 ` [PATCH v2 0/4] CPU DLPAR/hotplug for v5.16 Michael Ellerman

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=20210927201933.76786-3-nathanl@linux.ibm.com \
    --to=nathanl@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=danielhb413@gmail.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tyreld@linux.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).