Skip to content

Commit 7158fc5

Browse files
t-8chThomas Gleixner
authored andcommitted
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
1 parent bec06cd commit 7158fc5

9 files changed

Lines changed: 10 additions & 41 deletions

File tree

arch/loongarch/vdso/vgetcpu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
#include <asm/vdso.h>
7-
#include <linux/getcpu.h>
87

98
static __always_inline int read_cpu_id(void)
109
{
@@ -28,8 +27,8 @@ static __always_inline int read_cpu_id(void)
2827
}
2928

3029
extern
31-
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
32-
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
30+
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused);
31+
int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused)
3332
{
3433
int cpu_id;
3534

arch/s390/kernel/vdso/getcpu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
/* Copyright IBM Corp. 2020 */
33

44
#include <linux/compiler.h>
5-
#include <linux/getcpu.h>
65
#include <asm/timex.h>
76
#include "vdso.h"
87

9-
int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
8+
int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused)
109
{
1110
union tod_clock clk;
1211

arch/s390/kernel/vdso/vdso.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
#include <vdso/datapage.h>
66

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);
108
int __s390_vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
119
int __s390_vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
1210
int __s390_vdso_clock_getres(clockid_t clock, struct __kernel_timespec *ts);

arch/x86/entry/vdso/vgetcpu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66
*/
77

88
#include <linux/kernel.h>
9-
#include <linux/getcpu.h>
109
#include <asm/segment.h>
1110
#include <vdso/processor.h>
1211

1312
notrace long
14-
__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
13+
__vdso_getcpu(unsigned *cpu, unsigned *node, void *unused)
1514
{
1615
vdso_read_cpunode(cpu, node);
1716

1817
return 0;
1918
}
2019

21-
long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
20+
long getcpu(unsigned *cpu, unsigned *node, void *tcache)
2221
__attribute__((weak, alias("__vdso_getcpu")));

arch/x86/include/asm/vdso/processor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ static __always_inline void cpu_relax(void)
1818
native_pause();
1919
}
2020

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);
2422

2523
#endif /* __ASSEMBLER__ */
2624

include/linux/getcpu.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

include/linux/syscalls.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct compat_stat;
5959
struct old_timeval32;
6060
struct robust_list_head;
6161
struct futex_waitv;
62-
struct getcpu_cache;
6362
struct old_linux_dirent;
6463
struct perf_event_attr;
6564
struct file_handle;
@@ -718,7 +717,7 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
718717
asmlinkage long sys_umask(int mask);
719718
asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
720719
unsigned long arg4, unsigned long arg5);
721-
asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
720+
asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, void __user *cache);
722721
asmlinkage long sys_gettimeofday(struct __kernel_old_timeval __user *tv,
723722
struct timezone __user *tz);
724723
asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv,

kernel/sys.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <linux/tty.h>
3232
#include <linux/signal.h>
3333
#include <linux/cn_proc.h>
34-
#include <linux/getcpu.h>
3534
#include <linux/task_io_accounting_ops.h>
3635
#include <linux/seccomp.h>
3736
#include <linux/cpu.h>
@@ -2876,8 +2875,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
28762875
return error;
28772876
}
28782877

2879-
SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
2880-
struct getcpu_cache __user *, unused)
2878+
SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, void __user *, unused)
28812879
{
28822880
int err = 0;
28832881
int cpu = raw_smp_processor_id();

tools/testing/selftests/vDSO/vdso_test_getcpu.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
#include "vdso_config.h"
1717
#include "vdso_call.h"
1818

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 *);
2220

2321
int main(int argc, char **argv)
2422
{

0 commit comments

Comments
 (0)