Re: [PATCH v2] x86/mce/AMD: Use saved threshold block info in interrupt handler

From: Borislav Petkov
Date: Thu Jun 01 2017 - 13:50:12 EST


On Wed, May 31, 2017 at 09:11:55AM -0500, Yazen Ghannam wrote:
> From: Yazen Ghannam <yazen.ghannam@xxxxxxx>
>
> In the amd_threshold_interrupt() handler, we loop through every possible
> block in each bank and rediscover the block's address and if it's valid,
> e.g. valid, counter present and not locked. However, we already have the
> address saved in the threshold blocks list for each CPU and bank. The list
> only contains blocks that have passed all the valid checks.
>
> Besides the redundancy, there's also a smp_call_function* in
> get_block_address() and this causes a warning when servicing the interrupt.
>
> WARNING: CPU: 0 PID: 0 at kernel/smp.c:281 smp_call_function_single+0xdd/0xf0
> ...
> Call Trace:
> <IRQ>
> rdmsr_safe_on_cpu+0x5d/0x90
> get_block_address.isra.2+0x97/0x100
> amd_threshold_interrupt+0xae/0x220
> smp_threshold_interrupt+0x1b/0x40
> threshold_interrupt+0x89/0x90
>
> Drop the redundant valid checks and move the overflow check, logging and
> block reset into a separate function.
>
> Check the first block then iterate over the rest. This procedure is needed
> since the first block is used as the head of the list.
>
> Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
> ---
> Link:
> https://lkml.kernel.org/r/1495658507-7413-3-git-send-email-Yazen.Ghannam@xxxxxxx
>
> Link for patch 2:
> https://lkml.kernel.org/r/1495658507-7413-2-git-send-email-Yazen.Ghannam@xxxxxxx
>
> v1->v2:
> * Drop patch 2 from the first set.
> * Rather than iterating through all blocks in the list, check the first
> and iterate over the rest. This way we don't need to have an external
> list_head.
>
> arch/x86/kernel/cpu/mcheck/mce_amd.c | 64 ++++++++++++++++++++----------------
> 1 file changed, 35 insertions(+), 29 deletions(-)

Much better!

Applied, thanks.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.