Re: [PATCH 4/6] x86-mce: Add spinlocks to prevent duplicated MCP and CMCI reports.
From: Havard Skinnemoen
Date: Thu Jul 10 2014 - 14:03:51 EST
On Thu, Jul 10, 2014 at 9:41 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Wed, Jul 09, 2014 at 10:09:24AM -0700, Havard Skinnemoen wrote:
>> @@ -617,14 +620,28 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
>>
>> this_cpu_write(mce_polled_error, 1);
>> /*
>> + * Optimize for the common case where no MCEs are found.
>> + */
>> + spin_lock_irqsave(&mce_banks[i].poll_spinlock, irq_flags);
>
> This is pretty heavy - we're disabling interrupts for *every* bank and
> with shorter polling intervals, this could become problematic fast.
The lock is only taken if there are actual MCEs to be handled. The
following check is left in place above this:
m.status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i));
if (!(m.status & MCI_STATUS_VAL))
continue;
But yeah, if there are lots of errors happening, it might get expensive.
> What's wrong with doing this with cheap atomic_inc/dec_and_test?
For non-shared banks, we might risk some CPUs not being able to poll
their banks in a long time if they happen to be more or less
synchronized with a different CPU. This will also get worse with
shorter polling intervals, and with larger numbers of CPUs.
Havard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/