aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-04-19 10:27:43 -0400
committerAvi Kivity <avi@qumranet.com>2007-05-03 03:52:30 -0400
commit1165f5fec18c077bdba88e7125fd41f8e3617cb4 (patch)
treea1931bfddfabaa909f4ebd14a5c00a549d1e37ec /drivers/kvm/vmx.c
parent3fca03653010b8c5fa63b99fc94c78cbfb433d00 (diff)
KVM: Per-vcpu statistics
Make the exit statistics per-vcpu instead of global. This gives a 3.5% boost when running one virtual machine per core on my two socket dual core (4 cores total) machine. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r--drivers/kvm/vmx.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 37537af126d1..10845b7ff297 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1396,7 +1396,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1396 case EMULATE_DONE: 1396 case EMULATE_DONE:
1397 return 1; 1397 return 1;
1398 case EMULATE_DO_MMIO: 1398 case EMULATE_DO_MMIO:
1399 ++kvm_stat.mmio_exits; 1399 ++vcpu->stat.mmio_exits;
1400 kvm_run->exit_reason = KVM_EXIT_MMIO; 1400 kvm_run->exit_reason = KVM_EXIT_MMIO;
1401 return 0; 1401 return 0;
1402 case EMULATE_FAIL: 1402 case EMULATE_FAIL:
@@ -1425,7 +1425,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1425static int handle_external_interrupt(struct kvm_vcpu *vcpu, 1425static int handle_external_interrupt(struct kvm_vcpu *vcpu,
1426 struct kvm_run *kvm_run) 1426 struct kvm_run *kvm_run)
1427{ 1427{
1428 ++kvm_stat.irq_exits; 1428 ++vcpu->stat.irq_exits;
1429 return 1; 1429 return 1;
1430} 1430}
1431 1431
@@ -1492,7 +1492,7 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1492 unsigned long count; 1492 unsigned long count;
1493 gva_t address; 1493 gva_t address;
1494 1494
1495 ++kvm_stat.io_exits; 1495 ++vcpu->stat.io_exits;
1496 exit_qualification = vmcs_read64(EXIT_QUALIFICATION); 1496 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
1497 in = (exit_qualification & 8) != 0; 1497 in = (exit_qualification & 8) != 0;
1498 size = (exit_qualification & 7) + 1; 1498 size = (exit_qualification & 7) + 1;
@@ -1682,7 +1682,7 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu,
1682 if (kvm_run->request_interrupt_window && 1682 if (kvm_run->request_interrupt_window &&
1683 !vcpu->irq_summary) { 1683 !vcpu->irq_summary) {
1684 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN; 1684 kvm_run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
1685 ++kvm_stat.irq_window_exits; 1685 ++vcpu->stat.irq_window_exits;
1686 return 0; 1686 return 0;
1687 } 1687 }
1688 return 1; 1688 return 1;
@@ -1695,7 +1695,7 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1695 return 1; 1695 return 1;
1696 1696
1697 kvm_run->exit_reason = KVM_EXIT_HLT; 1697 kvm_run->exit_reason = KVM_EXIT_HLT;
1698 ++kvm_stat.halt_exits; 1698 ++vcpu->stat.halt_exits;
1699 return 0; 1699 return 0;
1700} 1700}
1701 1701
@@ -1956,7 +1956,7 @@ again:
1956 1956
1957 reload_tss(); 1957 reload_tss();
1958 } 1958 }
1959 ++kvm_stat.exits; 1959 ++vcpu->stat.exits;
1960 1960
1961#ifdef CONFIG_X86_64 1961#ifdef CONFIG_X86_64
1962 if (is_long_mode(vcpu)) { 1962 if (is_long_mode(vcpu)) {
@@ -1988,14 +1988,14 @@ again:
1988 if (r > 0) { 1988 if (r > 0) {
1989 /* Give scheduler a change to reschedule. */ 1989 /* Give scheduler a change to reschedule. */
1990 if (signal_pending(current)) { 1990 if (signal_pending(current)) {
1991 ++kvm_stat.signal_exits; 1991 ++vcpu->stat.signal_exits;
1992 post_kvm_run_save(vcpu, kvm_run); 1992 post_kvm_run_save(vcpu, kvm_run);
1993 kvm_run->exit_reason = KVM_EXIT_INTR; 1993 kvm_run->exit_reason = KVM_EXIT_INTR;
1994 return -EINTR; 1994 return -EINTR;
1995 } 1995 }
1996 1996
1997 if (dm_request_for_irq_injection(vcpu, kvm_run)) { 1997 if (dm_request_for_irq_injection(vcpu, kvm_run)) {
1998 ++kvm_stat.request_irq_exits; 1998 ++vcpu->stat.request_irq_exits;
1999 post_kvm_run_save(vcpu, kvm_run); 1999 post_kvm_run_save(vcpu, kvm_run);
2000 kvm_run->exit_reason = KVM_EXIT_INTR; 2000 kvm_run->exit_reason = KVM_EXIT_INTR;
2001 return -EINTR; 2001 return -EINTR;
@@ -2021,7 +2021,7 @@ static void vmx_inject_page_fault(struct kvm_vcpu *vcpu,
2021{ 2021{
2022 u32 vect_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); 2022 u32 vect_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
2023 2023
2024 ++kvm_stat.pf_guest; 2024 ++vcpu->stat.pf_guest;
2025 2025
2026 if (is_page_fault(vect_info)) { 2026 if (is_page_fault(vect_info)) {
2027 printk(KERN_DEBUG "inject_page_fault: " 2027 printk(KERN_DEBUG "inject_page_fault: "