[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZByT1x+WFBU0jjRb@agluck-desk3.sc.intel.com>
Date: Thu, 23 Mar 2023 11:00:55 -0700
From: Tony Luck <tony.luck@...el.com>
To: Yazen Ghannam <yazen.ghannam@....com>
Cc: Borislav Petkov <bp@...en8.de>,
Smita.KoralahalliChannabasappa@....com,
dave.hansen@...ux.intel.com, hpa@...or.com,
linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v3 3/5] x86/mce: Introduce mce_handle_storm() to deal
with begin/end of storms
On Thu, Mar 23, 2023 at 11:22:22AM -0400, Yazen Ghannam wrote:
> On Fri, Mar 17, 2023 at 10:20:40AM -0700, Tony Luck wrote:
> > +void mce_intel_handle_storm(int bank, bool on)
> > +{
> > + if (on)
> > + cmci_set_threshold(bank, cmci_threshold[bank]);
> > + else
> > + cmci_set_threshold(bank, CMCI_STORM_THRESHOLD);
>
> I think these conditions are reversed. When storm handling is 'on' we should
> use CMCI_STORM_THRESHOLD, and when off use the saved bank threshold.
>
> > +}
> > +
> > static void cmci_storm_begin(int bank)
> > {
> > __set_bit(bank, this_cpu_ptr(mce_poll_banks));
> > @@ -211,13 +219,13 @@ void track_cmci_storm(int bank, u64 status)
> > if (history & GENMASK_ULL(STORM_END_POLL_THRESHOLD - 1, 0))
> > return;
> > pr_notice("CPU%d BANK%d CMCI storm subsided\n", smp_processor_id(), bank);
> > - cmci_set_threshold(bank, cmci_threshold[bank]);
> > + mce_handle_storm(bank, true);
>
> Should be 'false' when the storm subsides.
>
> > cmci_storm_end(bank);
> > } else {
> > if (hweight64(history) < STORM_BEGIN_THRESHOLD)
> > return;
> > pr_notice("CPU%d BANK%d CMCI storm detected\n", smp_processor_id(), bank);
> > - cmci_set_threshold(bank, CMCI_STORM_THRESHOLD);
> > + mce_handle_storm(bank, false);
>
> Should be 'true' when the storm starts.
>
> > cmci_storm_begin(bank);
> > }
> > }
There's a saying that two wrongs do not make a right (but three lefts do).
My code was working, but only because the second mistake cancelled
out the first.
Changing them both as you suggest (diff below) and the code still
works, and makes sense too!
Thanks
-Tony
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 74b560476424..c3e1bb790680 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -677,13 +677,13 @@ void track_cmci_storm(int bank, u64 status)
if (history & GENMASK_ULL(STORM_END_POLL_THRESHOLD - 1, 0))
return;
pr_notice("CPU%d BANK%d CMCI storm subsided\n", smp_processor_id(), bank);
- mce_handle_storm(bank, true);
+ mce_handle_storm(bank, false);
cmci_storm_end(bank);
} else {
if (hweight64(history) < STORM_BEGIN_THRESHOLD)
return;
pr_notice("CPU%d BANK%d CMCI storm detected\n", smp_processor_id(), bank);
- mce_handle_storm(bank, false);
+ mce_handle_storm(bank, true);
cmci_storm_begin(bank);
}
}
diff --git a/arch/x86/kernel/cpu/mce/intel.c b/arch/x86/kernel/cpu/mce/intel.c
index 6cc9aa97c092..20c2143a68c1 100644
--- a/arch/x86/kernel/cpu/mce/intel.c
+++ b/arch/x86/kernel/cpu/mce/intel.c
@@ -134,9 +134,9 @@ static void cmci_set_threshold(int bank, int thresh)
void mce_intel_handle_storm(int bank, bool on)
{
if (on)
- cmci_set_threshold(bank, cmci_threshold[bank]);
- else
cmci_set_threshold(bank, CMCI_STORM_THRESHOLD);
+ else
+ cmci_set_threshold(bank, cmci_threshold[bank]);
}
/*
Powered by blists - more mailing lists