summaryrefslogtreecommitdiffstats
path: root/perf-Use-kmap_atomic_direct.patch
blob: 73a34cea443ef4038bd1fa466fbbaa7ce4ea3640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From a6937fe5a01a2c54049cbc6d0a1d929c0fe3af63 Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri, 27 Aug 2010 11:54:52 +0200
Subject: [PATCH] perf: Use kmap_atomic_direct

commit ddeca6231cbdebd0fa0f1bac816f1e1e6eae485b in tip.

-rt falls back to regular kmap to provide preemptible kmap_atomic, which
is fine, except that the perf PMI does actually run from NMI context.

Use the kmap_atomic_direct() API which still provides the old, really
atomic kmap functionality regardless of PREEMPT_RT, previously only used
for paravirt stuffs.

Reported-by: "Sydir, Jerry" <jerry.sydir@intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/kernel/cpu/perf_event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index db5bdc8..90c5079 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1618,9 +1618,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
 		offset = addr & (PAGE_SIZE - 1);
 		size = min(PAGE_SIZE - offset, n - len);
 
-		map = kmap_atomic(page, type);
+		map = kmap_atomic_direct(page, type);
 		memcpy(to, map+offset, size);
-		kunmap_atomic(map, type);
+		kunmap_atomic_direct(map, type);
 		put_page(page);
 
 		len  += size;
-- 
1.7.0.4