lkml.org 
[lkml]   [2013]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/22] tools lib traceevent: Add kvm plugin
On Fri, 22 Nov 2013 23:45:24 +0900
Namhyung Kim <namhyung@kernel.org> 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;
> > +}
>



\
 
 \ /
  Last update: 2013-11-23 10:21    [W:0.106 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site