* [PATCH 1/3] x86: Provide a full setup for getcpu on x86-32.
2022-11-25 9:42 [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
@ 2022-11-25 9:42 ` Sebastian Andrzej Siewior
2023-02-06 14:57 ` [tip: x86/vdso] x86/cpu: Provide the full setup for getcpu() " tip-bot2 for Sebastian Andrzej Siewior
2022-11-25 9:42 ` [PATCH 2/3] x86/vdso: Provide getcpu for x86-32 Sebastian Andrzej Siewior
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-11-25 9:42 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Roland Mainz, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner, Sebastian Andrzej Siewior
setup_getcpu() configures two things:
- writes the current CPU & node information into the MSR_TSC_AUX.
- writes the same information as a GDT entry.
By using the "full" setup_getcpu() on i386 it is possible to read the
CPU information in userland via rdtscp.
Provide an GDT_ENTRY_CPUNODE for x86-32.
Move the CONFIG_X86_64 so the x86-64 implementation becomes also
available for x86-32.
Reviewed-By: Roland Mainz <roland.mainz@nrubsig.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
arch/x86/include/asm/segment.h | 8 ++++----
arch/x86/kernel/cpu/common.c | 4 +---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index 2e7890dd58a47..662281c2a907c 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -96,7 +96,7 @@
*
* 26 - ESPFIX small SS
* 27 - per-cpu [ offset to per-cpu data area ]
- * 28 - unused
+ * 28 - VDSO getcpu
* 29 - unused
* 30 - unused
* 31 - TSS for double fault handler
@@ -119,6 +119,7 @@
#define GDT_ENTRY_ESPFIX_SS 26
#define GDT_ENTRY_PERCPU 27
+#define GDT_ENTRY_CPUNODE 28
#define GDT_ENTRY_DOUBLEFAULT_TSS 31
@@ -158,6 +159,8 @@
# define __KERNEL_PERCPU 0
#endif
+#define __CPUNODE_SEG (GDT_ENTRY_CPUNODE*8 + 3)
+
#else /* 64-bit: */
#include <asm/cache.h>
@@ -226,8 +229,6 @@
#define GDT_ENTRY_TLS_ENTRIES 3
#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8)
-#ifdef CONFIG_X86_64
-
/* Bit size and mask of CPU number stored in the per CPU data (and TSC_AUX) */
#define VDSO_CPUNODE_BITS 12
#define VDSO_CPUNODE_MASK 0xfff
@@ -265,7 +266,6 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)
}
#endif /* !__ASSEMBLY__ */
-#endif /* CONFIG_X86_64 */
#ifdef __KERNEL__
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 3e508f2390983..520a0a2e765d3 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2128,7 +2128,6 @@ static void wait_for_master_cpu(int cpu)
#endif
}
-#ifdef CONFIG_X86_64
static inline void setup_getcpu(int cpu)
{
unsigned long cpudata = vdso_encode_cpunode(cpu, early_cpu_to_node(cpu));
@@ -2150,6 +2149,7 @@ static inline void setup_getcpu(int cpu)
write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_CPUNODE, &d, DESCTYPE_S);
}
+#ifdef CONFIG_X86_64
static inline void ucode_cpu_init(int cpu)
{
if (cpu)
@@ -2169,8 +2169,6 @@ static inline void tss_setup_ist(struct tss_struct *tss)
#else /* CONFIG_X86_64 */
-static inline void setup_getcpu(int cpu) { }
-
static inline void ucode_cpu_init(int cpu)
{
show_ucode_info_early();
--
2.38.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [tip: x86/vdso] x86/cpu: Provide the full setup for getcpu() on x86-32
2022-11-25 9:42 ` [PATCH 1/3] x86: Provide a full setup " Sebastian Andrzej Siewior
@ 2023-02-06 14:57 ` tip-bot2 for Sebastian Andrzej Siewior
0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2023-02-06 14:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Roland Mainz, x86,
linux-kernel
The following commit has been merged into the x86/vdso branch of tip:
Commit-ID: 717cce3bdcf34705417f641bf2fcdf9b038ec36c
Gitweb: https://git.kernel.org/tip/717cce3bdcf34705417f641bf2fcdf9b038ec36c
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 25 Nov 2022 10:42:14 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 06 Feb 2023 15:48:54 +01:00
x86/cpu: Provide the full setup for getcpu() on x86-32
setup_getcpu() configures two things:
- it writes the current CPU & node information into MSR_TSC_AUX
- it writes the same information as a GDT entry.
By using the "full" setup_getcpu() on i386 it is possible to read the CPU
information in userland via RDTSCP() or via LSL from the GDT.
Provide an GDT_ENTRY_CPUNODE for x86-32 and make the setup function
unconditionally available.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org>
Link: https://lore.kernel.org/r/20221125094216.3663444-2-bigeasy@linutronix.de
---
arch/x86/include/asm/segment.h | 8 ++++----
arch/x86/kernel/cpu/common.c | 4 +---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index c390a67..794f696 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -96,7 +96,7 @@
*
* 26 - ESPFIX small SS
* 27 - per-cpu [ offset to per-cpu data area ]
- * 28 - unused
+ * 28 - VDSO getcpu
* 29 - unused
* 30 - unused
* 31 - TSS for double fault handler
@@ -119,6 +119,7 @@
#define GDT_ENTRY_ESPFIX_SS 26
#define GDT_ENTRY_PERCPU 27
+#define GDT_ENTRY_CPUNODE 28
#define GDT_ENTRY_DOUBLEFAULT_TSS 31
@@ -159,6 +160,8 @@
# define __KERNEL_PERCPU 0
#endif
+#define __CPUNODE_SEG (GDT_ENTRY_CPUNODE*8 + 3)
+
#else /* 64-bit: */
#include <asm/cache.h>
@@ -226,8 +229,6 @@
#define GDT_ENTRY_TLS_ENTRIES 3
#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8)
-#ifdef CONFIG_X86_64
-
/* Bit size and mask of CPU number stored in the per CPU data (and TSC_AUX) */
#define VDSO_CPUNODE_BITS 12
#define VDSO_CPUNODE_MASK 0xfff
@@ -265,7 +266,6 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)
}
#endif /* !__ASSEMBLY__ */
-#endif /* CONFIG_X86_64 */
#ifdef __KERNEL__
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 3a9043e..a26ce20 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2124,7 +2124,6 @@ static void wait_for_master_cpu(int cpu)
#endif
}
-#ifdef CONFIG_X86_64
static inline void setup_getcpu(int cpu)
{
unsigned long cpudata = vdso_encode_cpunode(cpu, early_cpu_to_node(cpu));
@@ -2146,6 +2145,7 @@ static inline void setup_getcpu(int cpu)
write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_CPUNODE, &d, DESCTYPE_S);
}
+#ifdef CONFIG_X86_64
static inline void ucode_cpu_init(int cpu)
{
if (cpu)
@@ -2165,8 +2165,6 @@ static inline void tss_setup_ist(struct tss_struct *tss)
#else /* CONFIG_X86_64 */
-static inline void setup_getcpu(int cpu) { }
-
static inline void ucode_cpu_init(int cpu)
{
show_ucode_info_early();
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/3] x86/vdso: Provide getcpu for x86-32.
2022-11-25 9:42 [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
2022-11-25 9:42 ` [PATCH 1/3] x86: Provide a full setup " Sebastian Andrzej Siewior
@ 2022-11-25 9:42 ` Sebastian Andrzej Siewior
2023-02-06 14:57 ` [tip: x86/vdso] " tip-bot2 for Sebastian Andrzej Siewior
2022-11-25 9:42 ` [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit Sebastian Andrzej Siewior
2023-01-12 8:52 ` [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
3 siblings, 1 reply; 10+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-11-25 9:42 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Roland Mainz, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner, Sebastian Andrzej Siewior
Wire up __vdso_getcpu() for x86-32. The version for 64bit can be reused.
The defines must no be faked (like it is done for vclock_gettime.c)
because we need the 64bit defines for the 32bit VDSO because the segment
number of the host kernel is required.
Reuse the vgetcpu.c for vdso32. Remove the time* header files which lead
to compile errors on 32bit. Add segment.h which provides
vdso_read_cpunode() and its requirements.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
arch/x86/entry/vdso/Makefile | 3 ++-
arch/x86/entry/vdso/vdso32/vdso32.lds.S | 1 +
arch/x86/entry/vdso/vdso32/vgetcpu.c | 2 ++
arch/x86/entry/vdso/vgetcpu.c | 3 +--
4 files changed, 6 insertions(+), 3 deletions(-)
create mode 100644 arch/x86/entry/vdso/vdso32/vgetcpu.c
diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 3e88b9df8c8f1..fcbcfc2b4e1a7 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -29,7 +29,7 @@ VDSO32-$(CONFIG_IA32_EMULATION) := y
# files to link into the vdso
vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
-vobjs32-y += vdso32/vclock_gettime.o
+vobjs32-y += vdso32/vclock_gettime.o vdso32/vgetcpu.o
vobjs-$(CONFIG_X86_SGX) += vsgx.o
# files to link into kernel
@@ -103,6 +103,7 @@ $(vobjs): KBUILD_AFLAGS += -DBUILD_VDSO
CFLAGS_REMOVE_vclock_gettime.o = -pg
CFLAGS_REMOVE_vdso32/vclock_gettime.o = -pg
CFLAGS_REMOVE_vgetcpu.o = -pg
+CFLAGS_REMOVE_vdso32/vgetcpu.o = -pg
CFLAGS_REMOVE_vsgx.o = -pg
#
diff --git a/arch/x86/entry/vdso/vdso32/vdso32.lds.S b/arch/x86/entry/vdso/vdso32/vdso32.lds.S
index c7720995ab1af..8a3be07006bb6 100644
--- a/arch/x86/entry/vdso/vdso32/vdso32.lds.S
+++ b/arch/x86/entry/vdso/vdso32/vdso32.lds.S
@@ -28,6 +28,7 @@ VERSION
__vdso_time;
__vdso_clock_getres;
__vdso_clock_gettime64;
+ __vdso_getcpu;
};
LINUX_2.5 {
diff --git a/arch/x86/entry/vdso/vdso32/vgetcpu.c b/arch/x86/entry/vdso/vdso32/vgetcpu.c
new file mode 100644
index 0000000000000..b777f84ffae9b
--- /dev/null
+++ b/arch/x86/entry/vdso/vdso32/vgetcpu.c
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "../vgetcpu.c"
diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c
index b88a82bbc3593..0a9007c240568 100644
--- a/arch/x86/entry/vdso/vgetcpu.c
+++ b/arch/x86/entry/vdso/vgetcpu.c
@@ -7,8 +7,7 @@
#include <linux/kernel.h>
#include <linux/getcpu.h>
-#include <linux/time.h>
-#include <asm/vgtod.h>
+#include <asm/segment.h>
notrace long
__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
--
2.38.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [tip: x86/vdso] x86/vdso: Provide getcpu for x86-32.
2022-11-25 9:42 ` [PATCH 2/3] x86/vdso: Provide getcpu for x86-32 Sebastian Andrzej Siewior
@ 2023-02-06 14:57 ` tip-bot2 for Sebastian Andrzej Siewior
0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2023-02-06 14:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the x86/vdso branch of tip:
Commit-ID: 92d33063c081a82d25dd08a9cce03947c8ed9164
Gitweb: https://git.kernel.org/tip/92d33063c081a82d25dd08a9cce03947c8ed9164
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 25 Nov 2022 10:42:15 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 06 Feb 2023 15:48:54 +01:00
x86/vdso: Provide getcpu for x86-32.
Wire up __vdso_getcpu() for x86-32.
The 64bit version is reused with trivial modifications. Contrary to
vclock_gettime.c there is no requirement to fake any defines in the case of
32bit VDSO on a 64bit kernel because the GDT entry from which the CPU and
node information is read is always the native one.
Adopt vdso_getcpu.c by:
- removing the unneeded time* header files which lead to compile errors
for 32bit.
- adding segment.h which provides vdso_read_cpunode() and the defines
required by it.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20221125094216.3663444-3-bigeasy@linutronix.de
---
arch/x86/entry/vdso/Makefile | 3 ++-
arch/x86/entry/vdso/vdso32/vdso32.lds.S | 1 +
arch/x86/entry/vdso/vdso32/vgetcpu.c | 2 ++
arch/x86/entry/vdso/vgetcpu.c | 3 +--
4 files changed, 6 insertions(+), 3 deletions(-)
create mode 100644 arch/x86/entry/vdso/vdso32/vgetcpu.c
diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 838613a..1506a22 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -29,7 +29,7 @@ VDSO32-$(CONFIG_IA32_EMULATION) := y
# files to link into the vdso
vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
-vobjs32-y += vdso32/vclock_gettime.o
+vobjs32-y += vdso32/vclock_gettime.o vdso32/vgetcpu.o
vobjs-$(CONFIG_X86_SGX) += vsgx.o
# files to link into kernel
@@ -104,6 +104,7 @@ $(vobjs): KBUILD_AFLAGS += -DBUILD_VDSO
CFLAGS_REMOVE_vclock_gettime.o = -pg
CFLAGS_REMOVE_vdso32/vclock_gettime.o = -pg
CFLAGS_REMOVE_vgetcpu.o = -pg
+CFLAGS_REMOVE_vdso32/vgetcpu.o = -pg
CFLAGS_REMOVE_vsgx.o = -pg
#
diff --git a/arch/x86/entry/vdso/vdso32/vdso32.lds.S b/arch/x86/entry/vdso/vdso32/vdso32.lds.S
index c772099..8a3be07 100644
--- a/arch/x86/entry/vdso/vdso32/vdso32.lds.S
+++ b/arch/x86/entry/vdso/vdso32/vdso32.lds.S
@@ -28,6 +28,7 @@ VERSION
__vdso_time;
__vdso_clock_getres;
__vdso_clock_gettime64;
+ __vdso_getcpu;
};
LINUX_2.5 {
diff --git a/arch/x86/entry/vdso/vdso32/vgetcpu.c b/arch/x86/entry/vdso/vdso32/vgetcpu.c
new file mode 100644
index 0000000..b777f84
--- /dev/null
+++ b/arch/x86/entry/vdso/vdso32/vgetcpu.c
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "../vgetcpu.c"
diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c
index b88a82b..0a9007c 100644
--- a/arch/x86/entry/vdso/vgetcpu.c
+++ b/arch/x86/entry/vdso/vgetcpu.c
@@ -7,8 +7,7 @@
#include <linux/kernel.h>
#include <linux/getcpu.h>
-#include <linux/time.h>
-#include <asm/vgtod.h>
+#include <asm/segment.h>
notrace long
__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit.
2022-11-25 9:42 [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
2022-11-25 9:42 ` [PATCH 1/3] x86: Provide a full setup " Sebastian Andrzej Siewior
2022-11-25 9:42 ` [PATCH 2/3] x86/vdso: Provide getcpu for x86-32 Sebastian Andrzej Siewior
@ 2022-11-25 9:42 ` Sebastian Andrzej Siewior
2022-11-29 21:54 ` Shuah Khan
2023-02-06 14:57 ` [tip: x86/vdso] selftests: Emit a warning if getcpu() " tip-bot2 for Sebastian Andrzej Siewior
2023-01-12 8:52 ` [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
3 siblings, 2 replies; 10+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-11-25 9:42 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Roland Mainz, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner, Sebastian Andrzej Siewior,
Shuah Khan, linux-kselftest
The vsyscall for getcpu has been wired up on 32bit so it can be warned
now if missing.
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
tools/testing/selftests/x86/test_vsyscall.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c
index 5b45e6986aeab..47cab972807c4 100644
--- a/tools/testing/selftests/x86/test_vsyscall.c
+++ b/tools/testing/selftests/x86/test_vsyscall.c
@@ -92,11 +92,8 @@ static void init_vdso(void)
printf("[WARN]\tfailed to find time in vDSO\n");
vdso_getcpu = (getcpu_t)dlsym(vdso, "__vdso_getcpu");
- if (!vdso_getcpu) {
- /* getcpu() was never wired up in the 32-bit vDSO. */
- printf("[%s]\tfailed to find getcpu in vDSO\n",
- sizeof(long) == 8 ? "WARN" : "NOTE");
- }
+ if (!vdso_getcpu)
+ printf("[WARN]\tfailed to find getcpu in vDSO\n");
}
static int init_vsys(void)
--
2.38.1
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit.
2022-11-25 9:42 ` [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit Sebastian Andrzej Siewior
@ 2022-11-29 21:54 ` Shuah Khan
2023-02-06 14:57 ` [tip: x86/vdso] selftests: Emit a warning if getcpu() " tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 0 replies; 10+ messages in thread
From: Shuah Khan @ 2022-11-29 21:54 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, linux-kernel, x86
Cc: Roland Mainz, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner, Shuah Khan, linux-kselftest,
Shuah Khan
On 11/25/22 02:42, Sebastian Andrzej Siewior wrote:
> The vsyscall for getcpu has been wired up on 32bit so it can be warned
> now if missing.
>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kselftest@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> tools/testing/selftests/x86/test_vsyscall.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c
> index 5b45e6986aeab..47cab972807c4 100644
> --- a/tools/testing/selftests/x86/test_vsyscall.c
> +++ b/tools/testing/selftests/x86/test_vsyscall.c
> @@ -92,11 +92,8 @@ static void init_vdso(void)
> printf("[WARN]\tfailed to find time in vDSO\n");
>
> vdso_getcpu = (getcpu_t)dlsym(vdso, "__vdso_getcpu");
> - if (!vdso_getcpu) {
> - /* getcpu() was never wired up in the 32-bit vDSO. */
> - printf("[%s]\tfailed to find getcpu in vDSO\n",
> - sizeof(long) == 8 ? "WARN" : "NOTE");
> - }
> + if (!vdso_getcpu)
> + printf("[WARN]\tfailed to find getcpu in vDSO\n");
> }
>
> static int init_vsys(void)
Assuming this is going through x86 tree due to dependencies, here is
my ack
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Let me know if you would like to me pick this up.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 10+ messages in thread* [tip: x86/vdso] selftests: Emit a warning if getcpu() is missing on 32bit
2022-11-25 9:42 ` [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit Sebastian Andrzej Siewior
2022-11-29 21:54 ` Shuah Khan
@ 2023-02-06 14:57 ` tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 0 replies; 10+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2023-02-06 14:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Shuah Khan, x86,
linux-kernel
The following commit has been merged into the x86/vdso branch of tip:
Commit-ID: 5646bbd6684acf5c9b9dedb863b7d2f6f5a330fb
Gitweb: https://git.kernel.org/tip/5646bbd6684acf5c9b9dedb863b7d2f6f5a330fb
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 25 Nov 2022 10:42:16 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 06 Feb 2023 15:48:54 +01:00
selftests: Emit a warning if getcpu() is missing on 32bit
The VDSO implementation for getcpu() has been wired up on 32bit so warn if
missing.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20221125094216.3663444-4-bigeasy@linutronix.de
---
tools/testing/selftests/x86/test_vsyscall.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c
index 5b45e69..47cab97 100644
--- a/tools/testing/selftests/x86/test_vsyscall.c
+++ b/tools/testing/selftests/x86/test_vsyscall.c
@@ -92,11 +92,8 @@ static void init_vdso(void)
printf("[WARN]\tfailed to find time in vDSO\n");
vdso_getcpu = (getcpu_t)dlsym(vdso, "__vdso_getcpu");
- if (!vdso_getcpu) {
- /* getcpu() was never wired up in the 32-bit vDSO. */
- printf("[%s]\tfailed to find getcpu in vDSO\n",
- sizeof(long) == 8 ? "WARN" : "NOTE");
- }
+ if (!vdso_getcpu)
+ printf("[WARN]\tfailed to find getcpu in vDSO\n");
}
static int init_vsys(void)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32.
2022-11-25 9:42 [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
` (2 preceding siblings ...)
2022-11-25 9:42 ` [PATCH 3/3] selftests: Make a warning if getcpu is missing on 32bit Sebastian Andrzej Siewior
@ 2023-01-12 8:52 ` Sebastian Andrzej Siewior
2023-02-01 12:30 ` Roland Mainz
3 siblings, 1 reply; 10+ messages in thread
From: Sebastian Andrzej Siewior @ 2023-01-12 8:52 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Roland Mainz, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner
On 2022-11-25 10:42:13 [+0100], To linux-kernel@vger.kernel.org wrote:
> This tiny series provides getcpu in vdso on x86-32. Due to the setup
> RDTSCP now also returns CPU and node information like x86-64 does.
>
> The usage of RDTSCP + vdso has been tested in a VM with 64bit kernel and
> 32bit binary and a 32bit kernel.
ping.
Sebastian
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32.
2023-01-12 8:52 ` [PATCH 0/3] x86: Provide a vdso for getcpu on x86-32 Sebastian Andrzej Siewior
@ 2023-02-01 12:30 ` Roland Mainz
0 siblings, 0 replies; 10+ messages in thread
From: Roland Mainz @ 2023-02-01 12:30 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-kernel, x86, H. Peter Anvin, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner, Roland Mainz
On Thu, Jan 12, 2023 at 9:52 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
> On 2022-11-25 10:42:13 [+0100], To linux-kernel@vger.kernel.org wrote:
> > This tiny series provides getcpu in vdso on x86-32. Due to the setup
> > RDTSCP now also returns CPU and node information like x86-64 does.
> >
> > The usage of RDTSCP + vdso has been tested in a VM with 64bit kernel and
> > 32bit binary and a 32bit kernel.
>
> ping.
Is there a commit id for the Linux mainline yet ?
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
^ permalink raw reply [flat|nested] 10+ messages in thread