perf/x86: Add /sys/devices/cpu/rdpmc=2 to allow rdpmc for all tasks
authorAndy Lutomirski <luto@amacapital.net>
Fri, 24 Oct 2014 22:58:13 +0000 (15:58 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 4 Feb 2015 11:10:49 +0000 (12:10 +0100)
commita66734297f78707ce39d756b656bfae861d53f62
treec58ac7f3a43522fd5f40527ee69eb0057cce41b0
parent7911d3f7af14a614617e38245fedf98a724e46a9
perf/x86: Add /sys/devices/cpu/rdpmc=2 to allow rdpmc for all tasks

While perfmon2 is a sufficiently evil library (it pokes MSRs
directly) that breaking it is fair game, it's still useful, so we
might as well try to support it.  This allows users to write 2 to
/sys/devices/cpu/rdpmc to disable all rdpmc protection so that hack
like perfmon2 can continue to work.

At some point, if perf_event becomes fast enough to replace
perfmon2, then this can go.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Vince Weaver <vince@deater.net>
Cc: "hillf.zj" <hillf.zj@alibaba-inc.com>
Cc: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/caac3c1c707dcca48ecbc35f4def21495856f479.1414190806.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/mmu_context.h
arch/x86/kernel/cpu/perf_event.c