Skip to content

Commit 3206b41

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce/amd: Remove redundant reset_block()
Many of the checks in reset_block() are done again in the block reset function. So drop the redundant checks. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20251104-wip-mca-updates-v8-0-66c8eacf67b9@amd.com
1 parent 4efaec6 commit 3206b41

1 file changed

Lines changed: 7 additions & 21 deletions

File tree

  • arch/x86/kernel/cpu/mce

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -812,29 +812,11 @@ static void amd_deferred_error_interrupt(void)
812812
machine_check_poll(MCP_TIMESTAMP, &this_cpu_ptr(&mce_amd_data)->dfr_intr_banks);
813813
}
814814

815-
static void reset_block(struct threshold_block *block)
816-
{
817-
struct thresh_restart tr;
818-
u32 low = 0, high = 0;
819-
820-
if (!block)
821-
return;
822-
823-
if (rdmsr_safe(block->address, &low, &high))
824-
return;
825-
826-
if (!(high & MASK_OVERFLOW_HI))
827-
return;
828-
829-
memset(&tr, 0, sizeof(tr));
830-
tr.b = block;
831-
threshold_restart_block(&tr);
832-
}
833-
834815
static void amd_reset_thr_limit(unsigned int bank)
835816
{
836817
struct threshold_bank **bp = this_cpu_read(threshold_banks);
837818
struct threshold_block *block, *tmp;
819+
struct thresh_restart tr;
838820

839821
/*
840822
* Validate that the threshold bank has been initialized already. The
@@ -844,8 +826,12 @@ static void amd_reset_thr_limit(unsigned int bank)
844826
if (!bp || !bp[bank])
845827
return;
846828

847-
list_for_each_entry_safe(block, tmp, &bp[bank]->miscj, miscj)
848-
reset_block(block);
829+
memset(&tr, 0, sizeof(tr));
830+
831+
list_for_each_entry_safe(block, tmp, &bp[bank]->miscj, miscj) {
832+
tr.b = block;
833+
threshold_restart_block(&tr);
834+
}
849835
}
850836

851837
/*

0 commit comments

Comments
 (0)