aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-06-07 05:49:55 -0400
committerIngo Molnar <mingo@elte.hu>2011-07-21 14:41:57 -0400
commit1ac2e6ca44e13a087eb7438d284f887097ee7e84 (patch)
tree7ee4f00a67850e1e247610cefeae0ee7aa7b239a /arch/x86/kernel/cpu
parent9985c20f9e4aee6857c08246b273a3695a52b929 (diff)
x86, perf: Make copy_from_user_nmi() a library function
copy_from_user_nmi() is used in oprofile and perf. Moving it to other library functions like copy_from_user(). As this is x86 code for 32 and 64 bits, create a new file usercopy.c for unified code. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110607172413.GJ20052@erda.amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index b7a010fce8c3..4ee3abf20ed6 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -22,7 +22,6 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/highmem.h>
26#include <linux/cpu.h> 25#include <linux/cpu.h>
27#include <linux/bitops.h> 26#include <linux/bitops.h>
28 27
@@ -67,40 +66,6 @@ enum extra_reg_type {
67 EXTRA_REG_MAX /* number of entries needed */ 66 EXTRA_REG_MAX /* number of entries needed */
68}; 67};
69 68
70/*
71 * best effort, GUP based copy_from_user() that assumes IRQ or NMI context
72 */
73static unsigned long
74copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
75{
76 unsigned long offset, addr = (unsigned long)from;
77 unsigned long size, len = 0;
78 struct page *page;
79 void *map;
80 int ret;
81
82 do {
83 ret = __get_user_pages_fast(addr, 1, 0, &page);
84 if (!ret)
85 break;
86
87 offset = addr & (PAGE_SIZE - 1);
88 size = min(PAGE_SIZE - offset, n - len);
89
90 map = kmap_atomic(page);
91 memcpy(to, map+offset, size);
92 kunmap_atomic(map);
93 put_page(page);
94
95 len += size;
96 to += size;
97 addr += size;
98
99 } while (len < n);
100
101 return len;
102}
103
104struct event_constraint { 69struct event_constraint {
105 union { 70 union {
106 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 71 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];