Skip to contentSkip to conversation

Unrecognized MSR report

DISCUSSION Borislav Petkov 2 participants 5 messages Jul 26, 2024 – Aug 3, 2024 1 message not in the archive EDAC-core

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Borislav Petkov

author maintainer
#1 lore raw

+ Mauro, Tony, linux-edac

Quoted 9 lines · Andres Valloud

Hello, after installing rasdaemon the logs complain thus.

[604477.995036] msr: Write to unrecognized MSR 0x17f by rasdaemon (pid:

24480).

The hardware in question is a supermicro server with 2x E5-2630v2. A newer server with 2x Xeon Gold 6128 is also running rasdaemon, but there is no complaint about MSR 0x17f there.

Quoted 7 lines

Both systems are running Ubuntu 22.04 LTS, fully up to date, with kernel version 6.5.0-44.

The text in the MSR document referenced from the logs only makes reference to AMD cpus. There is also the different behavior depending on the Intel cpu model. This circumstance does not appear to be covered by the document. Reporting as requested...

Thanks, appreciated.

---
From: "Borislav Petkov (AMD)" <[email protected]>
Date: Fri, 26 Jul 2024 14:39:53 +0200
Subject: [PATCH] mce-intel: Do not enable optional MCE logging in rasdaemon

The kernel already does that, see kernel commit:

68299a42f842 ("x86/mce: Enable additional error logging on certain Intel CPUs")

so rip out yet another case of poking into MSRs from userspace.

---
 mce-intel.c       | 26 --------------------------
 ras-mce-handler.c | 11 -----------
 ras-mce-handler.h |  3 ---
 3 files changed, 40 deletions(-)
mce-intel.c +0 -26
index 0ff3072dfd0e..285c067aec93 100644
@@ -461,29 +461,3 @@ static int domsr(int cpu, int msr, int bit)
 	close(fd);
 	return 0;
 }
-
-int set_intel_imc_log(enum cputype cputype, unsigned int ncpus)
-{
-	int cpu, msr, bit, rc;
-
-	switch (cputype) {
-	case CPU_SANDY_BRIDGE_EP:
-	case CPU_IVY_BRIDGE_EPEX:
-	case CPU_HASWELL_EPEX:
-	case CPU_KNIGHTS_LANDING:
-	case CPU_KNIGHTS_MILL:
-		msr = 0x17f;	/* MSR_ERROR_CONTROL */
-		bit = 0x2;	/* MemError Log Enable */
-		break;
-	default:
-		return 0;
-	}
-
-	for (cpu = 0; cpu < ncpus; cpu++) {
-		rc = domsr(cpu, msr, bit);
-		if (rc)
-			return rc;
-	}
-
-	return 0;
-}
ras-mce-handler.c +0 -11
index ea58ac091267..0480f41b259b 100644
@@ -249,17 +249,6 @@ int register_mce_handler(struct ras_events *ras, unsigned int ncpus)
 		ras->mce_priv = NULL;
 		return rc;
 	}
-	switch (mce->cputype) {
-	case CPU_SANDY_BRIDGE_EP:
-	case CPU_IVY_BRIDGE_EPEX:
-	case CPU_HASWELL_EPEX:
-	case CPU_KNIGHTS_LANDING:
-	case CPU_KNIGHTS_MILL:
-		set_intel_imc_log(mce->cputype, ncpus);
-	default:
-		break;
-	}
-
 	return rc;
 }
 
ras-mce-handler.h +0 -3
index 57984ecc4357..aa820d3458cc 100644
@@ -109,9 +109,6 @@ int ras_mce_event_handler(struct trace_seq *s,
 			  struct tep_record *record,
 			  struct tep_event *event, void *context);
 
-/* enables intel iMC logs */
-int set_intel_imc_log(enum cputype cputype, unsigned int ncpus);
-
 /* Undertake AMD SMCA Error Decoding */
 void decode_smca_error(struct mce_event *e, struct mce_priv *m);
 void amd_decode_errcode(struct mce_event *e);
Signature · 7 lines
2.43.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
Quoted 7 lines

From: Borislav Petkov <[email protected]>
Sent: Friday, July 26, 2024 8:43 PM
To: Andres Valloud <[email protected]>; Mauro Carvalho Chehab <[email protected]>; Luck, Tony <[email protected]>
Cc: [email protected]; linux-edac <[email protected]>
Subject: Re: Unrecognized MSR report

Quoted 8 lines

+ Mauro, Tony, linux-edac

Quoted 5 lines · Andres Valloud

Hello, after installing rasdaemon the logs complain thus.

[604477.995036] msr: Write to unrecognized MSR 0x17f by rasdaemon (pid:

24480).
The hardware in question is a supermicro server with 2x E5-2630v2. A

E5-2630 is the Intel CPU with the codename "Ivy Bridge EP" with MSR 0x17F capability.

I reproduced the kernel warning message above on an Intel SandyBridge, This was because of the default sys-node:

    /sys/module/msr/parameters/allow_writes == "default"

If I set this sys-node to

/sys/module/msr/parameters/allow_writes = "on"

Then there was no such warning kernel message.

Quoted 2 lines
Quoted 2 lines

newer server with 2x Xeon Gold 6128 is also running rasdaemon, but there is no complaint about MSR 0x17f there.

Xeon Gold 6128 is the Intel CPU with the code name "Skylake".

