Skip to content

Commit 7f53b02

Browse files
committed
x86/mce/amd: Fix threshold limit reset
JIRA: https://issues.redhat.com/browse/RHEL-118444 commit 5f6e3b7 Author: Yazen Ghannam <yazen.ghannam@amd.com> Date: Tue Jun 24 14:15:59 2025 +0000 x86/mce/amd: Fix threshold limit reset The MCA threshold limit must be reset after servicing the interrupt. Currently, the restart function doesn't have an explicit check for this. It makes some assumptions based on the current limit and what's in the registers. These assumptions don't always hold, so the limit won't be reset in some cases. Make the reset condition explicit. Either an interrupt/overflow has occurred or the bank is being initialized. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/20250624-wip-mca-updates-v4-4-236dd74f645f@amd.com Signed-off-by: David Arcari <darcari@redhat.com>
1 parent c86abc5 commit 7f53b02

File tree

1 file changed

+7
-8
lines changed
  • arch/x86/kernel/cpu/mce

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ static void smca_configure(unsigned int bank, unsigned int cpu)
350350

351351
struct thresh_restart {
352352
struct threshold_block *b;
353-
int reset;
354353
int set_lvt_off;
355354
int lvt_off;
356355
u16 old_limit;
@@ -432,13 +431,13 @@ static void threshold_restart_bank(void *_tr)
432431

433432
rdmsr(tr->b->address, lo, hi);
434433

435-
if (tr->b->threshold_limit < (hi & THRESHOLD_MAX))
436-
tr->reset = 1; /* limit cannot be lower than err count */
437-
438-
if (tr->reset) { /* reset err count and overflow bit */
439-
hi =
440-
(hi & ~(MASK_ERR_COUNT_HI | MASK_OVERFLOW_HI)) |
441-
(THRESHOLD_MAX - tr->b->threshold_limit);
434+
/*
435+
* Reset error count and overflow bit.
436+
* This is done during init or after handling an interrupt.
437+
*/
438+
if (hi & MASK_OVERFLOW_HI || tr->set_lvt_off) {
439+
hi &= ~(MASK_ERR_COUNT_HI | MASK_OVERFLOW_HI);
440+
hi |= THRESHOLD_MAX - tr->b->threshold_limit;
442441
} else if (tr->old_limit) { /* change limit w/o reset */
443442
int new_count = (hi & THRESHOLD_MAX) +
444443
(tr->old_limit - tr->b->threshold_limit);

0 commit comments

Comments
 (0)