diff options
author | Borislav Petkov <bp@suse.de> | 2017-01-23 13:35:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-01-24 03:14:57 -0500 |
commit | 9026cc82b632ed1a859935c82ed8ad65f27f2781 (patch) | |
tree | 6034f0e9d4f9f1d8faac595580fdfe9c8722f441 | |
parent | cff4c0391a692cf9b89932c62a7f879fb3637148 (diff) |
x86/ras, EDAC, acpi: Assign MCE notifier handlers a priority
Assign all notifiers on the MCE decode chain a priority so that they get
called in the correct order.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/20170123183514.13356-10-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/mce.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 8 | ||||
-rw-r--r-- | drivers/acpi/acpi_extlog.c | 1 | ||||
-rw-r--r-- | drivers/acpi/nfit/mce.c | 1 | ||||
-rw-r--r-- | drivers/edac/i7core_edac.c | 1 | ||||
-rw-r--r-- | drivers/edac/mce_amd.c | 1 | ||||
-rw-r--r-- | drivers/edac/sb_edac.c | 3 | ||||
-rw-r--r-- | drivers/edac/skx_edac.c | 3 |
8 files changed, 20 insertions, 7 deletions
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index 528f6ec897cb..e63873683d4a 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h | |||
@@ -189,6 +189,15 @@ extern struct mce_vendor_flags mce_flags; | |||
189 | 189 | ||
190 | extern struct mca_config mca_cfg; | 190 | extern struct mca_config mca_cfg; |
191 | extern struct mca_msr_regs msr_ops; | 191 | extern struct mca_msr_regs msr_ops; |
192 | |||
193 | enum mce_notifier_prios { | ||
194 | MCE_PRIO_SRAO = INT_MAX, | ||
195 | MCE_PRIO_EXTLOG = INT_MAX - 1, | ||
196 | MCE_PRIO_NFIT = INT_MAX - 2, | ||
197 | MCE_PRIO_EDAC = INT_MAX - 3, | ||
198 | MCE_PRIO_LOWEST = 0, | ||
199 | }; | ||
200 | |||
192 | extern void mce_register_decode_chain(struct notifier_block *nb); | 201 | extern void mce_register_decode_chain(struct notifier_block *nb); |
193 | extern void mce_unregister_decode_chain(struct notifier_block *nb); | 202 | extern void mce_unregister_decode_chain(struct notifier_block *nb); |
194 | 203 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 0fef5406f0eb..e39bbc0e7c8b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -216,9 +216,7 @@ void mce_register_decode_chain(struct notifier_block *nb) | |||
216 | { | 216 | { |
217 | atomic_inc(&num_notifiers); | 217 | atomic_inc(&num_notifiers); |
218 | 218 | ||
219 | /* Ensure SRAO notifier has the highest priority in the decode chain. */ | 219 | WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC); |
220 | if (nb != &mce_srao_nb && nb->priority == INT_MAX) | ||
221 | nb->priority -= 1; | ||
222 | 220 | ||
223 | atomic_notifier_chain_register(&x86_mce_decoder_chain, nb); | 221 | atomic_notifier_chain_register(&x86_mce_decoder_chain, nb); |
224 | } | 222 | } |
@@ -582,7 +580,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val, | |||
582 | } | 580 | } |
583 | static struct notifier_block mce_srao_nb = { | 581 | static struct notifier_block mce_srao_nb = { |
584 | .notifier_call = srao_decode_notifier, | 582 | .notifier_call = srao_decode_notifier, |
585 | .priority = INT_MAX, | 583 | .priority = MCE_PRIO_SRAO, |
586 | }; | 584 | }; |
587 | 585 | ||
588 | static int mce_default_notifier(struct notifier_block *nb, unsigned long val, | 586 | static int mce_default_notifier(struct notifier_block *nb, unsigned long val, |
@@ -608,7 +606,7 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val, | |||
608 | static struct notifier_block mce_default_nb = { | 606 | static struct notifier_block mce_default_nb = { |
609 | .notifier_call = mce_default_notifier, | 607 | .notifier_call = mce_default_notifier, |
610 | /* lowest prio, we want it to run last. */ | 608 | /* lowest prio, we want it to run last. */ |
611 | .priority = 0, | 609 | .priority = MCE_PRIO_LOWEST, |
612 | }; | 610 | }; |
613 | 611 | ||
614 | /* | 612 | /* |
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index b3842ffc19ba..a15270a806fc 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c | |||
@@ -212,6 +212,7 @@ static bool __init extlog_get_l1addr(void) | |||
212 | } | 212 | } |
213 | static struct notifier_block extlog_mce_dec = { | 213 | static struct notifier_block extlog_mce_dec = { |
214 | .notifier_call = extlog_print, | 214 | .notifier_call = extlog_print, |
215 | .priority = MCE_PRIO_EXTLOG, | ||
215 | }; | 216 | }; |
216 | 217 | ||
217 | static int __init extlog_init(void) | 218 | static int __init extlog_init(void) |
diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c index e5ce81c38eed..3ba1c3472cf9 100644 --- a/drivers/acpi/nfit/mce.c +++ b/drivers/acpi/nfit/mce.c | |||
@@ -90,6 +90,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, | |||
90 | 90 | ||
91 | static struct notifier_block nfit_mce_dec = { | 91 | static struct notifier_block nfit_mce_dec = { |
92 | .notifier_call = nfit_handle_mce, | 92 | .notifier_call = nfit_handle_mce, |
93 | .priority = MCE_PRIO_NFIT, | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | void nfit_mce_register(void) | 96 | void nfit_mce_register(void) |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 69b5adead0ad..75ad847593b7 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1835,6 +1835,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, | |||
1835 | 1835 | ||
1836 | static struct notifier_block i7_mce_dec = { | 1836 | static struct notifier_block i7_mce_dec = { |
1837 | .notifier_call = i7core_mce_check_error, | 1837 | .notifier_call = i7core_mce_check_error, |
1838 | .priority = MCE_PRIO_EDAC, | ||
1838 | }; | 1839 | }; |
1839 | 1840 | ||
1840 | struct memdev_dmi_entry { | 1841 | struct memdev_dmi_entry { |
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c index ecad750fd090..0d9bc25543d8 100644 --- a/drivers/edac/mce_amd.c +++ b/drivers/edac/mce_amd.c | |||
@@ -1054,6 +1054,7 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) | |||
1054 | 1054 | ||
1055 | static struct notifier_block amd_mce_dec_nb = { | 1055 | static struct notifier_block amd_mce_dec_nb = { |
1056 | .notifier_call = amd_decode_mce, | 1056 | .notifier_call = amd_decode_mce, |
1057 | .priority = MCE_PRIO_EDAC, | ||
1057 | }; | 1058 | }; |
1058 | 1059 | ||
1059 | static int __init mce_amd_init(void) | 1060 | static int __init mce_amd_init(void) |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 54ae6dc45ab2..c585a014dd3d 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
@@ -3136,7 +3136,8 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, | |||
3136 | } | 3136 | } |
3137 | 3137 | ||
3138 | static struct notifier_block sbridge_mce_dec = { | 3138 | static struct notifier_block sbridge_mce_dec = { |
3139 | .notifier_call = sbridge_mce_check_error, | 3139 | .notifier_call = sbridge_mce_check_error, |
3140 | .priority = MCE_PRIO_EDAC, | ||
3140 | }; | 3141 | }; |
3141 | 3142 | ||
3142 | /**************************************************************************** | 3143 | /**************************************************************************** |
diff --git a/drivers/edac/skx_edac.c b/drivers/edac/skx_edac.c index 79ef675e4d6f..1159dba4671f 100644 --- a/drivers/edac/skx_edac.c +++ b/drivers/edac/skx_edac.c | |||
@@ -1007,7 +1007,8 @@ static int skx_mce_check_error(struct notifier_block *nb, unsigned long val, | |||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | static struct notifier_block skx_mce_dec = { | 1009 | static struct notifier_block skx_mce_dec = { |
1010 | .notifier_call = skx_mce_check_error, | 1010 | .notifier_call = skx_mce_check_error, |
1011 | .priority = MCE_PRIO_EDAC, | ||
1011 | }; | 1012 | }; |
1012 | 1013 | ||
1013 | static void skx_remove(void) | 1014 | static void skx_remove(void) |