Re: [tip:x86/urgent] x86, CMCI: Add proper detection of end of CMCI storms
From: H. Peter Anvin
Date: Fri Apr 11 2014 - 13:02:00 EST
On 04/02/2014 12:55 AM, tip-bot for Chen, Gong wrote:
> @@ -614,6 +618,8 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
> if (!(m.status & MCI_STATUS_VAL))
> continue;
>
> + v = &get_cpu_var(mce_polled_error);
> + set_bit(0, v);
> /*
> * Uncorrected or signalled events are handled by the exception
> * handler when it is enabled, so don't process those here.
> @@ -1278,10 +1284,18 @@ static unsigned long mce_adjust_timer_default(unsigned long interval)
> static unsigned long (*mce_adjust_timer)(unsigned long interval) =
> mce_adjust_timer_default;
>
> +static int cmc_error_seen(void)
> +{
> + unsigned long *v = &__get_cpu_var(mce_polled_error);
> +
> + return test_and_clear_bit(0, v);
> +}
> +
Please use this_cpu_*() whereever possible instead of __get_cpu_var().
Since this is not actually a bitmask this_cpu_xchg() can be used at the end.
In fact, using set_bit() is completely wasteful.
I'll push this onward since it is a bit late, but please submit a
cleanup patch.
-hpa
--
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/