Messages in this thread Patch in this message | | | From | Jan H. Schönherr <> | Subject | [PATCH v2 4/6] x86/mce: Allow a variable number of internal MCE decode notifiers | Date | Fri, 3 Jan 2020 16:07:20 +0100 |
| |
Get rid of the compile time constant of internal (or mandatory) MCE decode notifiers in preparation for future changes. Instead, distinguish explicitly between internal and external MCE decode notifiers.
Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> --- New in v2, preparation for patches 5 and 6. --- arch/x86/kernel/cpu/mce/core.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 1d91ce956772..d48deb127071 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -157,21 +157,24 @@ void mce_log(struct mce *m) EXPORT_SYMBOL_GPL(mce_log); /* - * We run the default notifier if we have only the UC, the first and the - * default notifier registered. I.e., the mandatory NUM_DEFAULT_NOTIFIERS + * We run the default notifier as long as we have no external * notifiers registered on the chain. */ -#define NUM_DEFAULT_NOTIFIERS 3 static atomic_t num_notifiers; -void mce_register_decode_chain(struct notifier_block *nb) +static void mce_register_decode_chain_internal(struct notifier_block *nb) { if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC)) return; + blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); +} + +void mce_register_decode_chain(struct notifier_block *nb) +{ atomic_inc(&num_notifiers); - blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); + mce_register_decode_chain_internal(nb); } EXPORT_SYMBOL_GPL(mce_register_decode_chain); @@ -611,7 +614,7 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val, if (!m) return NOTIFY_DONE; - if (atomic_read(&num_notifiers) > NUM_DEFAULT_NOTIFIERS) + if (atomic_read(&num_notifiers)) return NOTIFY_DONE; __print_mce(m); @@ -1966,9 +1969,9 @@ __setup("mce", mcheck_enable); int __init mcheck_init(void) { mcheck_intel_therm_init(); - mce_register_decode_chain(&first_nb); - mce_register_decode_chain(&mce_uc_nb); - mce_register_decode_chain(&mce_default_nb); + mce_register_decode_chain_internal(&first_nb); + mce_register_decode_chain_internal(&mce_uc_nb); + mce_register_decode_chain_internal(&mce_default_nb); mcheck_vendor_init_severity(); INIT_WORK(&mce_work, mce_gen_pool_process); -- 2.22.0.3.gb49bb57c8208.dirty
| |