linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI / extlog: Check for RDMSR failure
@ 2020-09-27 21:50 Ben Hutchings
  2020-10-02 17:02 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2020-09-27 21:50 UTC (permalink / raw)
  To: linux-acpi; +Cc: 971058, jim

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

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: jim@photojim.ca
References: https://bugs.debian.org/971058
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/acpi/acpi_extlog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index f138e12b7b82..72f1fb77abcd 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -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;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI / extlog: Check for RDMSR failure
  2020-09-27 21:50 [PATCH] ACPI / extlog: Check for RDMSR failure Ben Hutchings
@ 2020-10-02 17:02 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-10-02 17:02 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: ACPI Devel Maling List, 971058, jim

On Mon, Sep 28, 2020 at 12:27 AM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> 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: jim@photojim.ca
> References: https://bugs.debian.org/971058
> Cc: stable@vger.kernel.org
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>  drivers/acpi/acpi_extlog.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index f138e12b7b82..72f1fb77abcd 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -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;

Applied as 5.10 material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-02 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 21:50 [PATCH] ACPI / extlog: Check for RDMSR failure Ben Hutchings
2020-10-02 17:02 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).