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)
70
70
++ s -> seq ;
71
71
}
72
72
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
+
73
92
#endif /* _ASM_X86_VGTOD_H */
Original file line number Diff line number Diff line change 4
4
#include <linux/seqlock.h>
5
5
#include <uapi/asm/vsyscall.h>
6
6
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
-
16
7
extern void map_vsyscall (void );
17
8
18
9
/*
@@ -21,24 +12,4 @@ extern void map_vsyscall(void);
21
12
*/
22
13
extern bool emulate_vsyscall (struct pt_regs * regs , unsigned long address );
23
14
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
-
44
15
#endif /* _ASM_X86_VSYSCALL_H */
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ extern char __vvar_page;
44
44
45
45
/* DECLARE_VVAR(offset, type, name) */
46
46
47
- DECLARE_VVAR (16 , int , vgetcpu_mode )
48
47
DECLARE_VVAR (128 , struct vsyscall_gtod_data , vsyscall_gtod_data )
49
48
50
49
#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)
956
956
}
957
957
958
958
#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
-
967
959
#ifdef CONFIG_IA32_EMULATION
968
960
/* May not be __init: called during resume */
969
961
static void syscall32_cpu_init (void )
@@ -1006,8 +998,6 @@ void __init identify_boot_cpu(void)
1006
998
#ifdef CONFIG_X86_32
1007
999
sysenter_setup ();
1008
1000
enable_sep_cpu ();
1009
- #else
1010
- vgetcpu_set_mode ();
1011
1001
#endif
1012
1002
cpu_detect_tlb (& boot_cpu_data );
1013
1003
}
Original file line number Diff line number Diff line change 52
52
#define CREATE_TRACE_POINTS
53
53
#include "vsyscall_trace.h"
54
54
55
- DEFINE_VVAR (int , vgetcpu_mode );
56
-
57
55
static enum { EMULATE , NATIVE , NONE } vsyscall_mode = EMULATE ;
58
56
59
57
static int __init vsyscall_setup (char * str )
Original file line number Diff line number Diff line change 8
8
#include <linux/kernel.h>
9
9
#include <linux/getcpu.h>
10
10
#include <linux/time.h>
11
- #include <asm/vsyscall.h>
12
11
#include <asm/vgtod.h>
13
12
14
13
notrace long
You can’t perform that action at this time.
0 commit comments