lkml.org 
[lkml]   [2024]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 09/12] AMD MCE: use smp_call_func_single_fail
Convert arch/x86/kernel/cpu/mce/amd.c from smp_call_function_single
to smp_call_func_single_fail, which will fail in case
the target CPU is tagged as block interference CPU.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: linux-isolation/arch/x86/kernel/cpu/mce/amd.c
===================================================================
--- linux-isolation.orig/arch/x86/kernel/cpu/mce/amd.c
+++ linux-isolation/arch/x86/kernel/cpu/mce/amd.c
@@ -19,6 +19,7 @@
#include <linux/cpu.h>
#include <linux/smp.h>
#include <linux/string.h>
+#include <linux/sched/isolation.h>

#include <asm/amd_nb.h>
#include <asm/traps.h>
@@ -970,6 +971,7 @@ store_interrupt_enable(struct threshold_
{
struct thresh_restart tr;
unsigned long new;
+ int ret, idx;

if (!b->interrupt_capable)
return -EINVAL;
@@ -982,8 +984,15 @@ store_interrupt_enable(struct threshold_
memset(&tr, 0, sizeof(tr));
tr.b = b;

- if (smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1))
+ idx = block_interf_srcu_read_lock();
+ ret = smp_call_function_single_fail(b->cpu, threshold_restart_bank,
+ &tr, 1);
+ block_interf_srcu_read_unlock(idx);
+ if (ret) {
+ if (ret == -EPERM)
+ return ret;
return -ENODEV;
+ }

return size;
}
@@ -993,6 +1002,7 @@ store_threshold_limit(struct threshold_b
{
struct thresh_restart tr;
unsigned long new;
+ int ret, idx;

if (kstrtoul(buf, 0, &new) < 0)
return -EINVAL;
@@ -1007,8 +1017,14 @@ store_threshold_limit(struct threshold_b
b->threshold_limit = new;
tr.b = b;

- if (smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1))
+ idx = block_interf_srcu_read_lock();
+ ret = smp_call_function_single_fail(b->cpu, threshold_restart_bank, &tr, 1);
+ block_interf_srcu_read_unlock(idx);
+ if (ret) {
+ if (ret == -EPERM)
+ return ret;
return -ENODEV;
+ }

return size;
}


\
 
 \ /
  Last update: 2024-05-27 14:51    [W:0.249 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site