Re: [patch 09/10] timer/migration: Add tracepoints

From: Steven Rostedt
Date: Mon Apr 17 2017 - 15:09:48 EST


On Mon, 17 Apr 2017 20:32:50 +0200
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> The timer pull logic needs proper debuging aids. Add tracepoints so the
> hierarchical idle machinery can be diagnosed.
>
> Signed-off-by: Anna-Maria Gleixner <anna-maria@xxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> include/trace/events/timer_migration.h | 173 +++++++++++++++++++++++++++++++++
> kernel/time/timer_migration.c | 17 +++
> 2 files changed, 190 insertions(+)
>
> --- /dev/null
> +++ b/include/trace/events/timer_migration.h
> @@ -0,0 +1,173 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM timer_migration
> +
> +#if !defined(_TRACE_TIMER_MIGRATION_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_TIMER_MIGRATION_H
> +
> +#include <linux/tracepoint.h>
> +
> +/* Group events */
> +DECLARE_EVENT_CLASS(tmigr_group,
> +
> + TP_PROTO(struct tmigr_group *group),
> +
> + TP_ARGS(group),
> +
> + TP_STRUCT__entry(
> + __field( void *, group )
> + __field( unsigned int, lvl )
> + __field( unsigned int, numa_node )
> + __field( unsigned int, active )
> + __field( unsigned int, migrator )
> + __field( unsigned int, num_childs )
> + __field( void *, parent )
> + __field( u64, nextevt )
> + __field( unsigned int, evtcpu )

On 64 bit boxes, with long and pointers as 8 bytes and int is only 4
bytes, the above can be laid out better, as the above structure will
most likely create holes. Like a 4 byte one after num_childs. Perhaps
move num_childs down to above evtcpu. In other words, please pair ints
together when possible, between pointers and longs.

The order of the struct does not need to be the same as the order of
the output.

Thanks,

-- Steve

> + ),
> +
> + TP_fast_assign(
> + __entry->group = group;
> + __entry->lvl = group->level;
> + __entry->numa_node = group->numa_node;
> + __entry->active = group->active;
> + __entry->migrator = group->migrator;
> + __entry->num_childs = group->num_childs;
> + __entry->parent = group->parent;
> + __entry->nextevt = group->groupevt.nextevt.expires;
> + __entry->evtcpu = group->groupevt.cpu;
> + ),
> +
> + TP_printk("group=%p lvl=%d numa=%d active=%d migrator=%d num_childs=%d "
> + "parent=%p nextevt=%llu evtcpu=%d",
> + __entry->group, __entry->lvl, __entry->numa_node,
> + __entry->active, __entry->migrator, __entry->num_childs,
> + __entry->parent, __entry->nextevt, __entry->evtcpu)
> +);
> +