Skip to content

Commit 925946c

Browse files
aeglsuryasaimadhu
authored andcommitted
x86/mce: Change default MCE logger to check mce->kflags
Instead of keeping count of how many handlers are registered on the MCE notifier chain and printing if below some magic value, look at mce->kflags to see if anyone claims to have handled/logged this error. [ bp: Do not print ->kflags in __print_mce(). ] Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Tested-by: Tony Luck <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 23ba710 commit 925946c

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,29 +158,17 @@ void mce_log(struct mce *m)
158158
}
159159
EXPORT_SYMBOL_GPL(mce_log);
160160

161-
/*
162-
* We run the default notifier if we have only the UC, the first and the
163-
* default notifier registered. I.e., the mandatory NUM_DEFAULT_NOTIFIERS
164-
* notifiers registered on the chain.
165-
*/
166-
#define NUM_DEFAULT_NOTIFIERS 3
167-
static atomic_t num_notifiers;
168-
169161
void mce_register_decode_chain(struct notifier_block *nb)
170162
{
171163
if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
172164
return;
173165

174-
atomic_inc(&num_notifiers);
175-
176166
blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
177167
}
178168
EXPORT_SYMBOL_GPL(mce_register_decode_chain);
179169

180170
void mce_unregister_decode_chain(struct notifier_block *nb)
181171
{
182-
atomic_dec(&num_notifiers);
183-
184172
blocking_notifier_chain_unregister(&x86_mce_decoder_chain, nb);
185173
}
186174
EXPORT_SYMBOL_GPL(mce_unregister_decode_chain);
@@ -263,6 +251,7 @@ static void __print_mce(struct mce *m)
263251
}
264252

265253
pr_cont("\n");
254+
266255
/*
267256
* Note this output is parsed by external tools and old fields
268257
* should not be changed.
@@ -602,10 +591,8 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val,
602591
if (!m)
603592
return NOTIFY_DONE;
604593

605-
if (atomic_read(&num_notifiers) > NUM_DEFAULT_NOTIFIERS)
606-
return NOTIFY_DONE;
607-
608-
__print_mce(m);
594+
if (!m->kflags)
595+
__print_mce(m);
609596

610597
return NOTIFY_DONE;
611598
}

0 commit comments

Comments
 (0)