Skip to contentSkip to conversation

+ perfmon2-reserve-system-calls.patch added to -mm tree

DISCUSSION Arnd Bergmann 7 participants 9 messages Nov 14, 2005 – Nov 16, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 22 lines · On Dinsdag 15 November 2005 00:30, [email protected] wrote:

diff -puN include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls include/asm-powerpc/unistd.h

include/asm-powerpc/unistd.h        Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls       Mon Nov 14 15:27:32 2005 +12 -0
@@ -296,8 +296,20 @@
  #define __NR_inotify_init      275
  #define __NR_inotify_add_watch 276
  #define __NR_inotify_rm_watch  277
+#define __NR_pfm_create_context        278
+#define __NR_pfm_write_pmcs    279
+#define __NR_pfm_write_pmds    280
+#define __NR_pfm_read_pmds     281
+#define __NR_pfm_load_context  282
+#define __NR_pfm_start         283
+#define __NR_pfm_stop          284
+#define __NR_pfm_restart       285
+#define __NR_pfm_create_evtsets        286
+#define __NR_pfm_getinfo_evtsets 287
+#define __NR_pfm_delete_evtsets 288
+#define __NR_pfm_unload_context        289

include/asm-powerpc/unistd.h        Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls       Mon Nov 14 15:27:32 2005 +1 -1
-#define __NR_syscalls          278
+#define __NR_syscalls          290
Quoted 3 lines


 #ifdef __KERNEL__
 #define __NR__exit __NR_exit

Hmm, I had sent an earlier patch to paulus that reserves 278 and 279 for spu_run and spu_create and that apparently got dropped.

Could I have those two numbers or is there already an established user based for the perfmon2 numbers that would take preference?

	Arnd <><
#2 lore raw
Quoted 2 lines · Arnd Bergmann

Hmm, I had sent an earlier patch to paulus that reserves 278 and 279 for spu_run and spu_create and that apparently got dropped.

Hmmm, sorry, I thought I had put that in, but evidently not.

Quoted 2 lines

Could I have those two numbers or is there already an established user based for the perfmon2 numbers that would take preference?

I don't believe there is any user base of the perfmon2 numbers. Stephane, could you respin using 280 - 291 for PowerPC?

Thanks,
Paul.

#3 lore raw

Paul,

Quoted 5 lines · Paul Mackerras
Quoted 2 lines · Arnd Bergmann

Hmm, I had sent an earlier patch to paulus that reserves 278 and 279 for spu_run and spu_create and that apparently got dropped.

Quoted 8 lines

Hmmm, sorry, I thought I had put that in, but evidently not.

Quoted 2 lines

Could I have those two numbers or is there already an established user based for the perfmon2 numbers that would take preference?

I don't believe there is any user base of the perfmon2 numbers. Stephane, could you respin using 280 - 291 for PowerPC?

Yes, at this point I am just reserving the syscall numbers, nothing is hardcoded into any application, so we can certainly change it. I'll do that and resubmit the powerpc portion. From Andrew, I understand I have to do this in arch/powerpc and also in arch/ppc.

Signature · 1 line
-Stephane
#4 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann
Quoted 3 lines

 #ifdef __KERNEL__
 #define __NR__exit __NR_exit

Hmm, I had sent an earlier patch to paulus that reserves 278 and 279 for spu_run and spu_create and that apparently got dropped.

Could I have those two numbers or is there already an established user based for the perfmon2 numbers that would take preference?

aargh. Any time anyone dinks with the syscall tables I have tons of fun fixing up rejects. It doesn't help that both Stephane and Christoph's patches were fairly broken.

Rules:

a) Keep unistd.h and the syscall tables in sync.

b) Keep ppc32 and powerpc[64] in sync

c) Add prototypes to syscalls.h (When the implementation goes in - obviously not relevant when we're just reserving syscall slots)

d) Some architectures have multiple syscall tables. Stephane, you missed arch/ia64/ia32/ia32_entry.S, for example. But then, that looks to be seriously out of date anyway. No idea what's going on there.

e) review your work carefully. Grep the tree for, say, `getxattr' (or any other syscall name which is unique-looking and which you expect all architectures to implement).

Anyway, I have a shower of fixup patches here. Hopefully it all landed OK.

#5 lore raw

Andrew,

Quoted 8 lines · Andrew Morton

aargh. Any time anyone dinks with the syscall tables I have tons of fun fixing up rejects. It doesn't help that both Stephane and Christoph's patches were fairly broken.

Rules:

a) Keep unistd.h and the syscall tables in sync.

Quoted 9 lines

b) Keep ppc32 and powerpc[64] in sync

c) Add prototypes to syscalls.h (When the implementation goes in - obviously not relevant when we're just reserving syscall slots)

d) Some architectures have multiple syscall tables. Stephane, you missed arch/ia64/ia32/ia32_entry.S, for example. But then, that looks to be seriously out of date anyway. No idea what's going on there.

This one corresponds to the system call table for X86 binaries running on Linux/ia64. This is used in combination with the hardware emulation in the processor. This is being replaced by full user level translation by Intel's IA32el libraries. The x86 binary is translated to IA-64 native code in user mode and then it makes IA-64 system calls. As such, the IA-32 syscall emulation table is becoming obsolete as people upgrade to newer Linux distributions using IA32el. Tony correct me if I missed something.

Quoted 5 lines

e) review your work carefully. Grep the tree for, say, `getxattr' (or any other syscall name which is unique-looking and which you expect all architectures to implement).

Anyway, I have a shower of fixup patches here. Hopefully it all landed OK.

I apologize for generating some extra work for you. I saw you fixed the powerpc request for those two extra syscalls. Thanks.

Signature · 1 line
-Stephane
#6 lore raw
Quoted 6 lines
Quoted 5 lines

