diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-04-21 17:45:06 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 11:48:47 +0300 |
commit | 0a5fff192388d2a74aa9ab5e0d394b745df9f225 (patch) | |
tree | 7d837d9673b746b3e869089b3753cf62361096dc /arch/x86/kvm/vmx.c | |
parent | 615d5193055880d44db92b72403b7549251ac2a6 (diff) | |
download | blackbird-op-linux-0a5fff192388d2a74aa9ab5e0d394b745df9f225.tar.gz blackbird-op-linux-0a5fff192388d2a74aa9ab5e0d394b745df9f225.zip |
KVM: Do not report TPR write to userspace if new value bigger or equal to a previous one.
Saves many exits to userspace in a case of IRQ chip in userspace.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9162b4cd3410..51f804c8fe79 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2724,13 +2724,18 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_set_cr4(vcpu, kvm_register_read(vcpu, reg)); skip_emulated_instruction(vcpu); return 1; - case 8: - kvm_set_cr8(vcpu, kvm_register_read(vcpu, reg)); - skip_emulated_instruction(vcpu); - if (irqchip_in_kernel(vcpu->kvm)) - return 1; - kvm_run->exit_reason = KVM_EXIT_SET_TPR; - return 0; + case 8: { + u8 cr8_prev = kvm_get_cr8(vcpu); + u8 cr8 = kvm_register_read(vcpu, reg); + kvm_set_cr8(vcpu, cr8); + skip_emulated_instruction(vcpu); + if (irqchip_in_kernel(vcpu->kvm)) + return 1; + if (cr8_prev <= cr8) + return 1; + kvm_run->exit_reason = KVM_EXIT_SET_TPR; + return 0; + } }; break; case 2: /* clts */ |