KVM: Replace 'light_exits' stat with 'host_state_reload'
authorAvi Kivity <avi@qumranet.com>
Sun, 18 Nov 2007 11:50:24 +0000 (13:50 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:53:04 +0000 (17:53 +0200)
This is a little more accurate (since it counts actual reloads, not potential
reloads), and reverses the sense of the statistic to measure a bad event like
most of the other stats (e.g. we want to minimize all counters).

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm.h
drivers/kvm/svm.c
drivers/kvm/vmx.c
drivers/kvm/x86.c

index 59e001c3ff096816bec9fc062b2ee8139955fb3c..04efe8833e090c9d74b3604937c5b4095349b62b 100644 (file)
@@ -246,7 +246,7 @@ struct kvm_stat {
        u32 halt_wakeup;
        u32 request_irq_exits;
        u32 irq_exits;
-       u32 light_exits;
+       u32 host_state_reload;
        u32 efer_reload;
 };
 
index a1a7f39ff3f1eed86f9a0a9a0329984d863b0fb7..0d32304944fc78252fb9d9f5ab5d62cd9958f31b 100644 (file)
@@ -654,6 +654,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
        struct vcpu_svm *svm = to_svm(vcpu);
        int i;
 
+       ++vcpu->stat.host_state_reload;
        for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
                wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
 
index 84c77fed9d17f1d8705693ac62b68c5e8831d9ab..7130f315afdf2b056b51c078eb956f1a6edc090c 100644 (file)
@@ -463,6 +463,7 @@ static void vmx_load_host_state(struct vcpu_vmx *vmx)
        if (!vmx->host_state.loaded)
                return;
 
+       ++vmx->vcpu.stat.host_state_reload;
        vmx->host_state.loaded = 0;
        if (vmx->host_state.fs_reload_needed)
                load_fs(vmx->host_state.fs_sel);
index b7c72ac3673594367f2824f0f239b876952f0d05..923dfd4e0afd85ff0cd2e33f02f56c40b4ba8065 100644 (file)
@@ -60,7 +60,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "halt_wakeup", STAT_OFFSET(halt_wakeup) },
        { "request_irq", STAT_OFFSET(request_irq_exits) },
        { "irq_exits", STAT_OFFSET(irq_exits) },
-       { "light_exits", STAT_OFFSET(light_exits) },
+       { "host_state_reload", STAT_OFFSET(host_state_reload) },
        { "efer_reload", STAT_OFFSET(efer_reload) },
        { NULL }
 };
@@ -1988,10 +1988,8 @@ again:
                        ++vcpu->stat.request_irq_exits;
                        goto out;
                }
-               if (!need_resched()) {
-                       ++vcpu->stat.light_exits;
+               if (!need_resched())
                        goto again;
-               }
        }
 
 out: