KVM: stats: Add halt_wait_ns stats for all architectures
Add simple stats halt_wait_ns to record the time a VCPU has spent on waiting for all architectures (not just powerpc). Signed-off-by: Jing Zhang <jingzhangos@google.com> Message-Id: <20210802165633.1866976-5-jingzhangos@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d49b11f080
commit
87bcc5fa09
7 changed files with 8 additions and 5 deletions
|
@ -103,7 +103,6 @@ struct kvm_vcpu_stat {
|
||||||
u64 emulated_inst_exits;
|
u64 emulated_inst_exits;
|
||||||
u64 dec_exits;
|
u64 dec_exits;
|
||||||
u64 ext_intr_exits;
|
u64 ext_intr_exits;
|
||||||
u64 halt_wait_ns;
|
|
||||||
u64 halt_successful_wait;
|
u64 halt_successful_wait;
|
||||||
u64 dbell_exits;
|
u64 dbell_exits;
|
||||||
u64 gdbell_exits;
|
u64 gdbell_exits;
|
||||||
|
|
|
@ -69,7 +69,6 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
|
||||||
STATS_DESC_COUNTER(VCPU, emulated_inst_exits),
|
STATS_DESC_COUNTER(VCPU, emulated_inst_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, dec_exits),
|
STATS_DESC_COUNTER(VCPU, dec_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, ext_intr_exits),
|
STATS_DESC_COUNTER(VCPU, ext_intr_exits),
|
||||||
STATS_DESC_TIME_NSEC(VCPU, halt_wait_ns),
|
|
||||||
STATS_DESC_COUNTER(VCPU, halt_successful_wait),
|
STATS_DESC_COUNTER(VCPU, halt_successful_wait),
|
||||||
STATS_DESC_COUNTER(VCPU, dbell_exits),
|
STATS_DESC_COUNTER(VCPU, dbell_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, gdbell_exits),
|
STATS_DESC_COUNTER(VCPU, gdbell_exits),
|
||||||
|
|
|
@ -4144,7 +4144,7 @@ out:
|
||||||
|
|
||||||
/* Attribute wait time */
|
/* Attribute wait time */
|
||||||
if (do_sleep) {
|
if (do_sleep) {
|
||||||
vc->runner->stat.halt_wait_ns +=
|
vc->runner->stat.generic.halt_wait_ns +=
|
||||||
ktime_to_ns(cur) - ktime_to_ns(start_wait);
|
ktime_to_ns(cur) - ktime_to_ns(start_wait);
|
||||||
/* Attribute failed poll time */
|
/* Attribute failed poll time */
|
||||||
if (vc->halt_poll_ns)
|
if (vc->halt_poll_ns)
|
||||||
|
|
|
@ -67,7 +67,6 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
|
||||||
STATS_DESC_COUNTER(VCPU, emulated_inst_exits),
|
STATS_DESC_COUNTER(VCPU, emulated_inst_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, dec_exits),
|
STATS_DESC_COUNTER(VCPU, dec_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, ext_intr_exits),
|
STATS_DESC_COUNTER(VCPU, ext_intr_exits),
|
||||||
STATS_DESC_TIME_NSEC(VCPU, halt_wait_ns),
|
|
||||||
STATS_DESC_COUNTER(VCPU, halt_successful_wait),
|
STATS_DESC_COUNTER(VCPU, halt_successful_wait),
|
||||||
STATS_DESC_COUNTER(VCPU, dbell_exits),
|
STATS_DESC_COUNTER(VCPU, dbell_exits),
|
||||||
STATS_DESC_COUNTER(VCPU, gdbell_exits),
|
STATS_DESC_COUNTER(VCPU, gdbell_exits),
|
||||||
|
|
|
@ -1452,7 +1452,8 @@ struct _kvm_stats_desc {
|
||||||
STATS_DESC_COUNTER(VCPU_GENERIC, halt_poll_invalid), \
|
STATS_DESC_COUNTER(VCPU_GENERIC, halt_poll_invalid), \
|
||||||
STATS_DESC_COUNTER(VCPU_GENERIC, halt_wakeup), \
|
STATS_DESC_COUNTER(VCPU_GENERIC, halt_wakeup), \
|
||||||
STATS_DESC_TIME_NSEC(VCPU_GENERIC, halt_poll_success_ns), \
|
STATS_DESC_TIME_NSEC(VCPU_GENERIC, halt_poll_success_ns), \
|
||||||
STATS_DESC_TIME_NSEC(VCPU_GENERIC, halt_poll_fail_ns)
|
STATS_DESC_TIME_NSEC(VCPU_GENERIC, halt_poll_fail_ns), \
|
||||||
|
STATS_DESC_TIME_NSEC(VCPU_GENERIC, halt_wait_ns)
|
||||||
|
|
||||||
extern struct dentry *kvm_debugfs_dir;
|
extern struct dentry *kvm_debugfs_dir;
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct kvm_vcpu_stat_generic {
|
||||||
u64 halt_wakeup;
|
u64 halt_wakeup;
|
||||||
u64 halt_poll_success_ns;
|
u64 halt_poll_success_ns;
|
||||||
u64 halt_poll_fail_ns;
|
u64 halt_poll_fail_ns;
|
||||||
|
u64 halt_wait_ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define KVM_STATS_NAME_SIZE 48
|
#define KVM_STATS_NAME_SIZE 48
|
||||||
|
|
|
@ -3241,6 +3241,10 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
finish_rcuwait(&vcpu->wait);
|
finish_rcuwait(&vcpu->wait);
|
||||||
cur = ktime_get();
|
cur = ktime_get();
|
||||||
|
if (waited) {
|
||||||
|
vcpu->stat.generic.halt_wait_ns +=
|
||||||
|
ktime_to_ns(cur) - ktime_to_ns(poll_end);
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
kvm_arch_vcpu_unblocking(vcpu);
|
kvm_arch_vcpu_unblocking(vcpu);
|
||||||
block_ns = ktime_to_ns(cur) - ktime_to_ns(start);
|
block_ns = ktime_to_ns(cur) - ktime_to_ns(start);
|
||||||
|
|
Loading…
Add table
Reference in a new issue