Re: [PATCH 2/2] x86, MCE: Cleanup macro __get_cpu_var

From: H. Peter Anvin
Date: Mon Apr 14 2014 - 12:20:39 EST


On 04/14/2014 01:39 AM, Chen, Gong wrote:
> @@ -1287,14 +1287,14 @@ static unsigned long (*mce_adjust_timer)(unsigned long interval) =
>
> static int cmc_error_seen(void)
> {
> - unsigned long *v = &__get_cpu_var(mce_polled_error);
> + unsigned long *v = this_cpu_ptr(&mce_polled_error);
>
> - return test_and_clear_bit(0, v);
> + return this_cpu_xchg(*v, 0);
> }
>

Here you produce a pointer and *then* passing it through a this_cpu_
function... this is actively wrong.

It should simply be:

return this_cpu_xchg(mce_polled_error, 0);

-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/