x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm
authorAndy Lutomirski <[email protected]>
Thu, 16 Mar 2017 19:59:39 +0000 (12:59 -0700)
committerIngo Molnar <[email protected]>
Fri, 17 Mar 2017 07:28:26 +0000 (08:28 +0100)
commit5dc855d44c2ad960a86f593c60461f1ae1566b6d
tree2c4b0b1b3f07901812f2b8459000c161e735936a
parentd8a8cfc76919b6c830305266b23ba671623f37ff
x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm

If one thread mmaps a perf event while another thread in the same mm
is in some context where active_mm != mm (which can happen in the
scheduler, for example), refresh_pce() would write the wrong value
to CR4.PCE.  This broke some PAPI tests.

Reported-and-tested-by: Vince Weaver <[email protected]>
Signed-off-by: Andy Lutomirski <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Fixes: 7911d3f7af14 ("perf/x86: Only allow rdpmc if a perf_event is mapped")
Link: http://lkml.kernel.org/r/0c5b38a76ea50e405f9abe07a13dfaef87c173a1.1489694270.git.luto@kernel.org
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/events/core.c