File tree Expand file tree Collapse file tree 6 files changed +19
-43
lines changed Expand file tree Collapse file tree 6 files changed +19
-43
lines changed Original file line number Diff line number Diff line change @@ -70,4 +70,23 @@ static inline void gtod_write_end(struct vsyscall_gtod_data *s)
7070 ++ s -> seq ;
7171}
7272
73+ #ifdef CONFIG_X86_64
74+
75+ #define VGETCPU_CPU_MASK 0xfff
76+
77+ static inline unsigned int __getcpu (void )
78+ {
79+ unsigned int p ;
80+
81+ /*
82+ * Load per CPU data from GDT. LSL is faster than RDTSCP and
83+ * works on all CPUs.
84+ */
85+ asm("lsl %1,%0" : "=r" (p ) : "r" (__PER_CPU_SEG ));
86+
87+ return p ;
88+ }
89+
90+ #endif /* CONFIG_X86_64 */
91+
7392#endif /* _ASM_X86_VGTOD_H */
Original file line number Diff line number Diff line change 44#include <linux/seqlock.h>
55#include <uapi/asm/vsyscall.h>
66
7- #define VGETCPU_RDTSCP 1
8- #define VGETCPU_LSL 2
9-
10- /* kernel space (writeable) */
11- extern int vgetcpu_mode ;
12- extern struct timezone sys_tz ;
13-
14- #include <asm/vvar.h>
15-
167extern void map_vsyscall (void );
178
189/*
@@ -21,24 +12,4 @@ extern void map_vsyscall(void);
2112 */
2213extern bool emulate_vsyscall (struct pt_regs * regs , unsigned long address );
2314
24- #ifdef CONFIG_X86_64
25-
26- #define VGETCPU_CPU_MASK 0xfff
27-
28- static inline unsigned int __getcpu (void )
29- {
30- unsigned int p ;
31-
32- if (VVAR (vgetcpu_mode ) == VGETCPU_RDTSCP ) {
33- /* Load per CPU data from RDTSCP */
34- native_read_tscp (& p );
35- } else {
36- /* Load per CPU data from GDT */
37- asm("lsl %1,%0" : "=r" (p ) : "r" (__PER_CPU_SEG ));
38- }
39-
40- return p ;
41- }
42- #endif /* CONFIG_X86_64 */
43-
4415#endif /* _ASM_X86_VSYSCALL_H */
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ extern char __vvar_page;
4444
4545/* DECLARE_VVAR(offset, type, name) */
4646
47- DECLARE_VVAR (16 , int , vgetcpu_mode )
4847DECLARE_VVAR (128 , struct vsyscall_gtod_data , vsyscall_gtod_data )
4948
5049#undef DECLARE_VVAR
Original file line number Diff line number Diff line change @@ -956,14 +956,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)
956956}
957957
958958#ifdef CONFIG_X86_64
959- static void vgetcpu_set_mode (void )
960- {
961- if (cpu_has (& boot_cpu_data , X86_FEATURE_RDTSCP ))
962- vgetcpu_mode = VGETCPU_RDTSCP ;
963- else
964- vgetcpu_mode = VGETCPU_LSL ;
965- }
966-
967959#ifdef CONFIG_IA32_EMULATION
968960/* May not be __init: called during resume */
969961static void syscall32_cpu_init (void )
@@ -1006,8 +998,6 @@ void __init identify_boot_cpu(void)
1006998#ifdef CONFIG_X86_32
1007999 sysenter_setup ();
10081000 enable_sep_cpu ();
1009- #else
1010- vgetcpu_set_mode ();
10111001#endif
10121002 cpu_detect_tlb (& boot_cpu_data );
10131003}
Original file line number Diff line number Diff line change 5252#define CREATE_TRACE_POINTS
5353#include "vsyscall_trace.h"
5454
55- DEFINE_VVAR (int , vgetcpu_mode );
56-
5755static enum { EMULATE , NATIVE , NONE } vsyscall_mode = EMULATE ;
5856
5957static int __init vsyscall_setup (char * str )
Original file line number Diff line number Diff line change 88#include <linux/kernel.h>
99#include <linux/getcpu.h>
1010#include <linux/time.h>
11- #include <asm/vsyscall.h>
1211#include <asm/vgtod.h>
1312
1413notrace long
You can’t perform that action at this time.
0 commit comments