Re: [PATCH] Tracing events with GPIOs

From: Tom Zanussi
Date: Sat Dec 28 2013 - 21:28:51 EST


On Fri, 2013-12-27 at 10:51 -0600, Tom Zanussi wrote:
> On Fri, 2013-12-27 at 15:54 +0100, Jean-Jacques Hiblot wrote:
> > Hi Tom, Steven,
> >
> > I'm currently doing some tests with the event triggers
> > (git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> > for-next).
> > At the moment I can't use event triggers with probes dynamically
> > created (with perf probe or via
> > /sys/kernel/debug/tracing/kprobe_events)
> > Predefined probes like
> > /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger are working
> > fine.
> > Am I missing something ?
> >
>
> No, it's just that kprobes hasn't been hooked up yet to actually invoke
> the triggers.
>
> Let me look at doing that over the weekend...
>

OK, I just posted a patch to add trigger invocations to kprobes, which
you can also find here:

http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-contrib/log/?h=tzanussi/kprobes-event-triggers

I tested it a bit here, but it could use more, so please let me know how
it goes..

Tom


> Tom
>
> > example:
> >
> > ----------------------------------------------------------------
> > with a predefined probe
> > ----------------------------------------------------------------
> >
> > prompt> echo 'stacktrace' >
> > /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
> > prompt> ls
> > prompt> cat /sys/kernel/debug/tracing/trace
> > # tracer: nop
> > #
> > # entries-in-buffer/entries-written: 14/14 #P:1
> > #
> > # _-----=> irqs-off
> > # / _----=> need-resched
> > # | / _---=> hardirq/softirq
> > # || / _--=> preempt-depth
> > # ||| / delay
> > # TASK-PID CPU# |||| TIMESTAMP FUNCTION
> > # | | | |||| | |
> > ls-971 [000] .... 298.050000: <stack trace>
> > => ftrace_raw_event_kmem_alloc
> > => kmem_cache_alloc_trace
> > => do_execve
> > => SyS_execve
> > => ret_fast_syscall
> > ls-971 [000] .... 298.050000: <stack trace>
> > => ftrace_raw_event_kmem_alloc
> > => kmem_cache_alloc_trace
> > => load_elf_binary
> > [...]
> >
> > ----------------------------------------------------------------
> > with a dynamically defined probe
> > ----------------------------------------------------------------
> >
> > prompt> perf probe -a in_kmalloc=__kmalloc
> > prompt> echo 'stacktrace' >
> > /sys/kernel/debug/tracing/events/probe/in_kmalloc/trigger
> > prompt> perf record -e probe:in_kmalloc -aR sleep 10&
> > [... do something here ...]
> > prompt> perf report
> > [...]
> > # Samples: 24 of event 'probe:in_kmalloc'
> > # Event count (approx.): 24
> > #
> > # Overhead Command Shared Object Symbol
> > # ........ ....... ................. .............
> > #
> > 50.00% ls [kernel.kallsyms] [k] __kmalloc
> > 12.50% sleep [kernel.kallsyms] [k] __kmalloc
> > 12.50% sh [kernel.kallsyms] [k] __kmalloc
> > 12.50% perf [kernel.kallsyms] [k] __kmalloc
> > 12.50% more [kernel.kallsyms] [k] __kmalloc
> > [...]
> >
> > prompt> cat /sys/kernel/debug/tracing/trace
> > # tracer: nop
> > #
> > # entries-in-buffer/entries-written: 0/0 #P:1
> > #
> > # _-----=> irqs-off
> > # / _----=> need-resched
> > # | / _---=> hardirq/softirq
> > # || / _--=> preempt-depth
> > # random: nonblocking pool is initialized
> > ||| / delay
> > # TASK-PID CPU# |||| TIMESTAMP FUNCTION
> > # | | | |||| | |
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/