lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 3/3] x86/mce/mce-inject: Return appropriate error code if CPUs are offline
Date
Assign appropriate error code when no CPUs are available online.

Return this error code with appropriate message to user when injection
fails.

Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
Link:
https://lkml.kernel.org/r/20220214233640.70510-3-Smita.KoralahalliChannabasappa@amd.com

v2:
Added pr_err() along with error code.
v3:
Rephrased the statement: No online CPUs available for error
injection -> Chosen CPU is not online.
v4:
Prefixed "mce-inject" so the user knows that the message is
coming from this module.
Printed CPU number along with the error message.
v5:
Used the new descriptor for writing errors.
---
arch/x86/kernel/cpu/mce/inject.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
index cce068a4478c..efae0e938293 100644
--- a/arch/x86/kernel/cpu/mce/inject.c
+++ b/arch/x86/kernel/cpu/mce/inject.c
@@ -575,8 +575,11 @@ static int do_inject(void)
}

cpus_read_lock();
- if (!cpu_online(cpu))
+ if (!cpu_online(cpu)) {
+ pr_err("mce-inject: Chosen CPU %d is not online\n", cpu);
+ inj_desc.err = -ENODEV;
goto err;
+ }

toggle_hw_mce_inject(cpu, true);

--
2.17.1
\
 
 \ /
  Last update: 2022-05-03 05:29    [W:0.031 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site