Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vdso: Remove struct getcpu_cache

The cache parameter of getcpu() is useless nowadays for various reasons.

* It is never passed by userspace for either the vDSO or syscalls.
* It is never used by the kernel.
* It could not be made to work on the current vDSO architecture.
* The structure definition is not part of the UAPI headers.
* vdso_getcpu() is superseded by restartable sequences in any case.

Remove the struct and its header.

As a side-effect this gets rid of an unwanted inclusion of the linux/
header namespace from vDSO code.

[ tglx: Adapt to s390 upstream changes */

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Heiko Carstens <hca@linux.ibm.com> # s390
Link: https://patch.msgid.link/20251230-getcpu_cache-v3-1-fb9c5f880ebe@linutronix.de

authored by

Thomas Weißschuh and committed by
Thomas Gleixner
7158fc54 bec06cd6

+10 -41
+2 -3
arch/loongarch/vdso/vgetcpu.c
··· 4 4 */ 5 5 6 6 #include <asm/vdso.h> 7 - #include <linux/getcpu.h> 8 7 9 8 static __always_inline int read_cpu_id(void) 10 9 { ··· 27 28 } 28 29 29 30 extern 30 - int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused); 31 - int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused) 31 + int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused); 32 + int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) 32 33 { 33 34 int cpu_id; 34 35
+1 -2
arch/s390/kernel/vdso/getcpu.c
··· 2 2 /* Copyright IBM Corp. 2020 */ 3 3 4 4 #include <linux/compiler.h> 5 - #include <linux/getcpu.h> 6 5 #include <asm/timex.h> 7 6 #include "vdso.h" 8 7 9 - int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) 8 + int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused) 10 9 { 11 10 union tod_clock clk; 12 11
+1 -3
arch/s390/kernel/vdso/vdso.h
··· 4 4 5 5 #include <vdso/datapage.h> 6 6 7 - struct getcpu_cache; 8 - 9 - int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused); 7 + int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused); 10 8 int __s390_vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 11 9 int __s390_vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); 12 10 int __s390_vdso_clock_getres(clockid_t clock, struct __kernel_timespec *ts);
+2 -3
arch/x86/entry/vdso/vgetcpu.c
··· 6 6 */ 7 7 8 8 #include <linux/kernel.h> 9 - #include <linux/getcpu.h> 10 9 #include <asm/segment.h> 11 10 #include <vdso/processor.h> 12 11 13 12 notrace long 14 - __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) 13 + __vdso_getcpu(unsigned *cpu, unsigned *node, void *unused) 15 14 { 16 15 vdso_read_cpunode(cpu, node); 17 16 18 17 return 0; 19 18 } 20 19 21 - long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) 20 + long getcpu(unsigned *cpu, unsigned *node, void *tcache) 22 21 __attribute__((weak, alias("__vdso_getcpu")));
+1 -3
arch/x86/include/asm/vdso/processor.h
··· 18 18 native_pause(); 19 19 } 20 20 21 - struct getcpu_cache; 22 - 23 - notrace long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused); 21 + notrace long __vdso_getcpu(unsigned *cpu, unsigned *node, void *unused); 24 22 25 23 #endif /* __ASSEMBLER__ */ 26 24
-19
include/linux/getcpu.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LINUX_GETCPU_H 3 - #define _LINUX_GETCPU_H 1 4 - 5 - /* Cache for getcpu() to speed it up. Results might be a short time 6 - out of date, but will be faster. 7 - 8 - User programs should not refer to the contents of this structure. 9 - I repeat they should not refer to it. If they do they will break 10 - in future kernels. 11 - 12 - It is only a private cache for vgetcpu(). It will change in future kernels. 13 - The user program must store this information per thread (__thread) 14 - If you want 100% accurate information pass NULL instead. */ 15 - struct getcpu_cache { 16 - unsigned long blob[128 / sizeof(long)]; 17 - }; 18 - 19 - #endif
+1 -2
include/linux/syscalls.h
··· 59 59 struct old_timeval32; 60 60 struct robust_list_head; 61 61 struct futex_waitv; 62 - struct getcpu_cache; 63 62 struct old_linux_dirent; 64 63 struct perf_event_attr; 65 64 struct file_handle; ··· 717 718 asmlinkage long sys_umask(int mask); 718 719 asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 719 720 unsigned long arg4, unsigned long arg5); 720 - asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); 721 + asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, void __user *cache); 721 722 asmlinkage long sys_gettimeofday(struct __kernel_old_timeval __user *tv, 722 723 struct timezone __user *tz); 723 724 asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv,
+1 -3
kernel/sys.c
··· 31 31 #include <linux/tty.h> 32 32 #include <linux/signal.h> 33 33 #include <linux/cn_proc.h> 34 - #include <linux/getcpu.h> 35 34 #include <linux/task_io_accounting_ops.h> 36 35 #include <linux/seccomp.h> 37 36 #include <linux/cpu.h> ··· 2875 2876 return error; 2876 2877 } 2877 2878 2878 - SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, 2879 - struct getcpu_cache __user *, unused) 2879 + SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, void __user *, unused) 2880 2880 { 2881 2881 int err = 0; 2882 2882 int cpu = raw_smp_processor_id();
+1 -3
tools/testing/selftests/vDSO/vdso_test_getcpu.c
··· 16 16 #include "vdso_config.h" 17 17 #include "vdso_call.h" 18 18 19 - struct getcpu_cache; 20 - typedef long (*getcpu_t)(unsigned int *, unsigned int *, 21 - struct getcpu_cache *); 19 + typedef long (*getcpu_t)(unsigned int *, unsigned int *, void *); 22 20 23 21 int main(int argc, char **argv) 24 22 {