]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: X86: Tune PLE Window tracepoint
authorPeter Xu <peterx@redhat.com>
Fri, 6 Sep 2019 02:17:22 +0000 (10:17 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 10 Sep 2019 17:13:21 +0000 (19:13 +0200)
The PLE window tracepoint triggers even if the window is not changed,
and the wording can be a bit confusing too.  One example line:

  kvm_ple_window: vcpu 0: ple_window 4096 (shrink 4096)

It easily let people think of "the window now is 4096 which is
shrinked", but the truth is the value actually didn't change (4096).

Let's only dump this message if the value really changed, and we make
the message even simpler like:

  kvm_ple_window: vcpu 4 old 4096 new 8192 (growed)

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/trace.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

index f5b03d0c9bc61f901f28208637502d961ce7b487..9d8abe423a361614ce6024118a17c03bb8177ba9 100644 (file)
@@ -1266,11 +1266,11 @@ static void grow_ple_window(struct kvm_vcpu *vcpu)
                                                        pause_filter_count_grow,
                                                        pause_filter_count_max);
 
-       if (control->pause_filter_count != old)
+       if (control->pause_filter_count != old) {
                mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
-
-       trace_kvm_ple_window_grow(vcpu->vcpu_id,
-                                 control->pause_filter_count, old);
+               trace_kvm_ple_window_update(vcpu->vcpu_id,
+                                           control->pause_filter_count, old);
+       }
 }
 
 static void shrink_ple_window(struct kvm_vcpu *vcpu)
@@ -1284,11 +1284,11 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu)
                                                    pause_filter_count,
                                                    pause_filter_count_shrink,
                                                    pause_filter_count);
-       if (control->pause_filter_count != old)
+       if (control->pause_filter_count != old) {
                mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
-
-       trace_kvm_ple_window_shrink(vcpu->vcpu_id,
-                                   control->pause_filter_count, old);
+               trace_kvm_ple_window_update(vcpu->vcpu_id,
+                                           control->pause_filter_count, old);
+       }
 }
 
 static __init int svm_hardware_setup(void)
index a9e4e7f53b3f50c237367df0caccecea7f203f25..0c8cc141cffbf82032e5e8059a823a600b028206 100644 (file)
@@ -890,37 +890,27 @@ TRACE_EVENT(kvm_pml_full,
        TP_printk("vcpu %d: PML full", __entry->vcpu_id)
 );
 
-TRACE_EVENT(kvm_ple_window,
-       TP_PROTO(bool grow, unsigned int vcpu_id, unsigned int new,
-                unsigned int old),
-       TP_ARGS(grow, vcpu_id, new, old),
+TRACE_EVENT(kvm_ple_window_update,
+       TP_PROTO(unsigned int vcpu_id, unsigned int new, unsigned int old),
+       TP_ARGS(vcpu_id, new, old),
 
        TP_STRUCT__entry(
-               __field(                bool,      grow         )
                __field(        unsigned int,   vcpu_id         )
                __field(        unsigned int,       new         )
                __field(        unsigned int,       old         )
        ),
 
        TP_fast_assign(
-               __entry->grow           = grow;
                __entry->vcpu_id        = vcpu_id;
                __entry->new            = new;
                __entry->old            = old;
        ),
 
-       TP_printk("vcpu %u: ple_window %u (%s %u)",
-                 __entry->vcpu_id,
-                 __entry->new,
-                 __entry->grow ? "grow" : "shrink",
-                 __entry->old)
+       TP_printk("vcpu %u old %u new %u (%s)",
+                 __entry->vcpu_id, __entry->old, __entry->new,
+                 __entry->old < __entry->new ? "growed" : "shrinked")
 );
 
-#define trace_kvm_ple_window_grow(vcpu_id, new, old) \
-       trace_kvm_ple_window(true, vcpu_id, new, old)
-#define trace_kvm_ple_window_shrink(vcpu_id, new, old) \
-       trace_kvm_ple_window(false, vcpu_id, new, old)
-
 TRACE_EVENT(kvm_pvclock_update,
        TP_PROTO(unsigned int vcpu_id, struct pvclock_vcpu_time_info *pvclock),
        TP_ARGS(vcpu_id, pvclock),
index 715ed5bca4d98f92183d269a05bc87efc79cada0..9031fa0e7710545e0c7c0e4f4555ed8190849769 100644 (file)
@@ -5243,10 +5243,11 @@ static void grow_ple_window(struct kvm_vcpu *vcpu)
                                            ple_window_grow,
                                            ple_window_max);
 
-       if (vmx->ple_window != old)
+       if (vmx->ple_window != old) {
                vmx->ple_window_dirty = true;
-
-       trace_kvm_ple_window_grow(vcpu->vcpu_id, vmx->ple_window, old);
+               trace_kvm_ple_window_update(vcpu->vcpu_id,
+                                           vmx->ple_window, old);
+       }
 }
 
 static void shrink_ple_window(struct kvm_vcpu *vcpu)
@@ -5258,10 +5259,11 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu)
                                              ple_window_shrink,
                                              ple_window);
 
-       if (vmx->ple_window != old)
+       if (vmx->ple_window != old) {
                vmx->ple_window_dirty = true;
-
-       trace_kvm_ple_window_shrink(vcpu->vcpu_id, vmx->ple_window, old);
+               trace_kvm_ple_window_update(vcpu->vcpu_id,
+                                           vmx->ple_window, old);
+       }
 }
 
 /*
index 605f9902f1643fee1f7083b721ea283ec2285385..6c73bf6b401e329c0ef680377f18e8ee1e9eb918 100644 (file)
@@ -10098,7 +10098,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_write_tsc_offset);
-EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ple_window);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ple_window_update);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pml_full);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pi_irte_update);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_unaccelerated_access);