[PATCH v3] printk: add option to print cpu id

Steven Rostedt
2012-08-06T13:39:17Z

On Fri, Aug 03, 2012 at 03:48:26PM -0700, Pandita, Vikram wrote:
> On Fri, Aug 3, 2012 at 3:36 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Fri, Aug 03, 2012 at 03:25:17PM -0700, Pandita, Vikram wrote:
> >> >> This was something that got used internally and helped at times.
> >> >
> >> > Could you have used the trace point instead?
> >>
> >> As i understood the trace_prink(), one would need to modify existing
> >> printk -> trace_printk. Is my understanding correct?
> >
> > No, you should just be able to watch the tracepoint, right?
>
> yes.
> Assumption being you know _EXACTLY_ what code piece to watch for.
> Which may not be the case all times.

But it traces all printks.

# echo 1 > /sys/kernel/debug/tracing/events/printk/console/enable
# mount /home/rostedt
# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
modprobe-2707 [002] d..1 97.079458: console: [ 95.816945] NFS: Registering the id_resolver key type

modprobe-2707 [002] d..1 97.084534: console: [ 95.822038] Key type id_resolver registered

If you wanted this from boot up, you can just add to the kernel command line:

trace_event=console

-- Steve