Re: [RFC PATCH] x86/mce: Make mce_rdmsrl() do a plain RDMSR only
From: Luck, Tony
Date: Wed Sep 09 2020 - 14:21:00 EST
On Wed, Sep 09, 2020 at 01:30:22PM +0200, Borislav Petkov wrote:
> I guess something as straightforward as this:
Do we think there will be other places where we want this
MSR-or-die behaviour? If there are, then most of this
belongs elsewhere from arch/x86/kernel/cpu/mce/core.c
> ---
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 0ba24dfffdb2..9893caaf2696 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -373,10 +373,27 @@ static int msr_to_offset(u32 msr)
> return -1;
> }
>
> +__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup,
> + struct pt_regs *regs, int trapnr,
> + unsigned long error_code,
> + unsigned long fault_addr)
> +{
> + if (pr_warn_once("MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\n",
The "_once" version seems a little pointless when the next statement in the function
is "panic()".
"warn" seems understated for an error that is going to crash the system.
Just go for "pr_emerg()".
There seems no consistency on using "rIP" or "RIP" ... but I think "RIP"
is slightly ahead.
> + (unsigned int)regs->cx, regs->ip, (void *)regs->ip))
> + show_stack_regs(regs);
> +
> + panic("MCA Architectural violation!\n");
nitpick: I don't thing Architectural needs to be capitalized.
> +
> + while (true)
> + cpu_relax();
Ugh. Is this why you have warn_once() ... because panic might return?
Above comments also apply to the wrmsr path.
-Tony