Skip to contentSkip to conversation

ACPI / extlog: Check for RDMSR failure

PATCH Applied Ben Hutchings 2 participants 2 messages Sep 27, 2020 – Oct 2, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / extlog: Check for RDMSR failure

extlog_init() uses rdmsrl() to read an MSR, which on older CPUs provokes a error message at boot:

    unchecked MSR access error: RDMSR from 0x179 at rIP: 0xcd047307 (native_read_msr+0x7/0x40)

Use rdmsrl_safe() instead, and return -ENODEV if it fails.

Reported-by [email protected]

References: https://bugs.debian.org/971058

---
 drivers/acpi/acpi_extlog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_extlog.c +3 -3
index f138e12b7b82..72f1fb77abcd 100644
@@ -222,9 +222,9 @@ static int __init extlog_init(void)
 	u64 cap;
 	int rc;
 
-	rdmsrl(MSR_IA32_MCG_CAP, cap);
-
-	if (!(cap & MCG_ELOG_P) || !extlog_get_l1addr())
+	if (rdmsrl_safe(MSR_IA32_MCG_CAP, &cap) ||
+	    !(cap & MCG_ELOG_P) ||
+	    !extlog_get_l1addr())
 		return -ENODEV;
 
 	rc = -EINVAL;
maintainer Applied
#1 lore raw
Quoted 23 lines · Ben Hutchings

extlog_init() uses rdmsrl() to read an MSR, which on older CPUs provokes a error message at boot:

    unchecked MSR access error: RDMSR from 0x179 at rIP: 0xcd047307 (native_read_msr+0x7/0x40)

Use rdmsrl_safe() instead, and return -ENODEV if it fails.

Reported-by [email protected]

References: https://bugs.debian.org/971058

---
 drivers/acpi/acpi_extlog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_extlog.c +0 -0
index f138e12b7b82..72f1fb77abcd 100644
@@ -222,9 +222,9 @@ static int __init extlog_init(void)
        u64 cap;
        int rc;

drivers/acpi/acpi_extlog.c static int __init extlog_init(void) · line 230

Quoted 10 lines
drivers/acpi/acpi_extlog.c +3 -3
 
-       rdmsrl(MSR_IA32_MCG_CAP, cap);
-
-       if (!(cap & MCG_ELOG_P) || !extlog_get_l1addr())
+       if (rdmsrl_safe(MSR_IA32_MCG_CAP, &cap) ||
+           !(cap & MCG_ELOG_P) ||
+           !extlog_get_l1addr())
                return -ENODEV;
 
        rc = -EINVAL;

Applied as 5.10 material, thanks!