Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62bea5bf authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

KVM: add halt_attempted_poll to VCPU stats



This new statistic can help diagnosing VCPUs that, for any reason,
trigger bad behavior of halt_poll_ns autotuning.

For example, say halt_poll_ns = 480000, and wakeups are spaced exactly
like 479us, 481us, 479us, 481us. Then KVM always fails polling and wastes
10+20+40+80+160+320+480 = 1110 microseconds out of every
479+481+479+481+479+481+479 = 3359 microseconds. The VCPU then
is consuming about 30% more CPU than it would use without
polling.  This would show as an abnormally high number of
attempted polling compared to the successful polls.

Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com&lt;>
Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 8f4216c7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ struct kvm_vm_stat {

struct kvm_vcpu_stat {
	u32 halt_successful_poll;
	u32 halt_attempted_poll;
	u32 halt_wakeup;
};

+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ struct kvm_vm_stat {

struct kvm_vcpu_stat {
	u32 halt_successful_poll;
	u32 halt_attempted_poll;
	u32 halt_wakeup;
};

+1 −0
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ struct kvm_vcpu_stat {
	u32 msa_disabled_exits;
	u32 flush_dcache_exits;
	u32 halt_successful_poll;
	u32 halt_attempted_poll;
	u32 halt_wakeup;
};

+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
	{ "msa_disabled", VCPU_STAT(msa_disabled_exits), KVM_STAT_VCPU },
	{ "flush_dcache", VCPU_STAT(flush_dcache_exits), KVM_STAT_VCPU },
	{ "halt_successful_poll", VCPU_STAT(halt_successful_poll), KVM_STAT_VCPU },
	{ "halt_attempted_poll", VCPU_STAT(halt_attempted_poll), KVM_STAT_VCPU },
	{ "halt_wakeup",  VCPU_STAT(halt_wakeup),	 KVM_STAT_VCPU },
	{NULL}
};
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ struct kvm_vcpu_stat {
	u32 dec_exits;
	u32 ext_intr_exits;
	u32 halt_successful_poll;
	u32 halt_attempted_poll;
	u32 halt_wakeup;
	u32 dbell_exits;
	u32 gdbell_exits;
Loading