]> git.baikalelectronics.ru Git - kernel.git/commit
x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm
authorAndy Lutomirski <luto@kernel.org>
Thu, 16 Mar 2017 19:59:39 +0000 (12:59 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 17 Mar 2017 07:28:26 +0000 (08:28 +0100)
commit1837607dcd3bec708d4b4af4350b74416762e451
tree2c4b0b1b3f07901812f2b8459000c161e735936a
parenta503da96e6f9f6f5be5f50291e3f9dcc2bcaff11
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 <vincent.weaver@maine.edu>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Fixes: 6b0da7c169b2 ("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 <mingo@kernel.org>
arch/x86/events/core.c