提交 9026cc82 编写于 作者: B Borislav Petkov 提交者: Ingo Molnar

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: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NBorislav 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.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 cff4c039
...@@ -189,6 +189,15 @@ extern struct mce_vendor_flags mce_flags; ...@@ -189,6 +189,15 @@ extern struct mce_vendor_flags mce_flags;
extern struct mca_config mca_cfg; extern struct mca_config mca_cfg;
extern struct mca_msr_regs msr_ops; extern struct mca_msr_regs msr_ops;
enum mce_notifier_prios {
MCE_PRIO_SRAO = INT_MAX,
MCE_PRIO_EXTLOG = INT_MAX - 1,
MCE_PRIO_NFIT = INT_MAX - 2,
MCE_PRIO_EDAC = INT_MAX - 3,
MCE_PRIO_LOWEST = 0,
};
extern void mce_register_decode_chain(struct notifier_block *nb); extern void mce_register_decode_chain(struct notifier_block *nb);
extern void mce_unregister_decode_chain(struct notifier_block *nb); extern void mce_unregister_decode_chain(struct notifier_block *nb);
......
...@@ -216,9 +216,7 @@ void mce_register_decode_chain(struct notifier_block *nb) ...@@ -216,9 +216,7 @@ void mce_register_decode_chain(struct notifier_block *nb)
{ {
atomic_inc(&num_notifiers); atomic_inc(&num_notifiers);
/* Ensure SRAO notifier has the highest priority in the decode chain. */ WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC);
if (nb != &mce_srao_nb && nb->priority == INT_MAX)
nb->priority -= 1;
atomic_notifier_chain_register(&x86_mce_decoder_chain, nb); atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);
} }
...@@ -582,7 +580,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val, ...@@ -582,7 +580,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
} }
static struct notifier_block mce_srao_nb = { static struct notifier_block mce_srao_nb = {
.notifier_call = srao_decode_notifier, .notifier_call = srao_decode_notifier,
.priority = INT_MAX, .priority = MCE_PRIO_SRAO,
}; };
static int mce_default_notifier(struct notifier_block *nb, unsigned long val, 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,7 +606,7 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val,
static struct notifier_block mce_default_nb = { static struct notifier_block mce_default_nb = {
.notifier_call = mce_default_notifier, .notifier_call = mce_default_notifier,
/* lowest prio, we want it to run last. */ /* lowest prio, we want it to run last. */
.priority = 0, .priority = MCE_PRIO_LOWEST,
}; };
/* /*
......
...@@ -212,6 +212,7 @@ static bool __init extlog_get_l1addr(void) ...@@ -212,6 +212,7 @@ static bool __init extlog_get_l1addr(void)
} }
static struct notifier_block extlog_mce_dec = { static struct notifier_block extlog_mce_dec = {
.notifier_call = extlog_print, .notifier_call = extlog_print,
.priority = MCE_PRIO_EXTLOG,
}; };
static int __init extlog_init(void) static int __init extlog_init(void)
......
...@@ -90,6 +90,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, ...@@ -90,6 +90,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
static struct notifier_block nfit_mce_dec = { static struct notifier_block nfit_mce_dec = {
.notifier_call = nfit_handle_mce, .notifier_call = nfit_handle_mce,
.priority = MCE_PRIO_NFIT,
}; };
void nfit_mce_register(void) void nfit_mce_register(void)
......
...@@ -1835,6 +1835,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -1835,6 +1835,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val,
static struct notifier_block i7_mce_dec = { static struct notifier_block i7_mce_dec = {
.notifier_call = i7core_mce_check_error, .notifier_call = i7core_mce_check_error,
.priority = MCE_PRIO_EDAC,
}; };
struct memdev_dmi_entry { struct memdev_dmi_entry {
......
...@@ -1054,6 +1054,7 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) ...@@ -1054,6 +1054,7 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
static struct notifier_block amd_mce_dec_nb = { static struct notifier_block amd_mce_dec_nb = {
.notifier_call = amd_decode_mce, .notifier_call = amd_decode_mce,
.priority = MCE_PRIO_EDAC,
}; };
static int __init mce_amd_init(void) static int __init mce_amd_init(void)
......
...@@ -3136,7 +3136,8 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -3136,7 +3136,8 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
} }
static struct notifier_block sbridge_mce_dec = { static struct notifier_block sbridge_mce_dec = {
.notifier_call = sbridge_mce_check_error, .notifier_call = sbridge_mce_check_error,
.priority = MCE_PRIO_EDAC,
}; };
/**************************************************************************** /****************************************************************************
......
...@@ -1007,7 +1007,8 @@ static int skx_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -1007,7 +1007,8 @@ static int skx_mce_check_error(struct notifier_block *nb, unsigned long val,
} }
static struct notifier_block skx_mce_dec = { static struct notifier_block skx_mce_dec = {
.notifier_call = skx_mce_check_error, .notifier_call = skx_mce_check_error,
.priority = MCE_PRIO_EDAC,
}; };
static void skx_remove(void) static void skx_remove(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册