Re: [patch 4/4] KVM-trace port to tracepoints

From: Mathieu Desnoyers
Date: Thu Jul 17 2008 - 13:10:11 EST

* Anthony Liguori (anthony@xxxxxxxxxxxxx) wrote:
> Hi Mathieu,

Hi Anthony,

> It's difficult to review your patches because they aren't inlined.
> At any rate, this patches are unusable with SVM. They try to execute VT
> instructions unconditionally. For instance, you changed:
>> - KVMTRACE_1D(INTR, vcpu, vmcs_read32(VM_EXIT_INTR_INFO), handler);
>> + trace_kvm_intr(vcpu);
> Which lived in VT-specific code (vmx.c)
> To:
>> +static void probe_kvm_intr(struct kvm_vcpu *vcpu)
>> +{
>> + kvm_add_trace(KVM_TRC_INTR, vcpu, 1,
>> + (u32 []){ vmcs_read32(VM_EXIT_INTR_INFO) });
>> +}
>> +
> Which lives in common code (kvm_trace.c). But vmcs_read32() is VT-specific
> and should not be used in common code so this motion is wrong. Why not
> just pass more arguments to probe_kvm_intr()? Then your first two patches
> can be dropped completely.

Yes, I just noticed that I made a small mistake : the probe code should
actually go in arch/x86/kvm/kvm_trace_probes.c, which is x86-specific.

The reason why I would try to move the vmcs_read32(VM_EXIT_INTR_INFO) to
the probe code is because, unlike the Markers, when a function call with
potential side-effects is put within the arguments, it's really an
argument to a static inline function. In the markers, since it was a
parameter passed to a macro, I could shuffle it into the branch and it
would not be executed when markers were disabled.

However, we don't have this with tracepoints.

kvm-move-register-read-write-to-system-headers.patch becomes
obsolete since I put the probe code in arch/x86/kvm/.

But it would still be required to move vmcs read and encodings to
headers, either to include/asm-x86 or arch/x86/kvm.


> Regards,
> Anthony Liguori
> Mathieu Desnoyers wrote:

Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at