RAS/CEC: Only count corrected DRAM errors on Intel
Subsystems (4)
PATCH 1/1 RAS/CEC: Only count corrected DRAM errors on Intel
cec_notifier() is meant to consume only correctable DRAM errors, as its comment says, but it relies on mce_is_memory_error() for that. On Intel and Zhaoxin, mce_is_memory_error() also accepts cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). That check was added in fa92c5869426 ("x86, mce:
Support memory error recovery for both UCNA and Deferred error in machine_check_poll") for uncorrected errors, where a cache error with a valid address can point at poisoned memory.
For corrected errors this does not hold. A corrected cache hierarchy error means a bit flipped in the cache and was fixed there. The reported address only names the line that happened to be cached. Counting these in the CEC makes it soft-offline healthy DRAM pages, and with the Intel action threshold of 2 from d25c6948a6aa ("RAS/CEC: Reduce offline page threshold for Intel systems"), two such errors on the same page are enough.
This was observed on an i9-9900K without ECC memory and with a faulty core. Bank 3 on CPU 1 reports thousands of corrected cache errors (MCACOD 0x0135, 0x0151, 0x0179, ...) with addresses spread over the whole physical address space. Within one hour the CEC made 502 soft-offline attempts on 159 distinct pages. 453 failed because the page was in kernel use, the others took healthy pages offline:
RAS: Soft-offlining pfn: 0x100250
mce: [Hardware Error]: TSC c43a09e330 ADDR 1002504c0 MISC 2514285 Memory failure: 0x100250: unhandlable page.
RAS: Soft-offlining pfn: 0x24f6c8
mce: [Hardware Error]: CPU 1: Machine Check: 0 Bank 3: cc5ffdc000100151
mce: [Hardware Error]: TSC 21903b589a2 ADDR 24f6c85c0 MISC 2516485
This affects any Intel system with CONFIG_RAS_CEC=y and a core that repeatedly reports corrected cache errors, with or without ECC memory:
healthy RAM is lost until reboot and HardwareCorrupted keeps growing, pages that cannot be offlined are retried over and over because the CEC drops the element after each attempt, and the messages point at failing DRAM while the defect is in the CPU.
AMD already restricts this to DRAM ECC errors since c6708d50f166 ("x86/MCE: Report only DRAM ECC as memory errors on AMD systems"). Do the equivalent for Intel and Zhaoxin, limited to the CEC.
Add a helper cec_is_dram_error() to drivers/ras/cec.c and use it in cec_notifier() instead of mce_is_memory_error(). On Intel and Zhaoxin it only accepts memory controller errors, i.e. MCACOD matching 000F 0000 1MMM CCCC, which is the first of the three checks in mce_is_memory_error(): (status & 0xef80) == BIT(7). For all other vendors it falls back to mce_is_memory_error(), so AMD and Hygon behave as before.
Corrected cache hierarchy errors are no longer counted by the CEC. cec_notifier() returns NOTIFY_DONE for them, so they still reach the default notifier and are logged as before. mce_is_memory_error() itself is left unchanged because other users, like the nfit driver, rely on it for uncorrected errors. The action threshold and the handling of uncorrected errors are not touched.
Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status 0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status 0x8c0000000000009f) is still counted and its page soft-offlined.
--- drivers/ras/cec.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/ras/cec.c +19 -1
@@ -531,6 +531,24 @@ static int __init create_debugfs_nodes(void)return 1 ; } +/* +* Only corrected errors reported by the memory controller say something about +* the health of a DRAM page. Corrected cache hierarchy errors originate in the +* cache itself, their address only names the line that happened to be cached. +*/ +static bool cec_is_dram_error (struct mce *m) +{ +switch (m->cpuvendor) { +case X86_VENDOR_INTEL : +case X86_VENDOR_ZHAOXIN : +/* Memory controller errors: MCACOD 000F 0000 1MMM CCCC */ +return (m->status &0xef80 ) ==BIT (7 ); + +default : +return mce_is_memory_error (m); + } +} +static int cec_notifier (struct notifier_block *nb,unsigned long val,void *data) {
@@ -540,7 +558,7 @@ static int cec_notifier(struct notifier_block *nb, unsigned long val,return NOTIFY_DONE ;/* We eat only correctable DRAM errors with usable addresses. */ -if (mce_is_memory_error (m) && +if (cec_is_dram_error (m) &&mce_is_correctable (m) &&mce_usable_address (m)) {if (!cec_add_elem (m->addr >>PAGE_SHIFT )) {
Signature · 1 line
2.55.0
Borislav Petkov
maintainerQuoted 8 lines · Adrian Schlegel
cec_notifier()is meant to consume only correctable DRAM errors, as its comment says, but it relies onmce_is_memory_error()for that. On Intel and Zhaoxin,mce_is_memory_error()also accepts cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). That check was added infa92c5869426("x86, mce:
Support memory error recovery for both UCNA and Deferred error inmachine_check_poll") for uncorrected errors, where a cache error with a valid address can point at poisoned memory.
Looking at what calls mce_is_memory_error(), it looks to me like it should exclude cache hierarchy errors but that's Tony's call.
Quoted 30 lines
For corrected errors this does not hold. A corrected cache hierarchy error means a bit flipped in the cache and was fixed there. The reported address only names the line that happened to be cached. Counting these in the CEC makes it soft-offline healthy DRAM pages, and with the Intel action threshold of 2 from
d25c6948a6aa("RAS/CEC: Reduce offline page threshold for Intel systems"), two such errors on the same page are enough.This was observed on an i9-9900K without ECC memory and with a faulty core. Bank 3 on CPU 1 reports thousands of corrected cache errors (MCACOD
0x0135,0x0151,0x0179, ...) with addresses spread over the whole physical address space. Within one hour the CEC made 502 soft-offline attempts on 159 distinct pages. 453 failed because the page was in kernel use, the others took healthy pages offline:RAS: Soft-offlining pfn:
0x100250
mce: [Hardware Error]: TSCc43a09e330ADDR1002504c0MISC 2514285 Memory failure:0x100250: unhandlable page.RAS: Soft-offlining pfn:
0x24f6c8
mce: [Hardware Error]: CPU 1: Machine Check: 0 Bank 3:cc5ffdc000100151
mce: [Hardware Error]: TSC21903b589a2ADDR24f6c85c0MISC 2516485This affects any Intel system with
CONFIG_RAS_CEC=yand a core that repeatedly reports corrected cache errors, with or without ECC memory:
healthy RAM is lost until reboot and HardwareCorrupted keeps growing, pages that cannot be offlined are retried over and over because the CEC drops the element after each attempt, and the messages point at failing DRAM while the defect is in the CPU.
Quoted 3 lines
AMD already restricts this to DRAM ECC errors since
c6708d50f166("x86/MCE: Report only DRAM ECC as memory errors on AMD systems"). Do the equivalent for Intel and Zhaoxin, limited to the CEC.
A note for the text from here onwards:
Please, do not talk about *what* the patch is doing in the commit message
- that should be obvious from the diff itself. Rather, concentrate on the *why* it needs to be done and why your patch exists.
It is perfectly fine to explain non-trivial aspects of the code the patch is touching but do not regurgitate what it does.
See also https://docs.kernel.org/process/submitting-patches.html for additional inspiration.
Quoted 15 lines
Add a helper
cec_is_dram_error()todrivers/ras/cec.cand use it incec_notifier()instead ofmce_is_memory_error(). On Intel and Zhaoxin it only accepts memory controller errors, i.e. MCACOD matching 000F 0000 1MMM CCCC, which is the first of the three checks inmce_is_memory_error(): (status &0xef80) == BIT(7). For all other vendors it falls back tomce_is_memory_error(), so AMD and Hygon behave as before.Corrected cache hierarchy errors are no longer counted by the CEC.
cec_notifier()returnsNOTIFY_DONEfor them, so they still reach the default notifier and are logged as before.mce_is_memory_error()itself is left unchanged because other users, like the nfit driver, rely on it for uncorrected errors. The action threshold and the handling of uncorrected errors are not touched.
Quoted 4 lines
Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status
0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status0x8c0000000000009f) is still counted and its page soft-offlined.
Testing notes come...
Quoted 3 lines
Fixes 011d82611172 ("RAS: Add a Corrected Errors Collector")Signed-off-by Adrian Schlegel <[email protected]>---
... under those three "---" of the patch so that they don't land in the commit message.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteLuck, Tony
maintainerQuoted 10 lines · Borislav Petkov
Quoted 8 lines · Adrian Schlegel
cec_notifier()is meant to consume only correctable DRAM errors, as its comment says, but it relies onmce_is_memory_error()for that. On Intel and Zhaoxin,mce_is_memory_error()also accepts cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). That check was added infa92c5869426("x86, mce:
Support memory error recovery for both UCNA and Deferred error inmachine_check_poll") for uncorrected errors, where a cache error with a valid address can point at poisoned memory.
Quoted 2 lines
Looking at what calls
mce_is_memory_error(), it looks to me like it should exclude cache hierarchy errors but that's Tony's call.
I did some GIT and mailing list archaeology on the origin of that code that counts cache errors as memory errors. There was a bunch of discussion, and four versions of the patch tweaking various bits, but the inclusion of cache errors was in the patches from v1 and neither I nor Boris ever questioned that part.
Twelve years later ... I still can't see why we didn't push back.
I agree that looking at all the callers of mce_is_memory_error() they all expect it to do what its name implies: just return true for memory errors.
So the right fix would be to nuke the BIT(8) and 0xc clauses and most of the multi-line comment.
-Tony
PATCH v2 1/1 x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelOn Intel and Zhaoxin, mce_is_memory_error() returns true not only for memory controller errors but also for cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). The cache hierarchy checks were added in commit fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll") for uncorrected errors. All callers of mce_is_memory_error() expect it to report memory errors only, as its name says.
This is wrong for corrected errors. A corrected cache hierarchy error means a bit flipped in the cache and was fixed there. The reported address only names the line that happened to be cached. The CEC still counts these as DRAM errors, and with the Intel action threshold of 2 from commit d25c6948a6aa ("RAS/CEC: Reduce offline page threshold for Intel systems"), two such errors on the same page are enough to soft-offline it.
This was observed on an i9-9900K without ECC memory and with a faulty core. Bank 3 on CPU 1 reports thousands of corrected cache errors (MCACOD 0x0135, 0x0151, 0x0179, ...) with addresses spread over the whole physical address space. Within one hour the CEC made 502 soft-offline attempts on 159 distinct pages. 453 failed because the page was in kernel use, the others took healthy pages offline:
RAS: Soft-offlining pfn: 0x24f6c8
mce: [Hardware Error]: CPU 1: Machine Check: 0 Bank 3: cc5ffdc000100151
mce: [Hardware Error]: TSC 21903b589a2 ADDR 24f6c85c0 MISC 2516485
As a result, healthy RAM is lost until reboot and HardwareCorrupted keeps growing. Pages that cannot be offlined are retried repeatedly, and the log messages suggest failing DRAM while the defect is in the CPU.
AMD already restricts this to DRAM ECC errors since commit c6708d50f166 ("x86/MCE: Report only DRAM ECC as memory errors on AMD systems"). Do the same for Intel and Zhaoxin.
---
v2:
- Fix mce_is_memory_error() itself instead of adding a CEC-local helper (Tony)
- v1: https://lore.kernel.org/r/[email protected]
Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status 0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status 0x8c0000000000009f) is still counted and its page soft-offlined.
arch/x86/kernel/cpu/mce/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/mce/core.c +4 -12
@@ -542,19 +542,11 @@ bool mce_is_memory_error(struct mce *m)/* * Intel SDM Volume 3B - 15.9.2 Compound Error Codes * -* Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for -* indicating a memory error. Bit 8 is used for indicating a -* cache hierarchy error. The combination of bit 2 and bit 3 -* is used for indicating a `generic' cache hierarchy error -* But we can't just blindly check the above bits, because if -* bit 11 is set, then it is a bus/interconnect error - and -* either way the above bits just gives more detail on what -* bus/interconnect error happened. Note that bit 12 can be -* ignored, as it's the "filter" bit. +* Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC: +* bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter" +* bit and is ignored. */ -return (m->status &0xef80 ) ==BIT (7 ) || - (m->status &0xef00 ) ==BIT (8 ) || - (m->status &0xeffc ) ==0xc ; +return (m->status &0xef80 ) ==BIT (7 );default :return false;
Signature · 1 line
2.55.0
Borislav Petkov
maintainerRe: [PATCH v2] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 2 lines · Adrian Schlegel
On Intel and Zhaoxin,
mce_is_memory_error()returns true not only for memory controller errors but also for cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). The cache hierarchy checks were added in commitfa92c5869426("x86, mce: Support memory error recovery for both UCNA and Deferred error inmachine_check_poll") for uncorrected errors. All callers ofmce_is_memory_error()expect it to report memory errors only, as its name says.
$ cat /tmp/new | ./scripts/checkpatch.pl
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#14:
On Intel and Zhaoxin, mce_is_memory_error() returns true not only for memory controller errors but also for cache hierarchy errors (MCACOD 000F 0001 RRRR TTLL) and generic cache hierarchy errors (000F 0000 0000 11LL). The cache hierarchy checks were added in commit fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll") for uncorrected errors. All callers of mce_is_memory_error() expect it to report memory errors only, as its name says.total: 0 errors, 1 warnings, 23 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
"[PATCH v2] x86/mce: Do not treat cache hierarchy errors as memory" has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
do a
git log arch/x86/kernel/cpu/mce/core.c
to get inspired about how patches should look like.
Also:
https://docs.kernel.org/process/submitting-patches.html
and
https://docs.kernel.org/process/maintainer-tip.html
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteLuck, Tony
maintainerRe: [PATCH v2] x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelOn Sun, Oct 04, 2026 at 12:20:12AM +0200, Adrian Schlegel wrote:
Boris pointed out the very long lines. I think you have more details than necessary to describe the reason for this change. Be concise when rewriting it.
Quoted 17 lines
Fixes fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll")Signed-off-by Adrian Schlegel <[email protected]>---
v2:
- Fixmce_is_memory_error()itself instead of adding a CEC-local helper (Tony)
- v1: https://lore.kernel.org/r/[email protected]Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status
0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status0x8c0000000000009f) is still counted and its page soft-offlined.arch/x86/kernel/cpu/mce/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)arch/x86/kernel/cpu/mce/core.c +0
-0
arch/x86/kernel/cpu/mce/core.c bool mce_is_memory_error(struct mce *m) · line 543
Quoted 2 lines
arch/x86/kernel/cpu/mce/core.c +0
-0@@ -542,19 +542,11 @@ bool mce_is_memory_error(struct mce *m)/* * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
Intel keeps adding new chapters and sections to the SDM. This is now 18.10.2. The split into volumes has remained stable.
Future proof this by just referring to the section name without the explicit section number. Should be a good enough pointer for someone to find the reference.
* Intel SDM Volume 3B "Compound Error Codes".
Quoted 8 lines
arch/x86/kernel/cpu/mce/core.c +0
-7* -* Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for -* indicating a memory error. Bit 8 is used for indicating a -* cache hierarchy error. The combination of bit 2 and bit 3 -* is used for indicating a `generic' cache hierarchy error -* But we can't just blindly check the above bits, because if -* bit 11 is set, then it is a bus/interconnect error - and -* either way the above bits just gives more detail on what
arch/x86/kernel/cpu/mce/core.c bool mce_is_memory_error(struct mce *m) · line 549
Quoted 10 lines
arch/x86/kernel/cpu/mce/core.c +4
-5-* bus/interconnect error happened. Note that bit 12 can be -* ignored, as it's the "filter" bit. +* Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC: +* bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter" +* bit and is ignored. */ -return (m->status &0xef80 ) ==BIT (7 ) || - (m->status &0xef00 ) ==BIT (8 ) || - (m->status &0xeffc ) ==0xc ; +return (m->status &0xef80 ) ==BIT (7 );
Otherwise update to comment and code looks good.
Quoted 5 lines
arch/x86/kernel/cpu/mce/core.c +0
-0default :return false;Signature · 1 line
2.55.0
-Tony
Quoted 1 line
PATCH v3 1/1 x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelOn Intel and Zhaoxin, mce_is_memory_error() also returns true for cache hierarchy errors. All callers expect it to report memory errors only.
The CEC uses it to count corrected DRAM errors. A corrected cache error only names the cache line that was affected, not a faulty DRAM page. With a faulty CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this caused about 500 soft-offline attempts per hour.
Report only memory controller errors on Intel and Zhaoxin, as is already done for AMD.
---
v3:
- Shorten and wrap commit message (Boris, Tony)
- Refer to the SDM section by name instead of number (Tony)
v2:
- Fix mce_is_memory_error() itself instead of adding a CEC-local helper (Tony)
- v1: https://lore.kernel.org/r/[email protected]
Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status 0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status 0x8c0000000000009f) is still counted and its page soft-offlined.
arch/x86/kernel/cpu/mce/core.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mce/core.c +5 -13
@@ -540,21 +540,13 @@ bool mce_is_memory_error(struct mce *m)case X86_VENDOR_INTEL :case X86_VENDOR_ZHAOXIN :/* -* Intel SDM Volume 3B - 15.9.2 Compound Error Codes +* Intel SDM Volume 3B "Compound Error Codes". * -* Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for -* indicating a memory error. Bit 8 is used for indicating a -* cache hierarchy error. The combination of bit 2 and bit 3 -* is used for indicating a `generic' cache hierarchy error -* But we can't just blindly check the above bits, because if -* bit 11 is set, then it is a bus/interconnect error - and -* either way the above bits just gives more detail on what -* bus/interconnect error happened. Note that bit 12 can be -* ignored, as it's the "filter" bit. +* Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC: +* bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter" +* bit and is ignored. */ -return (m->status &0xef80 ) ==BIT (7 ) || - (m->status &0xef00 ) ==BIT (8 ) || - (m->status &0xeffc ) ==0xc ; +return (m->status &0xef80 ) ==BIT (7 );default :return false;
Signature · 1 line
2.55.0
RE: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 8 lines
On Intel and Zhaoxin,
mce_is_memory_error()also returns true for cache hierarchy errors. All callers expect it to report memory errors only.The CEC uses it to count corrected DRAM errors. A corrected cache error only names the cache line that was affected, not a faulty DRAM page. With a faulty CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this caused about 500 soft-offline attempts per hour.
Quoted 5 lines
Report only memory controller errors on Intel and Zhaoxin, as is already done for AMD.
Fixes fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll")Signed-off-by Adrian Schlegel <[email protected]>
LGTM
-Tony
RE: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelQuoted 16 lines
From: Adrian Schlegel <[email protected]>
Sent: Tuesday, October 13, 2026 3:33 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Adrian Schlegel <[email protected]>
Subject: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errorsOn Intel and Zhaoxin,
mce_is_memory_error()also returns true for cache hierarchy errors. All callers expect it to report memory errors only.The CEC uses it to count corrected DRAM errors. A corrected cache error only names the cache line that was affected, not a faulty DRAM page. With a faulty CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this caused about 500 soft-offline attempts per hour.
Quoted 7 lines
Report only memory controller errors on Intel and Zhaoxin, as is already done for AMD.
Fixes fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA andDeferred error in
machine_check_poll")Signed-off-by Adrian Schlegel <[email protected]>---
LGTM,
Re: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelQuoted 49 lines · Adrian Schlegel
On Intel and Zhaoxin,
mce_is_memory_error()also returns true for cache hierarchy errors. All callers expect it to report memory errors only.The CEC uses it to count corrected DRAM errors. A corrected cache error only names the cache line that was affected, not a faulty DRAM page. With a faulty CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this caused about 500 soft-offline attempts per hour.
Report only memory controller errors on Intel and Zhaoxin, as is already done for AMD.
Fixes fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll")Signed-off-by Adrian Schlegel <[email protected]>---
v3:
- Shorten and wrap commit message (Boris, Tony)
- Refer to the SDM section by name instead of number (Tony)v2:
- Fixmce_is_memory_error()itself instead of adding a CEC-local helper (Tony)
- v1: https://lore.kernel.org/r/[email protected]Tested with mce-inject (sw) in a VM with an Intel CPU model. A corrected cache error (status
0xcc5ffc0000100179) is no longer counted and its page stays online. A corrected memory controller error (status0x8c0000000000009f) is still counted and its page soft-offlined.arch/x86/kernel/cpu/mce/core.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)arch/x86/kernel/cpu/mce/core.c +1
-9@@ -540,21 +540,13 @@ bool mce_is_memory_error(struct mce *m)case X86_VENDOR_INTEL :case X86_VENDOR_ZHAOXIN :/* -* Intel SDM Volume 3B - 15.9.2 Compound Error Codes +* Intel SDM Volume 3B "Compound Error Codes". * -* Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for -* indicating a memory error. Bit 8 is used for indicating a -* cache hierarchy error. The combination of bit 2 and bit 3 -* is used for indicating a `generic' cache hierarchy error -* But we can't just blindly check the above bits, because if -* bit 11 is set, then it is a bus/interconnect error - and -* either way the above bits just gives more detail on what -* bus/interconnect error happened. Note that bit 12 can be
arch/x86/kernel/cpu/mce/core.c bool mce_is_memory_error(struct mce *m) · line 550
Quoted 10 lines
arch/x86/kernel/cpu/mce/core.c +4
-4-* ignored, as it's the "filter" bit. +* Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC: +* bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter" +* bit and is ignored. */ -return (m->status &0xef80 ) ==BIT (7 ) || - (m->status &0xef00 ) ==BIT (8 ) || - (m->status &0xeffc ) ==0xc ; +return (m->status &0xef80 ) ==BIT (7 );
The SDM also mentions "Extended Memory Errors". I guess these were left out before, but should they be included?
Thanks,
Yazen
Re: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 2 lines · Yazen Ghannam
The SDM also mentions "Extended Memory Errors". I guess these were left out before, but should they be included?
I don't think so, since from what I can tell from the Intel SDM (Memory Controller and Extended Memory Errors), extended memory errors use the same encoding as normal memory errors, but report errors in memory that is used as a cache, similar to what cache hierarchy errors do.
I also found this thread, where Tony made the same point:
https://lore.kernel.org/all/SJ1PR11MB60831E048B544C83E845D907FC8DA@SJ1PR11MB6083.namprd11.prod.outlook.com/
Best,
Adrian
Yazen Ghannam
Reviewed-byRe: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 4 lines · Adrian Schlegel
Quoted 2 lines · Yazen Ghannam
The SDM also mentions "Extended Memory Errors". I guess these were left out before, but should they be included?
Quoted 8 lines
I don't think so, since from what I can tell from the Intel SDM (Memory Controller and Extended Memory Errors), extended memory errors use the same encoding as normal memory errors, but report errors in memory that is used as a cache, similar to what cache hierarchy errors do.
I also found this thread, where Tony made the same point:
https://lore.kernel.org/all/SJ1PR11MB60831E048B544C83E845D907FC8DA@SJ1PR11MB6083.namprd11.prod.outlook.com/
Ah okay, makes sense.
Thanks,
Yazen
Re: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelQuoted 9 lines · Adrian Schlegel
Quoted 2 lines · Yazen Ghannam
The SDM also mentions "Extended Memory Errors". I guess these were left out before, but should they be included?
I don't think so, since from what I can tell from the Intel SDM (Memory Controller and Extended Memory Errors), extended memory errors use the same encoding as normal memory errors, but report errors in memory that is used as a cache, similar to what cache hierarchy errors do.
Yeah, the mismatch between the code and SDM has been a little confusing. It might be worth adding a code comment or a changelog note about why Extended Memory errors are not part of the check.
Quoted 3 lines
I also found this thread, where Tony made the same point:
https://lore.kernel.org/all/SJ1PR11MB60831E048B544C83E845D907FC8DA@SJ1PR11MB6083.namprd11.prod.outlook.com/
Adrian just added me to this thread..
But, the TDX issue that Sashiko reported seems valid to me. It may only affect early TDX platforms. So, adding some TDX folks in case they care about this change.
https://sashiko.dev/#/patchset/20261012193305.38931-1-me%40adrianschlegel.com
Looking at the comment on top of tdx_dump_mce_info() and commit 70060463cb2b ("x86/mce: Differentiate real hardware #MCs from TDX erratum ones") could poison consumption be reported with a cache hierarchy code?
IIUC (based on the MCACOD_DATA example in the commit), the TDX error line will no longer be printed after this patch:
CPU 147: Machine Check Exception: f Bank 1: bd80000000100134 Machine check: Data load in unrecoverable area of kernel Machine Check: TDX private memory error. Possible kernel bug.
Luck, Tony
maintainerRE: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 4 lines
Looking at the comment on top of
tdx_dump_mce_info()and commit70060463cb2b("x86/mce: Differentiate real hardware #MCs from TDX erratum ones") could poison consumption be reported with a cache hierarchy code?
Yes. All recoverable poison consumption error codes are "Cache Hierarchy Error"s. with signature 000F 0001 RRRR TTLL. It's an uncorrected error, so the recovery code will offline the page.
BUT ...
Each should be accompanied by a "Memory Error" with signature 000F 0000 1MMM CCCC
in a different machine check bank (this report originates in the memory controller that detected the ECC issue).
This other report should be used to track uncorrected memory errors per-DIMM. Per-channel etc.
=Tony
Sohil Mehta
Reviewed-byRe: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Quoted 5 lines · Tony
Quoted 4 lines
Looking at the comment on top of
tdx_dump_mce_info()and commit70060463cb2b("x86/mce: Differentiate real hardware #MCs from TDX erratum ones") could poison consumption be reported with a cache hierarchy code?
Quoted 9 lines
Yes. All recoverable poison consumption error codes are "Cache Hierarchy Error"s. with signature 000F 0001 RRRR TTLL. It's an uncorrected error, so the recovery code will offline the page.
BUT ...
Each should be accompanied by a "Memory Error" with signature 000F 0000 1MMM CCCC
in a different machine check bank (this report originates in the memory controller that detected the ECC issue).
Okay makes sense. I am fine with the change in this patch now.
If needed, the TDX side can change tdx_dump_mce_info() in case the desired "TDX private memory error. Possible kernel bug." doesn't get displayed.
Quoted 6 lines
This other report should be used to track uncorrected memory errors per-DIMM. Per-channel etc.
=Tony
A message that is not in the archive (sent off-list or not yet received): CAN+_ncWbJh1iPzi+4tKdSguEo_SYj_4R3K=sNkG2_VT8TvkG5g@mail.gmail.com
Re: [PATCH v3] x86/mce: Do not treat cache hierarchy errors as memory errors
Hi Boris,
gentle ping on this one.
Thanks,
Adrian
[tip: x86/urgent] x86/mce: Do not treat cache hierarchy errors as memory errors
In reply to Adrian SchlegelThe following commit has been merged into the x86/urgent branch of tip:
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 29b74cf57f432d60da2b79c827f1379125409611 Gitweb: https://git.kernel.org/tip/29b74cf57f432d60da2b79c827f1379125409611 Author: Adrian Schlegel <[email protected]> AuthorDate: Mon, 12 Oct 2026 21:33:05 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Thu, 19 Nov 2026 21:58:07 -08:00
x86/mce: Do not treat cache hierarchy errors as memory errors
On Intel and Zhaoxin, mce_is_memory_error() also returns true for cache hierarchy errors. All callers expect it to report memory errors only.
The CEC uses it to count corrected DRAM errors. A corrected cache error only names the cache line that was affected, not a faulty DRAM page. With a faulty CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this caused about 500 soft-offline attempts per hour.
Report only memory controller errors on Intel and Zhaoxin, as is already done for AMD.
--- arch/x86/kernel/cpu/mce/core.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mce/core.c +5 -13
@@ -540,21 +540,13 @@ bool mce_is_memory_error(struct mce *m)case X86_VENDOR_INTEL :case X86_VENDOR_ZHAOXIN :/* -* Intel SDM Volume 3B - 15.9.2 Compound Error Codes +* Intel SDM Volume 3B "Compound Error Codes". * -* Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for -* indicating a memory error. Bit 8 is used for indicating a -* cache hierarchy error. The combination of bit 2 and bit 3 -* is used for indicating a `generic' cache hierarchy error -* But we can't just blindly check the above bits, because if -* bit 11 is set, then it is a bus/interconnect error - and -* either way the above bits just gives more detail on what -* bus/interconnect error happened. Note that bit 12 can be -* ignored, as it's the "filter" bit. +* Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC: +* bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter" +* bit and is ignored. */ -return (m->status &0xef80 ) ==BIT (7 ) || - (m->status &0xef00 ) ==BIT (8 ) || - (m->status &0xeffc ) ==0xc ; +return (m->status &0xef80 ) ==BIT (7 );default :return false;