Skip to contentSkip to conversation

perfcounters: fix a few minor cleanliness issues

PATCH In review Paul Mackerras 3 participants 3 messages Feb 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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).

---
This is in the master branch of my perfcounters.git tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perfcounters.git master

 arch/powerpc/include/asm/systbl.h |    2 +-
 include/linux/perf_counter.h      |   43 +++++++++++++++++++-----------------
 include/linux/syscalls.h          |    9 ++-----
 kernel/perf_counter.c             |    6 ++--
 4 files changed, 30 insertions(+), 30 deletions(-)
arch/powerpc/include/asm/systbl.h +1 -1
index 4c8095f..d312eec 100644
@@ -322,4 +322,4 @@ SYSCALL_SPU(epoll_create1)
 SYSCALL_SPU(dup3)
 SYSCALL_SPU(pipe2)
 SYSCALL(inotify_init1)
-SYSCALL(perf_counter_open)
+SYSCALL_SPU(perf_counter_open)
include/linux/perf_counter.h +23 -20

76 lines not on this page · raw message

include/linux/syscalls.h +3 -6
index 88255d3..28ef2be 100644
@@ -696,10 +696,7 @@ asmlinkage long sys_pipe(int __user *);
 int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
 
 
-asmlinkage int sys_perf_counter_open(
-
-	struct perf_counter_hw_event	*hw_event_uptr		__user,
-	pid_t				pid,
-	int				cpu,
-	int				group_fd);
+asmlinkage long sys_perf_counter_open(
+		const struct perf_counter_hw_event __user *hw_event_uptr,
+		pid_t pid, int cpu, int group_fd);
 #endif
kernel/perf_counter.c +3 -3
index ad62965..16b14ba 100644
@@ -1690,9 +1690,9 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,
  * @cpu:		target cpu
  * @group_fd:		group leader counter fd
  */
-asmlinkage int
-sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr __user,
-		      pid_t pid, int cpu, int group_fd)
+SYSCALL_DEFINE4(perf_counter_open,
+		const struct perf_counter_hw_event __user *, hw_event_uptr,
+		pid_t, pid, int, cpu, int, group_fd)
 {
 	struct perf_counter *counter, *group_leader;
 	struct perf_counter_hw_event hw_event;
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 23 lines · Paul Mackerras

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).

---
This is in the master branch of my perfcounters.git tree at:

Quoted 7 lines

git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perfcounters.git master

 arch/powerpc/include/asm/systbl.h |    2 +-
 include/linux/perf_counter.h      |   43 +++++++++++++++++++-----------------
 include/linux/syscalls.h          |    9 ++-----
 kernel/perf_counter.c             |    6 ++--
 4 files changed, 30 insertions(+), 30 deletions(-)

Pulled into tip:perfcounters/core, thanks Paul!

Ingo

Acked-by on v1 1/1
#2 lore raw
In reply to Paul Mackerras
Quoted 12 lines · Paul Mackerras

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.

Quoted 8 lines

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).

Thanks for the follow-up!