[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181204103731.659254879@linuxfoundation.org>
Date: Tue, 4 Dec 2018 11:50:06 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Rafał Miłecki <rafal@...ecki.pl>,
John Clemens <clemej@...il.com>, Borislav Petkov <bp@...e.de>,
John Clemens <john@...ter.net>,
Aravind Gopalakrishnan <aravindksg.lkml@...il.com>,
linux-edac@...r.kernel.org, Tony Luck <tony.luck@...el.com>,
x86@...nel.org, Yazen Ghannam <Yazen.Ghannam@....com>
Subject: [PATCH 4.14 120/146] x86/MCE/AMD: Fix the thresholding machinery initialization order
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <bp@...e.de>
commit 60c8144afc287ef09ce8c1230c6aa972659ba1bb upstream.
Currently, the code sets up the thresholding interrupt vector and only
then goes about initializing the thresholding banks. Which is wrong,
because an early thresholding interrupt would cause a NULL pointer
dereference when accessing those banks and prevent the machine from
booting.
Therefore, set the thresholding interrupt vector only *after* having
initialized the banks successfully.
Fixes: 18807ddb7f88 ("x86/mce/AMD: Reset Threshold Limit after logging error")
Reported-by: Rafał Miłecki <rafal@...ecki.pl>
Reported-by: John Clemens <clemej@...il.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Tested-by: Rafał Miłecki <rafal@...ecki.pl>
Tested-by: John Clemens <john@...ter.net>
Cc: Aravind Gopalakrishnan <aravindksg.lkml@...il.com>
Cc: linux-edac@...r.kernel.org
Cc: stable@...r.kernel.org
Cc: Tony Luck <tony.luck@...el.com>
Cc: x86@...nel.org
Cc: Yazen Ghannam <Yazen.Ghannam@....com>
Link: https://lkml.kernel.org/r/20181127101700.2964-1-zajec5@gmail.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=201291
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -56,7 +56,7 @@
/* Threshold LVT offset is at MSR0xC0000410[15:12] */
#define SMCA_THR_LVT_OFF 0xF000
-static bool thresholding_en;
+static bool thresholding_irq_en;
static const char * const th_names[] = {
"load_store",
@@ -533,9 +533,8 @@ prepare_threshold_block(unsigned int ban
set_offset:
offset = setup_APIC_mce_threshold(offset, new);
-
- if ((offset == new) && (mce_threshold_vector != amd_threshold_interrupt))
- mce_threshold_vector = amd_threshold_interrupt;
+ if (offset == new)
+ thresholding_irq_en = true;
done:
mce_threshold_block_init(&b, offset);
@@ -1356,9 +1355,6 @@ int mce_threshold_remove_device(unsigned
{
unsigned int bank;
- if (!thresholding_en)
- return 0;
-
for (bank = 0; bank < mca_cfg.banks; ++bank) {
if (!(per_cpu(bank_map, cpu) & (1 << bank)))
continue;
@@ -1376,9 +1372,6 @@ int mce_threshold_create_device(unsigned
struct threshold_bank **bp;
int err = 0;
- if (!thresholding_en)
- return 0;
-
bp = per_cpu(threshold_banks, cpu);
if (bp)
return 0;
@@ -1407,9 +1400,6 @@ static __init int threshold_init_device(
{
unsigned lcpu = 0;
- if (mce_threshold_vector == amd_threshold_interrupt)
- thresholding_en = true;
-
/* to hit CPUs online before the notifier is up */
for_each_online_cpu(lcpu) {
int err = mce_threshold_create_device(lcpu);
@@ -1418,6 +1408,9 @@ static __init int threshold_init_device(
return err;
}
+ if (thresholding_irq_en)
+ mce_threshold_vector = amd_threshold_interrupt;
+
return 0;
}
/*
Powered by blists - more mailing lists