[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFULd4aZYEi02cKeS1RAL66Qs149nLys8SJfTvfHuPH3FMXJeA@mail.gmail.com>
Date: Wed, 27 Aug 2025 09:53:17 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linux-tip-commits@...r.kernel.org, "Borislav Petkov (AMD)" <bp@...en8.de>, x86@...nel.org
Subject: Re: [tip: x86/asm] x86/vdso: Fix output operand size of RDPID
On Wed, Aug 27, 2025 at 8:45 AM tip-bot2 for Uros Bizjak
<tip-bot2@...utronix.de> wrote:
>
> The following commit has been merged into the x86/asm branch of tip:
>
> Commit-ID: ac9c408ed19d535289ca59200dd6a44a6a2d6036
> Gitweb: https://git.kernel.org/tip/ac9c408ed19d535289ca59200dd6a44a6a2d6036
> Author: Uros Bizjak <ubizjak@...il.com>
> AuthorDate: Mon, 16 Jun 2025 11:52:57 +02:00
> Committer: Borislav Petkov (AMD) <bp@...en8.de>
> CommitterDate: Tue, 26 Aug 2025 19:33:19 +02:00
>
> x86/vdso: Fix output operand size of RDPID
>
> RDPID instruction outputs to a word-sized register (64-bit on x86_64 and
> 32-bit on x86_32). Use an unsigned long variable to store the correct size.
>
> LSL outputs to 32-bit register, use %k operand prefix to always print the
> 32-bit name of the register.
>
> Use RDPID insn mnemonic while at it as the minimum binutils version of
> 2.30 supports it.
>
> [ bp: Merge two patches touching the same function into a single one. ]
The 1/2 patch is intended to be backportable (only this part carries
"Fixes" designation). The 2/2 patch introduces RDPID mnemonic that
requires binutils-2.30, so the second part is not backportable to
branches that still require binutils-2.25.
Uros.
>
> Fixes: ffebbaedc861 ("x86/vdso: Introduce helper functions for CPU and node number")
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
> Link: https://lore.kernel.org/20250616095315.230620-1-ubizjak@gmail.com
> ---
> arch/x86/include/asm/segment.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
> index 77d8f49..f59ae71 100644
> --- a/arch/x86/include/asm/segment.h
> +++ b/arch/x86/include/asm/segment.h
> @@ -244,7 +244,7 @@ static inline unsigned long vdso_encode_cpunode(int cpu, unsigned long node)
>
> static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)
> {
> - unsigned int p;
> + unsigned long p;
>
> /*
> * Load CPU and node number from the GDT. LSL is faster than RDTSCP
> @@ -254,10 +254,10 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)
> *
> * If RDPID is available, use it.
> */
> - alternative_io ("lsl %[seg],%[p]",
> - ".byte 0xf3,0x0f,0xc7,0xf8", /* RDPID %eax/rax */
> + alternative_io ("lsl %[seg],%k[p]",
> + "rdpid %[p]",
> X86_FEATURE_RDPID,
> - [p] "=a" (p), [seg] "r" (__CPUNODE_SEG));
> + [p] "=r" (p), [seg] "r" (__CPUNODE_SEG));
>
> if (cpu)
> *cpu = (p & VDSO_CPUNODE_MASK);
Powered by blists - more mailing lists