Skip to contentSkip to conversation

kvmmmu tracing

DISCUSSION Johannes Berg 3 participants 8 messages Nov 23, 2009 – Nov 24, 2009 KVM

lore
Share & tools
lore
#0 lore raw

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Maybe we should have a "unsafe for export" flag for events, if they do strange things like that?

As it stands, I can't use trace-cmd on an x86 machine that has kvm enabled because it will try to read all the kvm stuff. Arguably, it should only try to parse it when it needs it (i.e. not for me) but still it's very inconvenient to export something to userspace that it cannot possibly understand.

johannes

#1 lore raw
Quoted 4 lines · Johannes Berg

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Quoted 8 lines

Maybe we should have a "unsafe for export" flag for events, if they do strange things like that?

As it stands, I can't use trace-cmd on an x86 machine that has kvm enabled because it will try to read all the kvm stuff. Arguably, it should only try to parse it when it needs it (i.e. not for me) but still it's very inconvenient to export something to userspace that it cannot possibly understand.

Note, I updated trace-cmd. I still does not read this macro nicely, but it at least does not fail anymore.

-- Steve

#2 lore raw
Quoted 8 lines · Steven Rostedt
Quoted 7 lines · Johannes Berg

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Maybe we should have a "unsafe for export" flag for events, if they do strange things like that?

Quoted 8 lines
Quoted 5 lines

As it stands, I can't use trace-cmd on an x86 machine that has kvm enabled because it will try to read all the kvm stuff. Arguably, it should only try to parse it when it needs it (i.e. not for me) but still it's very inconvenient to export something to userspace that it cannot possibly understand.

Note, I updated trace-cmd. I still does not read this macro nicely, but it at least does not fail anymore.

Ah, good to know. So I guess I don't care any more since I'm not actually tracing this. However, since trace-cmd is very convenient for record + send-by-email + report/analyse, it might make sense to fix anyway.

johannes

#3 lore raw
In reply to Johannes Berg
Quoted 5 lines · Johannes Berg

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Can you explain what is wrong with it?

Quoted 9 lines

Maybe we should have a "unsafe for export" flag for events, if they do strange things like that?

As it stands, I can't use trace-cmd on an x86 machine that has kvm enabled because it will try to read all the kvm stuff. Arguably, it should only try to parse it when it needs it (i.e. not for me) but still it's very inconvenient to export something to userspace that it cannot possibly understand.

Is userspace reading mmutrace.h? When the structure attributes can be exported via /sys/kernel/debug/tracing?

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Johannes Berg

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Can you explain what is wrong with it?

It's a big C expression that trace-cmd can't parse :)

Quoted 2 lines

Is userspace reading mmutrace.h? When the structure attributes can be exported via /sys/kernel/debug/tracing?

Yes ... look
at /sys/kernel/debug/tracing/events/kvmmmu/kvm_mmu_unsync_page/format for instance.

johannes

#5 lore raw
Quoted 10 lines · Johannes Berg
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Johannes Berg

Commit f691fe1da7e2715137d21ae5a80bec64db4625db is really broken wrt. the userspace interface for tracing because of the weird KVM_MMU_PAGE_PRINTK macro.

Quoted 4 lines
Quoted 2 lines

Can you explain what is wrong with it?

It's a big C expression that trace-cmd can't parse :)

Um, C can be easily parsed with a C compiler. I don't think you can expect it to be a plain format string and argument list.

Quoted 7 lines
Quoted 3 lines

Is userspace reading mmutrace.h? When the structure attributes can be exported via /sys/kernel/debug/tracing?

Yes ... look
at /sys/kernel/debug/tracing/events/kvmmmu/kvm_mmu_unsync_page/format for instance.

You can fall back to using the attributes to build your own format string.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw
Quoted 2 lines · Avi Kivity

Um, C can be easily parsed with a C compiler. I don't think you can expect it to be a plain format string and argument list.

Actually, it turns out that it cannot be parsed even with a C compiler:

({ 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;

...

userspace cannot possibly know from this what "union kvm_mmu_page_role" is.

johannes

#7 lore raw
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Avi Kivity

Um, C can be easily parsed with a C compiler. I don't think you can expect it to be a plain format string and argument list.

Actually, it turns out that it cannot be parsed even with a C compiler:

Quoted 9 lines

({ 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;

...

userspace cannot possibly know from this what "union kvm_mmu_page_role" is.

We can expose kvm_mmu_page_role, but that's a new can of worms. And it's certainly not meant to be stable across kernel versions.

Signature · 1 line
error compiling committee.c: too many arguments to function