d) Some architectures have multiple syscall tables. Stephane, you missed arch/ia64/ia32/ia32_entry.S, for example. But then, that looks to be seriously out of date anyway. No idea what's going on there.

Quoted 7 lines

This one corresponds to the system call table for X86 binaries running on Linux/ia64. This is used in combination with the hardware emulation in the processor. This is being replaced by full user level translation by Intel's IA32el libraries. The x86 binary is translated to IA-64 native code in user mode and then it makes IA-64 system calls. As such, the IA-32 syscall emulation table is becoming obsolete as people upgrade to newer Linux distributions using IA32el. Tony correct me if I missed something.

... which is a binary only, proprietary application.

Either way, either the emulation is in the kernel or it's not. If it's there (like it is now) it deserves maintenance. If it's not, it should be removed from the tree, since the only thing it's otherwise good for is potential security holes.

#7 lore raw
Quoted 1 line

... which is a binary only, proprietary application.

The IA32 emulation part of it is actually shipped in source. Somehow they manage to link a binary only object to it though.

Quoted 5 lines

Either way, either the emulation is in the kernel or it's not. If it's there (like it is now) it deserves maintenance. If it's not, it should be removed from the tree, since the only thing it's otherwise good for is potential security holes.

I suppose it's still useful for all current IA64 users (Montecito is not shipping yet and older CPUs support x86 in hardware) who don't like binary only software.

-Andi

Quoted 1 line
#8 lore raw
In reply to Arnd Bergmann
Quoted 13 lines · Arnd Bergmann
Quoted 13 lines
include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +0 -0
@@ -296,8 +296,20 @@

?#define __NR_inotify_init??????275
?#define __NR_inotify_add_watch?276
?#define __NR_inotify_rm_watch??277

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +7 -0
+#define __NR_pfm_create_context????????278
+#define __NR_pfm_write_pmcs????279
+#define __NR_pfm_write_pmds????280
+#define __NR_pfm_read_pmds?????281
+#define __NR_pfm_load_context??282
+#define __NR_pfm_start?????????283
+#define __NR_pfm_stop??????????284
Quoted 8 lines

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005

Quoted 8 lines
include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +5 -0
+#define __NR_pfm_restart???????285
+#define __NR_pfm_create_evtsets????????286
+#define __NR_pfm_getinfo_evtsets 287
+#define __NR_pfm_delete_evtsets 288
+#define __NR_pfm_unload_context????????289

?

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +1 -1
-#define __NR_syscalls??????????278
+#define __NR_syscalls??????????290

I thought we didn't reserve syscall numbers?

anyway, this is an awfull lot of syscalls numbers for what essentially is a driver not core kernel functionality. I think we should do an API review first.

and why didn't this patch get sent to lkml for review?

#9 lore raw

Christoph,

Quoted 19 lines · Christoph Hellwig
Quoted 18 lines · Arnd Bergmann
Quoted 18 lines
include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +0 -0
@@ -296,8 +296,20 @@

?#define __NR_inotify_init??????275
?#define __NR_inotify_add_watch?276
?#define __NR_inotify_rm_watch??277

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +12 -0
+#define __NR_pfm_create_context????????278
+#define __NR_pfm_write_pmcs????279
+#define __NR_pfm_write_pmds????280
+#define __NR_pfm_read_pmds?????281
+#define __NR_pfm_load_context??282
+#define __NR_pfm_start?????????283
+#define __NR_pfm_stop??????????284
+#define __NR_pfm_restart???????285
+#define __NR_pfm_create_evtsets????????286
+#define __NR_pfm_getinfo_evtsets 287
+#define __NR_pfm_delete_evtsets 288
+#define __NR_pfm_unload_context????????289
Quoted 8 lines
Quoted 3 lines

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005

Quoted 3 lines

?

include/asm-powerpc/unistd.h????????Mon Nov 14 15:27:32 2005 renamed from include/asm-powerpc/unistd.h~perfmon2-reserve-system-calls???????Mon Nov 14 15:27:32 2005 +1 -1
-#define __NR_syscalls??????????278
+#define __NR_syscalls??????????290

anyway, this is an awfull lot of syscalls numbers for what essentially is a driver not core kernel functionality. I think we should do an API review first.

I have cut the number of system calls as much as I could. Initially this started out as a single multiplexing system call. Given the feedback I received, I switched it over to multiple system calls. In retrospect, I think this is better than the initial design.

As for your driver question, it is true that if we were only interested in accessing the performance counters on a system-wide basis, like OProfile, we could have implemented a device driver.

However we want both the ability to measure on a system-wide basis, i.e., across all kernel threads running on a processor, but also on a per kernel thread basis. Both modes are important. Certain measurements do need to be applied to a single thread, e.g., counting the number of retired instructions for /bin/ls.

The per-thread mode implies that, on context switch, the counters be saved and restored like the rest of the machine state. I don't believe it is allowed for a device driver to access to the context switch code.

Furthermore we want to have the monitoring interface be builtin to make it easier for tools developers. A system call interface also gives us more flexibility as to how the interface looks like, i.e., number and types of arguments.

Fro all those reasons, we felt that the syscall approach was the best.

Quoted 1 line

and why didn't this patch get sent to lkml for review?

For the last few months, I have been posting announces on lkml, perfctr-devel and also linux-ia64-kernel about the new releases of the multi-platform perfmon code base to sollicate feedback. I don't claim to know all the kernel internal semantics and interfaces nor each hardware platofrm intricacies. Thus I welcome any comments, complaints especially if they are constructive and poinpoint precise problems in the code. This way I think we all make forward progress.

I will be releasing a new version of the patch this week. I would certainly welcome your comments.

Signature · 1 line
-Stephane