All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>, X86 ML <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] x86/mce: Get rid of msr_ops
Date: Wed, 22 Sep 2021 17:57:52 +0200	[thread overview]
Message-ID: <YUtSgEa8O5vyALSj@zn.tnic> (raw)
In-Reply-To: <f73c2f6790d6428393348869bc7c7e73@intel.com>

On Wed, Sep 22, 2021 at 03:22:01PM +0000, Luck, Tony wrote:
> Also:
> 
> 	switch (enum) {
> 	actions for every value of that enum
> 	}
> 
> doesn't need a default: option

Right, my thought was to catch silly stuff like this here:

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index b355ce737543..dfecf65e5407 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1714,6 +1714,7 @@ static void __mcheck_cpu_init_clear_banks(void)
 			continue;
 		wrmsrl(mca_msr_reg(i, MCA_CTL), b->ctl);
 		wrmsrl(mca_msr_reg(i, MCA_STATUS), 0);
+		wrmsrl(mca_msr_reg(i, 12), 0);
 	}
 }
 

but we already warn nicely there:

[    0.146457] unchecked MSR access error: WRMSR to 0x0 (tried to write 0x0000000000000000) at rIP: 0xffffffff8103234b (__mcheck_cpu_init_clear_banks+0x6b/0xe0)
[    0.147550] Call Trace:
[    0.147836]  mcheck_cpu_init+0x16c/0x4a0
[    0.148234]  identify_cpu+0x3fe/0x670
[    0.148607]  identify_boot_cpu+0xc/0x94
[    0.148995]  check_bugs+0x26/0xaef
[    0.149353]  ? __get_locked_pte+0x14a/0x200
[    0.149777]  start_kernel+0x602/0x621
[    0.150153]  secondary_startup_64_no_verify+0xb0/0xbb

and the mce_rd/wrmsrl() wrappers even panic.

So default case gone.

-- 
Regards/Gruss,
    Boris.

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

  reply	other threads:[~2021-09-22 15:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 10:53 [PATCH 0/4] x86/mce: Remove indirect calls Borislav Petkov
2021-09-17 10:53 ` [PATCH 1/4] x86/mce: Get rid of the mce_severity function pointer Borislav Petkov
2021-09-17 10:53 ` [PATCH 2/4] x86/mce: Get rid of machine_check_vector Borislav Petkov
2021-09-20  4:57   ` Luck, Tony
2021-09-20  7:42     ` Rasmus Villemoes
2021-09-20  8:15       ` Borislav Petkov
2021-09-20  8:12     ` Borislav Petkov
2021-09-20 16:04       ` Luck, Tony
2021-09-20 16:32         ` Borislav Petkov
2021-09-17 10:53 ` [PATCH 3/4] x86/mce: Get rid of msr_ops Borislav Petkov
2021-09-20  4:47   ` Luck, Tony
2021-09-20  8:32     ` Borislav Petkov
2021-09-22 12:16       ` Borislav Petkov
2021-09-22 13:23         ` Luck, Tony
2021-09-22 13:55           ` Borislav Petkov
2021-09-22 15:22             ` Luck, Tony
2021-09-22 15:57               ` Borislav Petkov [this message]
2021-09-17 10:53 ` [PATCH 4/4] x86/mce: Get rid of the ->quirk_no_way_out() indirect call Borislav Petkov
2021-09-20  5:06   ` Luck, Tony
2021-09-20  8:34     ` Borislav Petkov
2021-09-23 14:51   ` Yazen Ghannam
2021-09-23 15:11     ` Borislav Petkov
2021-09-24 20:04       ` Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUtSgEa8O5vyALSj@zn.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.