Re: [PATCH v7 111/120] x86/percpu: Add offset argument to x86_this_cpu_test_bit()

Maciej Wieczor-Retman <[email protected]> Mon, 1 Jun 2026 20:07:58 +0200
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 2026-05-28 at 17:39:13 +0200, Ahmed S. Darwish wrote:
>x86_this_cpu_test_bit() assumes that the queried bitmap starts at the base
>address of the percpu object.  For X86_FEATURE bitops, this matches the
>current cpuinfo_x86::x86_capability[] layout.
>
>Upcoming changes though will route all X86_FEATURE queries to the CPUID
>tables, where the bitmap resides at the per-CPU CPUID table plus an offset.
>
>Add an offset argument to x86_this_cpu_test_bit().
>
>Signed-off-by: Ahmed S. Darwish <[email protected]>
>---
> arch/x86/include/asm/cpufeature.h |  2 +-
> arch/x86/include/asm/percpu.h     | 34 ++++++++++++++++++-------------
> 2 files changed, 21 insertions(+), 15 deletions(-)
>
>diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
>index 520949560138..b12bde4986b5 100644
>--- a/arch/x86/include/asm/cpufeature.h
>+++ b/arch/x86/include/asm/cpufeature.h
>@@ -56,7 +56,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
> 
> #define this_cpu_has(bit)						\
> 	(__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 :	\
>-	 x86_this_cpu_test_bit(bit, cpu_info.x86_capability))
>+	 x86_this_cpu_test_bit(bit, cpu_info.x86_capability, 0))

I think the same change needs to be applied in the same arch/um directory since
it has a matching this_cpu_has() implementation and it uses x86's percpu.h.

-- 
Kind regards
Maciej Wieczór-Retman