Re: [PATCHv2] trace-cmd: add kvm_mmu_prepare_zap_page even and fix kvm_mmu_get_page event output in kvm plugin

Steven Rostedt
2013-01-28T15:23:52Z

On Mon, 2013-01-28 at 13:12 +0200, Gleb Natapov wrote:
> Ping.
>
> On Thu, Dec 27, 2012 at 01:34:15PM +0200, Gleb Natapov wrote:
> > kvm_mmu_zap_page event was renamed to kvm_mmu_prepare_zap_page. Add new
> > even, but leave the old one to parse older traces. Print out "created"
> > field for kvm_mmu_get_page event.
> >
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > diff --git a/plugin_kvm.c b/plugin_kvm.c
> > index 55812ef..9b376d8 100644
> > --- a/plugin_kvm.c
> > +++ b/plugin_kvm.c
> > @@ -382,7 +382,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
> > } else
> > trace_seq_printf(s, "WORD: %08x", role.word);
> >
> > - pevent_print_num_field(s, " root %u", event,
> > + pevent_print_num_field(s, " root %u ", event,
> > "root_count", record, 1);
> >
> > if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0)
> > @@ -397,6 +397,11 @@ static int kvm_mmu_get_page_handler(struct trace_seq *s, struct pevent_record *r
> > {
> > unsigned long long val;
> >
> > + if (pevent_get_field_val(s, event, "created", record, &val, 1) < 0)

Is "created" a new field? Or is it something that has always been there
but never displayed?

If it is new, then instead of returning '-1' if it's not found, could
you just ignore it. I don't want old kernels to start breaking on new
trace-cmd plugins.

Thanks,

-- Steve

> > + return -1;
> > +
> > + trace_seq_printf(s, "%s ", val ? "new" : "existing");
> > +
> > if (pevent_get_field_val(s, event, "gfn", record, &val, 1) < 0)
> > return -1;
> >
> > @@ -433,5 +438,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
> > pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
> > kvm_mmu_print_role, NULL);
> >
> > + pevent_register_event_handler(pevent, -1, "kvmmmu",
> > + "kvm_mmu_prepare_zap_page", kvm_mmu_print_role,
> > + NULL);
> > +
> > return 0;
> > }
> > --
> > Gleb.
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Gleb.