Avi Kivity wrote:
> Only reload debug register 6 if we're running with the guest's
> debug registers.  Saves around 150 cycles from the guest lightweight
> exit path.
> 
> Signed-off-by: Avi Kivity <a...@redhat.com>
> ---
>  arch/x86/kvm/vmx.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 05cd554..70b0c54 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3629,7 +3629,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
>        */
>       vmcs_writel(HOST_CR0, read_cr0());
>  
> -     set_debugreg(vcpu->arch.dr6, 6);
> +     if (vcpu->arch.switch_db_regs)
> +             set_debugreg(vcpu->arch.dr6, 6);
>  
>       asm(
>               /* Store host registers */
> @@ -3731,7 +3732,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
>                                 | (1 << VCPU_EXREG_PDPTR));
>       vcpu->arch.regs_dirty = 0;
>  
> -     get_debugreg(vcpu->arch.dr6, 6);
> +     if (vcpu->arch.switch_db_regs)
> +             get_debugreg(vcpu->arch.dr6, 6);
>  
>       vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
>       if (vmx->rmode.irq.pending)

That reduces the emulation quality as vcpu->arch.switch_db_regs is only
set if some breakpoint is active while dr6 has its use also when that is
not the case).

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to