Re: [PATCH 07/22] tools lib traceevent: Add kvm plugin

From: Steven Rostedt
Date: Sat Nov 23 2013 - 04:15:58 EST


On Fri, 22 Nov 2013 23:45:24 +0900
Namhyung Kim <namhyung@xxxxxxxxxx> wrote:


> > + pevent_print_num_field(s, " root %u ", event,
> > + "root_count", record, 1);
> > +
> > + if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0)
> > + return -1;
>
> Hmm.. it seems this returning from the middle of function can make
> output hard to parse. How about printing 'unknown' if the field not
> found?

I wasn't fully correct in my last email. If the handler returns
anything but zero, the TP_print() will go in affect. Thus, if this
fails, then the default print will happen anyway.

It shouldn't fail. But yeah, we could think of adding "unknow" and such
too. That can go as a separate patch.

>
> > +
> > + trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0);
>
> Why did you print %c (0) at the end?

I simulated exactly what was (and still is) in the kvm tracepoint:

arch/x86/kvm/mmutrace.h:

trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s" \
" %snxe root %u %s%c", \
__entry->gfn, role.level, \
role.cr4_pae ? " pae" : "", \
role.quadrant, \
role.direct ? " direct" : "", \
access_str[role.access], \
role.invalid ? " invalid" : "", \
role.nxe ? "" : "!", \
__entry->root_count, \
__entry->unsync ? "unsync" : "sync", 0); \


-- Steve

>
> Thanks,
> Namhyung
>
>
> > + return 0;
> > +}
>

--
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/