As Skylake didn't have MSR 0x17f and rasdaemon didn't try to write this MSR, so no kernel warning message on this CPU.

Quoted 16 lines
Quoted 6 lines

Both systems are running Ubuntu 22.04 LTS, fully up to date, with kernel version 6.5.0-44.

The text in the MSR document referenced from the logs only makes reference to AMD cpus. There is also the different behavior depending on the Intel cpu model. This circumstance does not appear to be covered

by the document.

Quoted 1 line

Reporting as requested...

Thanks, appreciated.

---
From: "Borislav Petkov (AMD)" <[email protected]>
Date: Fri, 26 Jul 2024 14:39:53 +0200
Subject: [PATCH] mce-intel: Do not enable optional MCE logging in rasdaemon

Quoted 6 lines

The kernel already does that, see kernel commit:

68299a42f842 ("x86/mce: Enable additional error logging on certain Intel
CPUs")
so rip out yet another case of poking into MSRs from userspace.

Just a small concern:

The commit 68299a42f842 was merged to kernel v5.11.
For kernels < v5.11 and w/o backporting this commit may still need the rasdaemon to wrmsr 0x17f to enable the additional error logging for these certain Intel CPUs.

If get the rasdameon to write the sys-node as below before doing wrmsr 0x17f for these CPUs

/sys/module/msr/parameters/allow_writes = "on"

Then there will be no such kernel warning message:

       msr: Write to unrecognized MSR 0x17f by rasdaemon (pid: 24480).

@Borislav Petkov, if you think the fix above to the rasdaemon is acceptable, I'll proceed to make a fix for rasdaemon.

Quoted 4 lines

---
[...]

Thanks!
-Qiuxu

author maintainer
#3 lore raw
Quoted 10 lines · Qiuxu

I reproduced the kernel warning message above on an Intel SandyBridge, This was because of the default sys-node:

    /sys/module/msr/parameters/allow_writes == "default"

If I set this sys-node to

/sys/module/msr/parameters/allow_writes = "on"

Then there was no such warning kernel message.

Because poking at MSRs from userspace is a bad idea.

Quoted 5 lines

Just a small concern:

The commit 68299a42f842 was merged to kernel v5.11.
For kernels < v5.11 and w/o backporting this commit may still need the rasdaemon to wrmsr 0x17f to enable the additional error logging for these certain Intel CPUs.

What user runs an old kernel (< 5.11) with a new rasdaemon?

If there's a valid use case and they've backported stuff, then they can backport the above commit too.

Quoted 10 lines

If get the rasdameon to write the sys-node as below before doing wrmsr 0x17f for these CPUs

/sys/module/msr/parameters/allow_writes = "on"

Then there will be no such kernel warning message:

       msr: Write to unrecognized MSR 0x17f by rasdaemon (pid: 24480).

@Borislav Petkov, if you think the fix above to the rasdaemon is acceptable, I'll proceed to make a fix for rasdaemon.

The goal is to stop poking at MSRs from userspace. And I've sent a patch already.

What fix are you going to proceed with?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#4 lore raw
Quoted 3 lines

From: Borislav Petkov <[email protected]>
[...]
Because poking at MSRs from userspace is a bad idea.

Yes.

Quoted 2 lines

[...]
What user runs an old kernel (< 5.11) with a new rasdaemon?

I thought some cloud service providers running old kernels (<5.11) could upgrade their rasdaemons at runtime (w/o system reboot).

Quoted 2 lines

If there's a valid use case and they've backported stuff, then they can backport the above commit too.

Yes, agree.

Quoted 8 lines

[...]

Quoted 2 lines

@Borislav Petkov, if you think the fix above to the rasdaemon is acceptable, I'll proceed to make a fix for rasdaemon.

The goal is to stop poking at MSRs from userspace. And I've sent a patch already.

What fix are you going to proceed with?

Some pseudo-codes like below.
However, as you mentioned, poking MSR in userspace is not advisable. And I agree that users can backport that kernel commit if they use a new rasdaemon. Please go ahead with yours 😊.

--------

mce-intel.c +7 -1
index 7f48cc4b0375..d4abc2e9c54b 100644
@@ -486,11 +486,17 @@ int set_intel_imc_log(enum cputype cputype, unsigned int ncpus)
                return 0;
        }
 
+       old_state = get_wrmsr_state("/sys/module/msr/parameters/allow_writes");
+       set_wrmsr_state("/sys/module/msr/parameters/allow_writes", "on");
+
        for (cpu = 0; cpu < ncpus; cpu++) {
                rc = domsr(cpu, msr, bit);
-               if (rc)
+               if (rc) {
+                       set_wrmsr_state("/sys/module/msr/parameters/allow_writes", old_state);
                        return rc;
+               }
        }
 
+       set_wrmsr_state("/sys/module/msr/parameters/allow_writes", old_state);
        return 0;
 }
author maintainer
#5 lore raw
Quoted 2 lines · Qiuxu

I thought some cloud service providers running old kernels (<5.11) could upgrade their rasdaemons at runtime (w/o system reboot).

You thought. So no real use case. No, we don't anticipate use cases.

Quoted 2 lines

Some pseudo-codes like below. However, as you mentioned, poking MSR in userspace is not advisable.

You got it: we don't want to perpetuate the MSR poking - we want to get rid of it.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette