Re: [PATCH 08/14] x86/entry: Optimize local_db_save() for virt
From: Sean Christopherson
Date: Tue Jun 02 2020 - 21:17:20 EST
On Fri, May 29, 2020 at 11:27:36PM +0200, Peter Zijlstra wrote:
> Because DRn access is 'difficult' with virt; but the DR7 read is
> cheaper than a cacheline miss on native, add a virt specific
> fast path to local_db_save(), such that when breakpoints are not in
> use we avoid touching DRn entirely.
>
> Suggested-by: Andy Lutomirski <luto@xxxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/debugreg.h | 7 ++++++-
> arch/x86/kernel/hw_breakpoint.c | 26 ++++++++++++++++++++++----
> arch/x86/kvm/vmx/nested.c | 2 +-
> 3 files changed, 29 insertions(+), 6 deletions(-)
...
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3028,9 +3028,9 @@ static int nested_vmx_check_vmentry_hw(s
> /*
> * VMExit clears RFLAGS.IF and DR7, even on a consistency check.
> */
> - local_irq_enable();
> if (hw_breakpoint_active())
> set_debugreg(__this_cpu_read(cpu_dr7), 7);
> + local_irq_enable();
> preempt_enable();
This should be a separate patch, probably with:
Cc: stable@xxxxxxxxxxxxxxx
Fixes: 52017608da33 ("KVM: nVMX: add option to perform early consistency checks via H/W")