Skip to content

Commit 717b489

Browse files
yghannamgregkh
authored andcommitted
x86/mce/AMD: Get address from already initialized block
commit 27bd595 upstream. The block address is saved after the block is initialized when threshold_init_device() is called. Use the saved block address, if available, rather than trying to rediscover it. This will avoid a call trace, when resuming from suspend, due to the rdmsr_safe_on_cpu() call in get_block_address(). The rdmsr_safe_on_cpu() call issues an IPI but we're running with interrupts disabled. This triggers: WARNING: CPU: 0 PID: 11523 at kernel/smp.c:291 smp_call_function_single+0xdc/0xe0 Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: <[email protected]> # 4.14.x Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: linux-edac <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ab0ed34 commit 717b489

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/x86/kernel/cpu/mcheck/mce_amd.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,21 @@ static u32 get_block_address(unsigned int cpu, u32 current_addr, u32 low, u32 hi
416416
{
417417
u32 addr = 0, offset = 0;
418418

419+
if ((bank >= mca_cfg.banks) || (block >= NR_BLOCKS))
420+
return addr;
421+
422+
/* Get address from already initialized block. */
423+
if (per_cpu(threshold_banks, cpu)) {
424+
struct threshold_bank *bankp = per_cpu(threshold_banks, cpu)[bank];
425+
426+
if (bankp && bankp->blocks) {
427+
struct threshold_block *blockp = &bankp->blocks[block];
428+
429+
if (blockp)
430+
return blockp->address;
431+
}
432+
}
433+
419434
if (mce_flags.smca) {
420435
if (!block) {
421436
addr = MSR_AMD64_SMCA_MCx_MISC(bank);

0 commit comments

Comments
 (0)