Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 In fact, xc_broadcast also applies to offli...
details: https://anonhg.NetBSD.org/src/rev/96a916ab2765
branches: trunk
changeset: 449785:96a916ab2765
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Mar 23 10:02:05 2019 +0000
description:
In fact, xc_broadcast also applies to offline CPUs, so we don't need to
make sure each CPU is online. Remove the checks, I suspect they weren't
totally correct by the way.
diffstat:
sys/arch/x86/x86/spectre.c | 43 ++-----------------------------------------
sys/arch/x86/x86/svs.c | 23 ++---------------------
2 files changed, 4 insertions(+), 62 deletions(-)
diffs (157 lines):
diff -r fd15100da2b8 -r 96a916ab2765 sys/arch/x86/x86/spectre.c
--- a/sys/arch/x86/x86/spectre.c Sat Mar 23 09:48:04 2019 +0000
+++ b/sys/arch/x86/x86/spectre.c Sat Mar 23 10:02:05 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spectre.c,v 1.24 2019/01/27 05:08:05 dholland Exp $ */
+/* $NetBSD: spectre.c,v 1.25 2019/03/23 10:02:05 maxv Exp $ */
/*
* Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.24 2019/01/27 05:08:05 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.25 2019/03/23 10:02:05 maxv Exp $");
#include "opt_spectre.h"
@@ -292,31 +292,13 @@
static int
mitigation_v2_change(bool enabled)
{
- struct cpu_info *ci = NULL;
- CPU_INFO_ITERATOR cii;
uint64_t xc;
v2_detect_method();
- mutex_enter(&cpu_lock);
-
- /*
- * We expect all the CPUs to be online.
- */
- for (CPU_INFO_FOREACH(cii, ci)) {
- struct schedstate_percpu *spc = &ci->ci_schedstate;
- if (spc->spc_flags & SPCF_OFFLINE) {
- printf("[!] cpu%d offline, SpectreV2 not changed\n",
- cpu_index(ci));
- mutex_exit(&cpu_lock);
- return EOPNOTSUPP;
- }
- }
-
switch (v2_mitigation_method) {
case V2_MITIGATION_NONE:
printf("[!] No mitigation available\n");
- mutex_exit(&cpu_lock);
return EOPNOTSUPP;
case V2_MITIGATION_AMD_DIS_IND:
case V2_MITIGATION_INTEL_IBRS:
@@ -331,7 +313,6 @@
xc_wait(xc);
printf(" done!\n");
v2_mitigation_enabled = enabled;
- mutex_exit(&cpu_lock);
v2_set_name();
return 0;
default:
@@ -495,31 +476,13 @@
static int
mitigation_v4_change(bool enabled)
{
- struct cpu_info *ci = NULL;
- CPU_INFO_ITERATOR cii;
uint64_t xc;
v4_detect_method();
- mutex_enter(&cpu_lock);
-
- /*
- * We expect all the CPUs to be online.
- */
- for (CPU_INFO_FOREACH(cii, ci)) {
- struct schedstate_percpu *spc = &ci->ci_schedstate;
- if (spc->spc_flags & SPCF_OFFLINE) {
- printf("[!] cpu%d offline, SpectreV4 not changed\n",
- cpu_index(ci));
- mutex_exit(&cpu_lock);
- return EOPNOTSUPP;
- }
- }
-
switch (v4_mitigation_method) {
case V4_MITIGATION_NONE:
printf("[!] No mitigation available\n");
- mutex_exit(&cpu_lock);
return EOPNOTSUPP;
case V4_MITIGATION_INTEL_SSBD:
case V4_MITIGATION_AMD_NONARCH_F15H:
@@ -532,13 +495,11 @@
xc_wait(xc);
printf(" done!\n");
v4_mitigation_enabled = enabled;
- mutex_exit(&cpu_lock);
v4_set_name();
return 0;
case V4_MITIGATION_INTEL_SSB_NO:
case V4_MITIGATION_AMD_SSB_NO:
printf("[+] The CPU is not affected by SpectreV4\n");
- mutex_exit(&cpu_lock);
return 0;
default:
panic("impossible");
diff -r fd15100da2b8 -r 96a916ab2765 sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c Sat Mar 23 09:48:04 2019 +0000
+++ b/sys/arch/x86/x86/svs.c Sat Mar 23 10:02:05 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svs.c,v 1.23 2019/03/09 08:42:26 maxv Exp $ */
+/* $NetBSD: svs.c,v 1.24 2019/03/23 10:02:05 maxv Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.23 2019/03/09 08:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.24 2019/03/23 10:02:05 maxv Exp $");
#include "opt_svs.h"
@@ -704,25 +704,8 @@
static int
svs_disable(void)
{
- struct cpu_info *ci = NULL;
- CPU_INFO_ITERATOR cii;
uint64_t xc;
- mutex_enter(&cpu_lock);
-
- /*
- * We expect all the CPUs to be online.
- */
- for (CPU_INFO_FOREACH(cii, ci)) {
- struct schedstate_percpu *spc = &ci->ci_schedstate;
- if (spc->spc_flags & SPCF_OFFLINE) {
- printf("[!] cpu%d offline, SVS not disabled\n",
- cpu_index(ci));
- mutex_exit(&cpu_lock);
- return EOPNOTSUPP;
- }
- }
-
svs_cpu_barrier1 = ncpu;
svs_cpu_barrier2 = ncpu;
@@ -731,8 +714,6 @@
xc_wait(xc);
printf(" done!\n");
- mutex_exit(&cpu_lock);
-
return 0;
}
Home |
Main Index |
Thread Index |
Old Index