Re: [PATCH] x86/percpu: Fix and improve x86_this_cpu_test_bit() and friends

From: Ingo Molnar
Date: Thu Apr 04 2024 - 04:48:49 EST



* Uros Bizjak <ubizjak@xxxxxxxxx> wrote:

> Fix x86_this_cpu_variable_test_bit(), which is implemented with
> wrong asm template, where argument 2 (count argument) is considered
> as percpu variable. However, x86_this_cpu_test_bit() is currently
> used exclusively with constant bit number argument, so the called
> x86_this_cpu_variable_test_bit() function is never instantiated.
> The fix introduces named assembler operands to prevent this kind
> of errors.
>
> Also rewrite the whole family of x86_this_cpu_test_bit() functions
> as macros, so standard __my_cpu_var() and raw_cpu_read() macros
> can be used on percpu variables. This approach considerably
> simplifies implementation of functions and also introduces standard
> checks on accessed percpu variables.
>
> No functional changes intended.

Could you please split this into at least two patches?

Hint: 'also' in a changelog paragraph is an indicator of a new patch
being justified, in like 80% of the cases. :-)

Thanks,

Ingo