diff options
author | Paul Mackerras <paulus@samba.org> | 2009-02-26 06:43:46 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2009-02-26 06:43:46 -0500 |
commit | f3dfd2656deb81a0addee4f4ceff66b50a387388 (patch) | |
tree | 2d43269668b2a468a2bd2988b1937f9a71d458b4 /include/linux/perf_counter.h | |
parent | 742bd95ba96e19b3f7196c3a0834ebc17c8ba006 (diff) |
perfcounters: fix a few minor cleanliness issues
This fixes three issues noticed by Arnd Bergmann:
- Add #ifdef __KERNEL__ and move some things around in perf_counter.h
to make sure only the bits that userspace needs are exported to
userspace.
- Use __u64, __s64, __u32 types in the structs exported to userspace
rather than u64, s64, u32.
- Make the sys_perf_counter_open syscall available to the SPUs on
Cell platforms.
And one issue that I noticed in looking at the code again:
- Wrap the perf_counter_open syscall with SYSCALL_DEFINE4 so we get
the proper handling of int arguments on ppc64 (and some other 64-bit
architectures).
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 32cd1acb7386..186efaf49665 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -13,20 +13,8 @@ | |||
13 | #ifndef _LINUX_PERF_COUNTER_H | 13 | #ifndef _LINUX_PERF_COUNTER_H |
14 | #define _LINUX_PERF_COUNTER_H | 14 | #define _LINUX_PERF_COUNTER_H |
15 | 15 | ||
16 | #include <asm/atomic.h> | 16 | #include <linux/types.h> |
17 | #include <asm/ioctl.h> | 17 | #include <linux/ioctl.h> |
18 | |||
19 | #ifdef CONFIG_PERF_COUNTERS | ||
20 | # include <asm/perf_counter.h> | ||
21 | #endif | ||
22 | |||
23 | #include <linux/list.h> | ||
24 | #include <linux/mutex.h> | ||
25 | #include <linux/rculist.h> | ||
26 | #include <linux/rcupdate.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | |||
29 | struct task_struct; | ||
30 | 18 | ||
31 | /* | 19 | /* |
32 | * User-space ABI bits: | 20 | * User-space ABI bits: |
@@ -78,12 +66,12 @@ enum perf_counter_record_type { | |||
78 | * Hardware event to monitor via a performance monitoring counter: | 66 | * Hardware event to monitor via a performance monitoring counter: |
79 | */ | 67 | */ |
80 | struct perf_counter_hw_event { | 68 | struct perf_counter_hw_event { |
81 | s64 type; | 69 | __s64 type; |
82 | 70 | ||
83 | u64 irq_period; | 71 | __u64 irq_period; |
84 | u32 record_type; | 72 | __u32 record_type; |
85 | 73 | ||
86 | u32 disabled : 1, /* off by default */ | 74 | __u32 disabled : 1, /* off by default */ |
87 | nmi : 1, /* NMI sampling */ | 75 | nmi : 1, /* NMI sampling */ |
88 | raw : 1, /* raw event type */ | 76 | raw : 1, /* raw event type */ |
89 | inherit : 1, /* children inherit it */ | 77 | inherit : 1, /* children inherit it */ |
@@ -95,7 +83,7 @@ struct perf_counter_hw_event { | |||
95 | 83 | ||
96 | __reserved_1 : 23; | 84 | __reserved_1 : 23; |
97 | 85 | ||
98 | u64 __reserved_2; | 86 | __u64 __reserved_2; |
99 | }; | 87 | }; |
100 | 88 | ||
101 | /* | 89 | /* |
@@ -104,10 +92,24 @@ struct perf_counter_hw_event { | |||
104 | #define PERF_COUNTER_IOC_ENABLE _IO('$', 0) | 92 | #define PERF_COUNTER_IOC_ENABLE _IO('$', 0) |
105 | #define PERF_COUNTER_IOC_DISABLE _IO('$', 1) | 93 | #define PERF_COUNTER_IOC_DISABLE _IO('$', 1) |
106 | 94 | ||
95 | #ifdef __KERNEL__ | ||
107 | /* | 96 | /* |
108 | * Kernel-internal data types: | 97 | * Kernel-internal data types and definitions: |
109 | */ | 98 | */ |
110 | 99 | ||
100 | #ifdef CONFIG_PERF_COUNTERS | ||
101 | # include <asm/perf_counter.h> | ||
102 | #endif | ||
103 | |||
104 | #include <linux/list.h> | ||
105 | #include <linux/mutex.h> | ||
106 | #include <linux/rculist.h> | ||
107 | #include <linux/rcupdate.h> | ||
108 | #include <linux/spinlock.h> | ||
109 | #include <asm/atomic.h> | ||
110 | |||
111 | struct task_struct; | ||
112 | |||
111 | /** | 113 | /** |
112 | * struct hw_perf_counter - performance counter hardware details: | 114 | * struct hw_perf_counter - performance counter hardware details: |
113 | */ | 115 | */ |
@@ -293,4 +295,5 @@ static inline int perf_counter_task_disable(void) { return -EINVAL; } | |||
293 | static inline int perf_counter_task_enable(void) { return -EINVAL; } | 295 | static inline int perf_counter_task_enable(void) { return -EINVAL; } |
294 | #endif | 296 | #endif |
295 | 297 | ||
298 | #endif /* __KERNEL__ */ | ||
296 | #endif /* _LINUX_PERF_COUNTER_H */ | 299 | #endif /* _LINUX_PERF_COUNTER_H */ |