aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-13 21:20:25 -0400
committerIan Moffett <ian@osmora.org>2024-03-13 21:24:19 -0400
commit10e2fc7e3c6a924923664cf2919393b7f7b37326 (patch)
treeb952c4570d71e9db3cd1b41a33a419a779856be0 /sys
parent2cfcba7e6ed64a00ca01dcc7247ecfc5edacfdb2 (diff)
kernel/amd64: spectre: Log only once
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/spectre.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/spectre.c b/sys/arch/amd64/amd64/spectre.c
index 1247607..05aa557 100644
--- a/sys/arch/amd64/amd64/spectre.c
+++ b/sys/arch/amd64/amd64/spectre.c
@@ -62,13 +62,18 @@ __weak int
try_spectre_mitigate(void)
{
uint64_t tmp;
+ static bool should_log = true;
if (!__can_mitigate_spectre()) {
KINFO("IBRS not supported; spectre mitigation NOT enabled\n");
return EXIT_FAILURE;
}
- KINFO("IBRS supported; spectre mitigation enabled\n");
+ /* This is called per processor, only log once */
+ if (should_log) {
+ KINFO("IBRS supported; spectre mitigation enabled\n");
+ should_log = false;
+ }
tmp = rdmsr(IA32_SPEC_CTL);
tmp |= __BIT(0); /* IBRS */