lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240206185710.062560408@redhat.com>
Date: Tue, 06 Feb 2024 15:49:20 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Daniel Bristot de Oliveira <bristot@...nel.org>,
 Juri Lelli <juri.lelli@...hat.com>,
 Valentin Schneider <vschneid@...hat.com>,
 Frederic Weisbecker <frederic@...nel.org>,
 Leonardo Bras <leobras@...hat.com>,
 Peter Zijlstra <peterz@...radead.org>,
 Thomas Gleixner <tglx@...utronix.de>,
 Marcelo Tosatti <mtosatti@...hat.com>
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@...hat.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;
 }



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