diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-16 17:58:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-16 17:58:12 -0500 |
commit | 37507717de51a8332a34ee07fd88700be88df5bf (patch) | |
tree | d6eb5d00a798a4b1ce40c8c4c8ca74b0d22fe1df /arch/x86/kernel/process.c | |
parent | a68fb48380bb993306dd62a58cbd946b4348222a (diff) | |
parent | a66734297f78707ce39d756b656bfae861d53f62 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf updates from Ingo Molnar:
"This series tightens up RDPMC permissions: currently even highly
sandboxed x86 execution environments (such as seccomp) have permission
to execute RDPMC, which may leak various perf events / PMU state such
as timing information and other CPU execution details.
This 'all is allowed' RDPMC mode is still preserved as the
(non-default) /sys/devices/cpu/rdpmc=2 setting. The new default is
that RDPMC access is only allowed if a perf event is mmap-ed (which is
needed to correctly interpret RDPMC counter values in any case).
As a side effect of these changes CR4 handling is cleaned up in the
x86 code and a shadow copy of the CR4 value is added.
The extra CR4 manipulation adds ~ <50ns to the context switch cost
between rdpmc-capable and rdpmc-non-capable mms"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86: Add /sys/devices/cpu/rdpmc=2 to allow rdpmc for all tasks
perf/x86: Only allow rdpmc if a perf_event is mapped
perf: Pass the event to arch_perf_update_userpage()
perf: Add pmu callbacks to track event mapping and unmapping
x86: Add a comment clarifying LDT context switching
x86: Store a per-cpu shadow copy of CR4
x86: Clean up cr4 manipulation
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index e127ddaa2d5a..046e2d620bbe 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/fpu-internal.h> | 28 | #include <asm/fpu-internal.h> |
29 | #include <asm/debugreg.h> | 29 | #include <asm/debugreg.h> |
30 | #include <asm/nmi.h> | 30 | #include <asm/nmi.h> |
31 | #include <asm/tlbflush.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | 34 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, |
@@ -141,7 +142,7 @@ void flush_thread(void) | |||
141 | 142 | ||
142 | static void hard_disable_TSC(void) | 143 | static void hard_disable_TSC(void) |
143 | { | 144 | { |
144 | write_cr4(read_cr4() | X86_CR4_TSD); | 145 | cr4_set_bits(X86_CR4_TSD); |
145 | } | 146 | } |
146 | 147 | ||
147 | void disable_TSC(void) | 148 | void disable_TSC(void) |
@@ -158,7 +159,7 @@ void disable_TSC(void) | |||
158 | 159 | ||
159 | static void hard_enable_TSC(void) | 160 | static void hard_enable_TSC(void) |
160 | { | 161 | { |
161 | write_cr4(read_cr4() & ~X86_CR4_TSD); | 162 | cr4_clear_bits(X86_CR4_TSD); |
162 | } | 163 | } |
163 | 164 | ||
164 | static void enable_TSC(void) | 165 | static void enable_TSC(void) |