diff options
author | Avi Kivity <avi@redhat.com> | 2009-09-01 05:34:07 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 11:11:04 -0400 |
commit | 3d53c27d05950390712f92c5ad1604c60190ed64 (patch) | |
tree | 37c93b2eaa334ccdeb0195f16d02cfc8cc0a22f7 /arch/x86/kvm/x86.c | |
parent | 6ba661787594868512a71c129062ebd57d0c01e7 (diff) |
KVM: Use thread debug register storage instead of kvm specific data
Instead of saving the debug registers from the processor to a kvm data
structure, rely in the debug registers stored in the thread structure.
This allows us not to save dr6 and dr7.
Reduces lightweight vmexit cost by 350 cycles, or 11 percent.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 35e7fc54de35..3e893c4fdd39 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3623,14 +3623,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
3623 | 3623 | ||
3624 | kvm_guest_enter(); | 3624 | kvm_guest_enter(); |
3625 | 3625 | ||
3626 | get_debugreg(vcpu->arch.host_dr6, 6); | ||
3627 | get_debugreg(vcpu->arch.host_dr7, 7); | ||
3628 | if (unlikely(vcpu->arch.switch_db_regs)) { | 3626 | if (unlikely(vcpu->arch.switch_db_regs)) { |
3629 | get_debugreg(vcpu->arch.host_db[0], 0); | ||
3630 | get_debugreg(vcpu->arch.host_db[1], 1); | ||
3631 | get_debugreg(vcpu->arch.host_db[2], 2); | ||
3632 | get_debugreg(vcpu->arch.host_db[3], 3); | ||
3633 | |||
3634 | set_debugreg(0, 7); | 3627 | set_debugreg(0, 7); |
3635 | set_debugreg(vcpu->arch.eff_db[0], 0); | 3628 | set_debugreg(vcpu->arch.eff_db[0], 0); |
3636 | set_debugreg(vcpu->arch.eff_db[1], 1); | 3629 | set_debugreg(vcpu->arch.eff_db[1], 1); |
@@ -3641,15 +3634,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
3641 | trace_kvm_entry(vcpu->vcpu_id); | 3634 | trace_kvm_entry(vcpu->vcpu_id); |
3642 | kvm_x86_ops->run(vcpu, kvm_run); | 3635 | kvm_x86_ops->run(vcpu, kvm_run); |
3643 | 3636 | ||
3644 | if (unlikely(vcpu->arch.switch_db_regs)) { | 3637 | if (unlikely(vcpu->arch.switch_db_regs || test_thread_flag(TIF_DEBUG))) { |
3645 | set_debugreg(0, 7); | 3638 | set_debugreg(current->thread.debugreg0, 0); |
3646 | set_debugreg(vcpu->arch.host_db[0], 0); | 3639 | set_debugreg(current->thread.debugreg1, 1); |
3647 | set_debugreg(vcpu->arch.host_db[1], 1); | 3640 | set_debugreg(current->thread.debugreg2, 2); |
3648 | set_debugreg(vcpu->arch.host_db[2], 2); | 3641 | set_debugreg(current->thread.debugreg3, 3); |
3649 | set_debugreg(vcpu->arch.host_db[3], 3); | 3642 | set_debugreg(current->thread.debugreg6, 6); |
3643 | set_debugreg(current->thread.debugreg7, 7); | ||
3650 | } | 3644 | } |
3651 | set_debugreg(vcpu->arch.host_dr6, 6); | ||
3652 | set_debugreg(vcpu->arch.host_dr7, 7); | ||
3653 | 3645 | ||
3654 | set_bit(KVM_REQ_KICK, &vcpu->requests); | 3646 | set_bit(KVM_REQ_KICK, &vcpu->requests); |
3655 | local_irq_enable(); | 3647 | local_irq_enable(); |