From: Tony Luck <tony.luck@intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>, Breno Leitao <leitao@debian.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@lists.linux.dev,
Tony Luck <tony.luck@intel.com>,
Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Subject: [PATCH 7/7] platform/x86/intel/bff: Report frequent filter resets
Date: Tue, 25 Aug 2026 11:15:26 -0700 [thread overview]
Message-ID: <20260825181526.13203-8-tony.luck@intel.com> (raw)
In-Reply-To: <20260825181526.13203-1-tony.luck@intel.com>
If an instance of a bitfix filter contains some transient errors built
up over time, then resetting the filter will free up slots in the filter
to store persistent errors.
Save a time stamp when "yellow" status is seen and clear the filter.
Log at KERN_WARNING level if the overflow occurred quickly after a
previous overflow on the same bitfix filter instance. Use KERN_NOTICE
for first, or long delayed, overflow.
Co-developed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
drivers/platform/x86/intel/bff.c | 71 +++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel/bff.c b/drivers/platform/x86/intel/bff.c
index ae9dc0bf2777..7c22a1ad6b9d 100644
--- a/drivers/platform/x86/intel/bff.c
+++ b/drivers/platform/x86/intel/bff.c
@@ -23,14 +23,19 @@
#include <linux/cpufeature.h>
#include <linux/cpuhplock.h>
#include <linux/device-id/x86_cpu.h>
+#include <linux/err.h>
#include <linux/errno.h>
+#include <linux/gfp_types.h>
#include <linux/init.h>
+#include <linux/jiffies.h>
#include <linux/limits.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/printk.h>
+#include <linux/slab.h>
#include <linux/topology.h>
#include <linux/types.h>
+#include <linux/xarray.h>
#include <asm/cpu_device_id.h>
#include <asm/cpufeatures.h>
@@ -39,6 +44,16 @@
#include <asm/msr.h>
#include <asm/msr-index.h>
+/*
+ * A 10-minute observation period helps distinguish between:
+ *
+ * - A long-term accumulation of transient corrected errors
+ * (filter stays clear after reset).
+ *
+ * - Permanent defects (filter overflows again quickly).
+ */
+#define BFF_OVERFLOW_INTERVAL secs_to_jiffies(10 * 60)
+
#define NUM_IMH_PER_SKT 2
/* Intel bitfix filter control register defines */
@@ -74,6 +89,8 @@ MODULE_DEVICE_TABLE(x86cpu, bff_cpu_ids);
static const enum bff_type *bank_types;
+static DEFINE_XARRAY(bff_bank_xa);
+
/* Diamond Rapids maps APICID[2] to the IMH instance. */
static void bff_set_imh_id(struct mce *mce, unsigned long *id)
{
@@ -139,13 +156,58 @@ static unsigned long get_bff_id(struct mce *mce)
return id;
}
+/*
+ * Save current timestamp for bff_id. Return true if it is within
+ * BFF_OVERFLOW_INTERVAL of previous timestamp for this bff_id.
+ */
+static bool bff_note_event_and_check_burst(unsigned long bff_id)
+{
+ unsigned long now = jiffies, when;
+ unsigned long *ts;
+
+ if (bff_id == ULONG_MAX)
+ return false;
+
+ ts = xa_load(&bff_bank_xa, bff_id);
+ if (!ts) {
+ ts = kzalloc_obj(*ts);
+ if (!ts) {
+ pr_warn("Timestamp allocation failed\n");
+ return false;
+ }
+ if (IS_ERR(xa_store(&bff_bank_xa, bff_id, ts, GFP_KERNEL))) {
+ kfree(ts);
+ pr_warn("Timestamp save failure\n");
+ return false;
+ }
+ *ts = now;
+
+ return false;
+ }
+
+ when = *ts + BFF_OVERFLOW_INTERVAL;
+ *ts = now;
+
+ return time_before(now, when);
+}
+
static void handle_bff(struct mce *mce)
{
+ bool burst = false;
+
/* The bitfix filter overflowed, get the target CPU to reset it. */
if (wrmsrq_on_cpu(mce->extcpu, MSR_MCx_BFF_CTL(mce->bank), MCI_BFF_RESET))
pr_warn("Failed to reset bitfix filter for CPU %d Bank %d\n", mce->extcpu, mce->bank);
- pr_debug("unique_id = 0x%lx\n", get_bff_id(mce));
+ /* Get unique id for bitfix filter instance that overflowed */
+ burst = bff_note_event_and_check_burst(get_bff_id(mce));
+
+ if (burst)
+ pr_warn_ratelimited(HW_ERR "Socket %d CPU %d Bank %d bitfix filter overflowed frequently\n",
+ mce->socketid, mce->extcpu, mce->bank);
+ else
+ pr_notice_ratelimited(HW_ERR "Socket %d CPU %d Bank %d bitfix filter overflowed\n",
+ mce->socketid, mce->extcpu, mce->bank);
}
static int bff_mce_notify(struct notifier_block *nb, unsigned long val, void *data)
@@ -205,7 +267,14 @@ static int __init bff_init(void)
static void __exit bff_exit(void)
{
+ unsigned long bff_id;
+ unsigned long *ts;
+
mce_unregister_decode_chain(&bff_notifier);
+
+ xa_for_each(&bff_bank_xa, bff_id, ts)
+ kfree(ts);
+ xa_destroy(&bff_bank_xa);
}
module_init(bff_init);
--
2.55.0
next prev parent reply other threads:[~2026-08-25 18:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 18:15 [PATCH 0/7] Intel platform driver to reset bitfix filters Tony Luck
2026-08-25 18:15 ` [PATCH 1/7] cacheinfo: Export get_cpu_cacheinfo_id() for loadable modules Tony Luck
2026-08-25 18:15 ` [PATCH 2/7] x86/mce: Enumeration updates for Intel bitfix filter reset Tony Luck
2026-08-26 8:15 ` Ilpo Järvinen
2026-08-25 18:15 ` [PATCH 3/7] platform/x86/intel/bff: Add stub Intel bitfix filter driver Tony Luck
2026-08-25 18:15 ` [PATCH 4/7] platform/x86/intel/bff: Add Diamond Rapids support Tony Luck
2026-08-26 8:17 ` Ilpo Järvinen
2026-08-25 18:15 ` [PATCH 5/7] platform/x86/intel/bff: Reset bitfix filter when it overflows Tony Luck
2026-08-25 18:15 ` [PATCH 6/7] platform/x86/intel/bff: Compute unique ID for overflowed filter Tony Luck
2026-08-26 8:26 ` Ilpo Järvinen
2026-08-25 18:15 ` Tony Luck [this message]
2026-08-26 8:39 ` [PATCH 7/7] platform/x86/intel/bff: Report frequent filter resets Ilpo Järvinen
2026-08-25 18:28 ` [PATCH 0/7] Intel platform driver to reset bitfix filters Borislav Petkov
2026-08-25 18:55 ` Luck, Tony
2026-08-25 19:23 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260825181526.13203-8-tony.luck@intel.com \
--to=tony.luck@intel.com \
--cc=bp@alien8.de \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qiuxu.zhuo@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox