From: Steven Rostedt <srostedt@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] trace-cmd: fix kvm_mmu_prepare_zap_page even name and kvm_mmu_get_page event output in kvm plugin
Date: Wed, 26 Dec 2012 09:22:32 -0500 [thread overview]
Message-ID: <1356531752.2750.10.camel@fedora> (raw)
In-Reply-To: <20121226141302.GJ17584@redhat.com>
On Wed, 2012-12-26 at 16:13 +0200, Gleb Natapov wrote:
> On Wed, Dec 26, 2012 at 08:58:30AM -0500, Steven Rostedt wrote:
> > On Tue, 2012-12-25 at 13:46 +0200, Gleb Natapov wrote:
> > > kvm_mmu_zap_page even was renamed to kvm_mmu_prepare_zap_page.
> > > Print out created field for kvm_mmu_get_page event.
> >
> > trace-cmd needs to be backward compatible with older kernels. If older
> > kernels used kvm_mmu_zap_page, then please add a check for that and have
> > the plugin cope with either one.
> >
> Something like this?
>
> if (pevent_find_event_by_name(pevent, "kvmmmu", "kvm_mmu_prepare_zap_page"))
> pevent_register_event_handler(pevent, -1, "kvmmmu",
> "kvm_mmu_prepare_zap_page", kvm_mmu_print_role,
> NULL);
> else
> pevent_register_event_handler(pevent, -1, "kvmmmu",
> "kvm_mmu_zap_page", kvm_mmu_print_role, NULL);
Sure, if it works.
>
> Also when trace-cmd encounters an event it does not recognize it prints
> mysterious message:
>
> trace-cmd: No such file or directory
> bad op token {
>
> Is this a bug?
>
Yes and no ;-)
I need to get rid of the "perror" part, for errors that don't set errno.
That's been on my todo list for a long time. Maybe when I come back to
work next week I'll fix that.
The 'bad op token {' happens when it tries to parse an event and it
comes across something that it doesn't recognize. In this case a '{'.
The kvm events are notorious with having extremely complex "print_fmt"
fields in their event format files. When no event handler is registered
for an event, trace-cmd uses the print_fmt to figure out how to print
it. This was never meant to be too complex of a parser. For example,
looking at my kvm_mmu_prepare_zap_page, we have:
print fmt: "%s", ({ const char *ret = p->buffer + p->len; static const char *access_str[] =
{ "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" }; union kvm_mmu_page_role role;
role.word = REC->role; trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s" " %snxe root %u
%s%c", REC->gfn, role.level, role.cr4_pae ? " pae" : "", role.quadrant, role.direct ? "
direct" : "", access_str[role.access], role.invalid ? " invalid" : "", role.nxe ? "" : "!",
REC->root_count, REC->unsync ? "unsync" : "sync", 0); ret; })
trace-cmd has no idea on how to parse "({ const char *ret ..." in fact
it dies on that first "{" because trace-cmd is not a full C parser.
This was why the plugins were created in the first place. To handle
various events that have too complex print_fmts for trace-cmd to
understand.
Most events are simple print_fmts and do not need plugins. Like
sock_rcvqueue_full:
print fmt: "rmem_alloc=%d truesize=%u sk_rcvbuf=%d", REC->rmem_alloc,
REC->truesize, REC->sk_rcvbuf
trace-cmd has no problem parsing events like that.
-- Steve
next prev parent reply other threads:[~2012-12-26 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-25 11:46 [PATCH] trace-cmd: fix kvm_mmu_prepare_zap_page even name and kvm_mmu_get_page event output in kvm plugin Gleb Natapov
2012-12-26 13:58 ` Steven Rostedt
2012-12-26 14:13 ` Gleb Natapov
2012-12-26 14:22 ` Steven Rostedt [this message]
2012-12-27 11:22 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356531752.2750.10.camel@fedora \
--to=srostedt@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.