@@ -90,7 +90,6 @@ struct mca_config mca_cfg __read_mostly = {
9090};
9191
9292static DEFINE_PER_CPU (struct mce_hw_err , hw_errs_seen ) ;
93- static unsigned long mce_need_notify ;
9493
9594/*
9695 * MCA banks polled by the period polling timer for corrected events.
@@ -152,8 +151,10 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
152151
153152void mce_log (struct mce_hw_err * err )
154153{
155- if (mce_gen_pool_add (err ))
154+ if (mce_gen_pool_add (err )) {
155+ pr_info (HW_ERR "Machine check events logged\n" );
156156 irq_work_queue (& mce_irq_work );
157+ }
157158}
158159EXPORT_SYMBOL_GPL (mce_log );
159160
@@ -585,28 +586,6 @@ bool mce_is_correctable(struct mce *m)
585586}
586587EXPORT_SYMBOL_GPL (mce_is_correctable );
587588
588- /*
589- * Notify the user(s) about new machine check events.
590- * Can be called from interrupt context, but not from machine check/NMI
591- * context.
592- */
593- static bool mce_notify_irq (void )
594- {
595- /* Not more than two messages every minute */
596- static DEFINE_RATELIMIT_STATE (ratelimit , 60 * HZ , 2 );
597-
598- if (test_and_clear_bit (0 , & mce_need_notify )) {
599- mce_work_trigger ();
600-
601- if (__ratelimit (& ratelimit ))
602- pr_info (HW_ERR "Machine check events logged\n" );
603-
604- return true;
605- }
606-
607- return false;
608- }
609-
610589static int mce_early_notifier (struct notifier_block * nb , unsigned long val ,
611590 void * data )
612591{
@@ -618,9 +597,7 @@ static int mce_early_notifier(struct notifier_block *nb, unsigned long val,
618597 /* Emit the trace record: */
619598 trace_mce_record (err );
620599
621- set_bit (0 , & mce_need_notify );
622-
623- mce_notify_irq ();
600+ mce_work_trigger ();
624601
625602 return NOTIFY_DONE ;
626603}
@@ -1804,7 +1781,7 @@ static void mce_timer_fn(struct timer_list *t)
18041781 * Alert userspace if needed. If we logged an MCE, reduce the polling
18051782 * interval, otherwise increase the polling interval.
18061783 */
1807- if (mce_notify_irq ())
1784+ if (! mce_gen_pool_empty ())
18081785 iv = max (iv / 2 , (unsigned long ) HZ /100 );
18091786 else
18101787 iv = min (iv * 2 , round_jiffies_relative (check_interval * HZ ));
0 commit comments