With this patch and crash variable "offline" is hide(check command "set
-v"),
"set -c" is not able to set to an offline cpu and message like below will be
printed.
<cut>
crash> set -c 2
set invalid cpu number: cpu 2 is OFFLINE
<cut>
Signed-off-by: Qiao Nuohan <qiaonuohan(a)cn.fujitsu.com>
---
kernel.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel.c b/kernel.c
index f5bf011..560b292 100755
--- a/kernel.c
+++ b/kernel.c
@@ -5482,6 +5482,10 @@ set_cpu(int cpu)
if (cpu >= kt->cpus)
error(FATAL, "invalid cpu number: system has only %d cpu%s\n",
kt->cpus, kt->cpus > 1 ? "s" : "");
+
+ if (hide_offline_cpu(cpu))
+ error(FATAL, "invalid cpu number: cpu %d is OFFLINE\n", cpu);
+
if ((task = get_active_task(cpu)))
set_context(task, NO_PID);
else
--
1.8.5.3