* kvm mmu tracing quirks
@ 2011-04-13 14:09 Jan Kiszka
2011-04-13 16:12 ` Avi Kivity
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2011-04-13 14:09 UTC (permalink / raw)
To: Xiao Guangrong; +Cc: kvm
Hi Xiao,
while tracing a guest with all events enabled, I notices some issues
with kvm mmu instrumentations. A critical one:
TRACE_EVENT(
kvm_mmu_audit,
TP_PROTO(struct kvm_vcpu *vcpu, int audit_point),
TP_ARGS(vcpu, audit_point),
TP_STRUCT__entry(
__field(struct kvm_vcpu *, vcpu)
__field(int, audit_point)
),
TP_fast_assign(
__entry->vcpu = vcpu;
__entry->audit_point = audit_point;
),
TP_printk("vcpu:%d %s", __entry->vcpu->cpu,
audit_point_name[__entry->audit_point])
);
Saving the vcpu reference to the trace buffer can break on dump if the
vcpu was destroyed in the meantime. I was about to fix that by saving
vcpu->cpu instead, but then I wondered what kind of information you
actually need here. The triggering host cpu is automatically recorded by
ftrace anyway. Can you comment on this / clean it up? Also, it would be
nice to use __print_symbolic for translating audit_point to a string as
that would also work for trace-cmd/kernelshark.
And then we have tracepoints for kvm_mmu_sync_page, kvm_mmu_unsync_page
and kvm_mmu_prepare_zap_page. All take a kvm_mmu_page as argument but do
nothing with it. On the other hand, the kvm plugin of trace-cmd expects
values like gfn, role, or unsync from those. Maybe you can have a look.
The latter topic is just for the sake of cleanness, but the former one
is actually problematic even if you are not interested in all mmu
details but only enable those events by chance.
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: kvm mmu tracing quirks
2011-04-13 14:09 kvm mmu tracing quirks Jan Kiszka
@ 2011-04-13 16:12 ` Avi Kivity
2011-04-14 3:47 ` Xiao Guangrong
0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2011-04-13 16:12 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xiao Guangrong, kvm
On 04/13/2011 05:09 PM, Jan Kiszka wrote:
> Hi Xiao,
>
> while tracing a guest with all events enabled, I notices some issues
> with kvm mmu instrumentations. A critical one:
>
> TRACE_EVENT(
> kvm_mmu_audit,
> TP_PROTO(struct kvm_vcpu *vcpu, int audit_point),
> TP_ARGS(vcpu, audit_point),
>
> TP_STRUCT__entry(
> __field(struct kvm_vcpu *, vcpu)
> __field(int, audit_point)
> ),
>
> TP_fast_assign(
> __entry->vcpu = vcpu;
> __entry->audit_point = audit_point;
> ),
>
> TP_printk("vcpu:%d %s", __entry->vcpu->cpu,
> audit_point_name[__entry->audit_point])
> );
>
> Saving the vcpu reference to the trace buffer can break on dump if the
> vcpu was destroyed in the meantime. I was about to fix that by saving
> vcpu->cpu instead, but then I wondered what kind of information you
> actually need here. The triggering host cpu is automatically recorded by
> ftrace anyway. Can you comment on this / clean it up? Also, it would be
> nice to use __print_symbolic for translating audit_point to a string as
> that would also work for trace-cmd/kernelshark.
>
IIRC the audit trace is only used to get a low cost invocation for the
audit machinery; it's not actually useful as a user tracepoint.
We should probably switch to static_branch() instead
(https://lwn.net/Articles/429447/).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: kvm mmu tracing quirks
2011-04-13 16:12 ` Avi Kivity
@ 2011-04-14 3:47 ` Xiao Guangrong
0 siblings, 0 replies; 3+ messages in thread
From: Xiao Guangrong @ 2011-04-14 3:47 UTC (permalink / raw)
To: Avi Kivity; +Cc: Jan Kiszka, kvm
On 04/14/2011 12:12 AM, Avi Kivity wrote:
> On 04/13/2011 05:09 PM, Jan Kiszka wrote:
>> Hi Xiao,
>>
>> while tracing a guest with all events enabled, I notices some issues
>> with kvm mmu instrumentations. A critical one:
>>
>> TRACE_EVENT(
>> kvm_mmu_audit,
>> TP_PROTO(struct kvm_vcpu *vcpu, int audit_point),
>> TP_ARGS(vcpu, audit_point),
>>
>> TP_STRUCT__entry(
>> __field(struct kvm_vcpu *, vcpu)
>> __field(int, audit_point)
>> ),
>>
>> TP_fast_assign(
>> __entry->vcpu = vcpu;
>> __entry->audit_point = audit_point;
>> ),
>>
>> TP_printk("vcpu:%d %s", __entry->vcpu->cpu,
>> audit_point_name[__entry->audit_point])
>> );
>>
>> Saving the vcpu reference to the trace buffer can break on dump if the
>> vcpu was destroyed in the meantime. I was about to fix that by saving
>> vcpu->cpu instead, but then I wondered what kind of information you
>> actually need here. The triggering host cpu is automatically recorded by
>> ftrace anyway. Can you comment on this / clean it up? Also, it would be
>> nice to use __print_symbolic for translating audit_point to a string as
>> that would also work for trace-cmd/kernelshark.
>>
Thanks you for pointing it out, Jan! The fix is good for me!
>
> IIRC the audit trace is only used to get a low cost invocation for the audit machinery; it's not actually useful as a user tracepoint.
>
Yes, it is.
> We should probably switch to static_branch() instead (https://lwn.net/Articles/429447/).
>
It's a good idea, i'll do that after static_branch merged!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-14 3:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13 14:09 kvm mmu tracing quirks Jan Kiszka
2011-04-13 16:12 ` Avi Kivity
2011-04-14 3:47 ` Xiao Guangrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox