Trace code and documentation (resend)
Subsystems (3)
PATCH 1/2 Trace code and documentation (resend)
My last posting was mangled by my mailer. I hope this one is better. Also corrected Randy's concerns.
Please see previous posting for more information:
http://lkml.org/lkml/2007/9/19/4 (PATCH 0/2)
Note: this patch requires "[Patch 2/2] Relay reset consumed" is applied.
---------<start of patch>------------
Trace - Provides tracing primitives
--- Documentation/trace/src/Makefile | 7 + Documentation/trace/src/README | 18 + Documentation/trace/src/fork_trace.c | 119 +++++++ Documentation/trace/trace.txt | 164 ++++++++++ include/linux/trace.h | 99 ++++++ lib/Kconfig | 9 + lib/Makefile | 2 + lib/trace.c | 563 ++++++++++++++++++++++++++++++++++ 8 files changed, 981 insertions(+), 0 deletions(-)
Documentation/trace/src/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +obj-m := fork_trace.o +KDIR := /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) +default: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules +clean: + rm -f *.mod.c *.ko *.o
Documentation/trace/src/README new file +18 -0
@@ -0,0 +1,18 @@ +This small sample module creates a trace channel. It places a kprobe +on the function do_fork(). The value of current->pid is written to +the trace channel each time the kprobe is hit.. + +How to run the example: +$ mount -t debugfs /debug +$ make +$ insmod fork_trace.ko + +To view the data produced by the module: +$ cat /debug/trace_example/do_fork/trace0 + +Remove the module. +$ rmmod fork_trace + +The function trace_cleanup() is called when the module +is removed. This will cause the TRACE channel to be destroyed and the +corresponding files to disappear from the debug file system.
Documentation/trace/src/fork_trace.c new file +119 -0
119 lines not on this page · raw message
Documentation/trace/trace.txt new file +164 -0
164 lines not on this page · raw message
include/linux/trace.h new file +99 -0
99 lines not on this page · raw message
lib/Kconfig +9 -0
@@ -141,4 +141,13 @@ config HAS_DMA config CHECK_SIGNATURE bool +config TRACE + bool "Trace setup and control" + depends on RELAY && DEBUG_FS + help + This option provides support for the setup, teardown and control + of tracing channels from kernel code. It also provides trace + information and control to userspace via a set of debugfs control + files. If unsure, say N. + endmenu
lib/Makefile +2 -0
@@ -70,6 +70,8 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o obj-$(CONFIG_PROFILE_LIKELY) += likely_prof.o +obj-$(CONFIG_TRACE) += trace.o + hostprogs-y := gen_crc32table clean-files := crc32table.h
lib/trace.c new file +563 -0
563 lines not on this page · raw message
Quoted 11 lines · David J. Wilder
My last posting was mangled by my mailer. I hope this one is better. Also corrected Randy's concerns.
Please see previous posting for more information:
http://lkml.org/lkml/2007/9/19/4 (PATCH 0/2)Note: this patch requires "[Patch 2/2] Relay reset consumed" is applied.
---------<start of patch>------------
Trace - Provides tracing primitives
Quoted 8 lines
Signed-off-by Tom Zanussi <[email protected]>Signed-off-by Martin Hunt <[email protected]>Signed-off-by David Wilder <[email protected]>--- Documentation/trace/src/Makefile | 7 + Documentation/trace/src/README | 18 + Documentation/trace/src/fork_trace.c | 119 +++++++ Documentation/trace/trace.txt | 164 ++++++++++
NACK, don't put code into Documentation/. Put it into kernel as it's actually useful kernel code. And add clone,exec and exit while you're at it.
Quoted 21 lines · Christoph Hellwig
Quoted 11 lines · David J. Wilder
My last posting was mangled by my mailer. I hope this one is better. Also corrected Randy's concerns.
Please see previous posting for more information:
http://lkml.org/lkml/2007/9/19/4 (PATCH 0/2)Note: this patch requires "[Patch 2/2] Relay reset consumed" is applied.
---------<start of patch>------------
Trace - Provides tracing primitivesQuoted 8 lines
Signed-off-by Tom Zanussi <[email protected]>Signed-off-by Martin Hunt <[email protected]>Signed-off-by David Wilder <[email protected]>--- Documentation/trace/src/Makefile | 7 + Documentation/trace/src/README | 18 + Documentation/trace/src/fork_trace.c | 119 +++++++ Documentation/trace/trace.txt | 164 ++++++++++
Quoted 2 lines
NACK, don't put code into
Documentation/. Put it into kernel as it's actually useful kernel code.
Are you suggesting moving the example code into kernel? Or complaining about example code in /Documentation?
And add clone,exec and exit while you're at it.
Hu? A syscall tracer sounds like a nice idea but that is not what I am trying to accomplish. I will let Systemtap handle that.
Quoted 5 lines · David Wilder
Quoted 2 lines
NACK, don't put code into
Documentation/. Put it into kernel as it's actually useful kernel code.Are you suggesting moving the example code into kernel? Or complaining about example code in /Documentation?
Both. example code should be integrated with the build system so it gets built.
Quoted 4 lines
And add clone,exec and exit while you're at it.
Hu? A syscall tracer sounds like a nice idea but that is not what I am trying to accomplish. I will let Systemtap handle that.
Systemtap doesn't help anyone as it's not in the tree. I haven't even asked you to provide a full system call tracing modulem but provide at least one that's useful for a certain use-case (looking at processes) instead of almost useless code.
Quoted 9 lines · On Mon, 24 Sep 2007 16:41:14 +0100 Christoph Hellwig wrote:
Quoted 5 lines · David Wilder
Quoted 2 lines
NACK, don't put code into
Documentation/. Put it into kernel as it's actually useful kernel code.Are you suggesting moving the example code into kernel? Or complaining about example code in /Documentation?
Both. example code should be integrated with the build system so it gets built.
How about if we build the sample files in the Documentation/ tree?
with added Kconfig, Makefiles etc.
Quoted 9 lines
Quoted 4 lines
And add clone,exec and exit while you're at it.
Hu? A syscall tracer sounds like a nice idea but that is not what I am trying to accomplish. I will let Systemtap handle that.
Systemtap doesn't help anyone as it's not in the tree. I haven't even asked you to provide a full system call tracing modulem but provide at least one that's useful for a certain use-case (looking at processes) instead of almost useless code.
---
~Randy
Phaedrus says that Quality is about caring.
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · David Wilder
Quoted 2 lines
NACK, don't put code into
Documentation/. Put it into kernel as it's actually useful kernel code.Are you suggesting moving the example code into kernel? Or complaining about example code in /Documentation?
Both. example code should be integrated with the build system so it gets built.
I agree, but I have not seen this done before, can you point me at an example of how to structure this?
Quoted 10 lines
Quoted 4 lines
And add clone,exec and exit while you're at it.
Hu? A syscall tracer sounds like a nice idea but that is not what I am trying to accomplish. I will let Systemtap handle that.
Systemtap doesn't help anyone as it's not in the tree. I haven't even asked you to provide a full system call tracing modulem but provide at least one that's useful for a certain use-case (looking at processes) instead of almost useless code.
I don't have a problem adding additional trace points to the example code. However, anyone trying to use the code for some real purpose will want to tweak the code based on their needs, at a minimum to select what data to trace. I don't think we gain much by adding more to the example other than to make it more complicated. I am strong believer in keeping example code as simple as possible.
If you are suggesting adding a separate feature for process tracing (not just an example) that is a good idea also. But is should be a separate patch, not part of the trace patch.