Commit 2b110b61 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: Add blurb to CPUID tracepoint when using max basic leaf values

Tack on "used max basic" at the end of the CPUID tracepoint when the
output values correspond to the max basic leaf, i.e. when emulating
Intel's out-of-range CPUID behavior.  Observing "cpuid entry not found"
in the tracepoint with non-zero output values is confusing for users
that aren't familiar with the out-of-range semantics, and qualifying the
"not found" case hopefully makes it clear that "found" means "found the
exact entry".
Suggested-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e7adda28
...@@ -990,13 +990,15 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, ...@@ -990,13 +990,15 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,
{ {
u32 orig_function = *eax, function = *eax, index = *ecx; u32 orig_function = *eax, function = *eax, index = *ecx;
struct kvm_cpuid_entry2 *entry; struct kvm_cpuid_entry2 *entry;
bool exact; bool exact, used_max_basic = false;
entry = kvm_find_cpuid_entry(vcpu, function, index); entry = kvm_find_cpuid_entry(vcpu, function, index);
exact = !!entry; exact = !!entry;
if (!entry && !exact_only) if (!entry && !exact_only) {
entry = get_out_of_range_cpuid_entry(vcpu, &function, index); entry = get_out_of_range_cpuid_entry(vcpu, &function, index);
used_max_basic = !!entry;
}
if (entry) { if (entry) {
*eax = entry->eax; *eax = entry->eax;
...@@ -1026,7 +1028,8 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, ...@@ -1026,7 +1028,8 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,
} }
} }
} }
trace_kvm_cpuid(orig_function, index, *eax, *ebx, *ecx, *edx, exact); trace_kvm_cpuid(orig_function, index, *eax, *ebx, *ecx, *edx, exact,
used_max_basic);
return exact; return exact;
} }
EXPORT_SYMBOL_GPL(kvm_cpuid); EXPORT_SYMBOL_GPL(kvm_cpuid);
......
...@@ -153,8 +153,8 @@ TRACE_EVENT(kvm_fast_mmio, ...@@ -153,8 +153,8 @@ TRACE_EVENT(kvm_fast_mmio,
TRACE_EVENT(kvm_cpuid, TRACE_EVENT(kvm_cpuid,
TP_PROTO(unsigned int function, unsigned int index, unsigned long rax, TP_PROTO(unsigned int function, unsigned int index, unsigned long rax,
unsigned long rbx, unsigned long rcx, unsigned long rdx, unsigned long rbx, unsigned long rcx, unsigned long rdx,
bool found), bool found, bool used_max_basic),
TP_ARGS(function, index, rax, rbx, rcx, rdx, found), TP_ARGS(function, index, rax, rbx, rcx, rdx, found, used_max_basic),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( unsigned int, function ) __field( unsigned int, function )
...@@ -164,6 +164,7 @@ TRACE_EVENT(kvm_cpuid, ...@@ -164,6 +164,7 @@ TRACE_EVENT(kvm_cpuid,
__field( unsigned long, rcx ) __field( unsigned long, rcx )
__field( unsigned long, rdx ) __field( unsigned long, rdx )
__field( bool, found ) __field( bool, found )
__field( bool, used_max_basic )
), ),
TP_fast_assign( TP_fast_assign(
...@@ -174,12 +175,14 @@ TRACE_EVENT(kvm_cpuid, ...@@ -174,12 +175,14 @@ TRACE_EVENT(kvm_cpuid,
__entry->rcx = rcx; __entry->rcx = rcx;
__entry->rdx = rdx; __entry->rdx = rdx;
__entry->found = found; __entry->found = found;
__entry->used_max_basic = used_max_basic;
), ),
TP_printk("func %x idx %x rax %lx rbx %lx rcx %lx rdx %lx, cpuid entry %s", TP_printk("func %x idx %x rax %lx rbx %lx rcx %lx rdx %lx, cpuid entry %s%s",
__entry->function, __entry->index, __entry->rax, __entry->function, __entry->index, __entry->rax,
__entry->rbx, __entry->rcx, __entry->rdx, __entry->rbx, __entry->rcx, __entry->rdx,
__entry->found ? "found" : "not found") __entry->found ? "found" : "not found",
__entry->used_max_basic ? ", used max basic" : "")
); );
#define AREG(x) { APIC_##x, "APIC_" #x } #define AREG(x) { APIC_##x, "APIC_" #x }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment