Re: [PATCH v2 0/9] KVM: x86: Improve the handling of debug exceptions during instruction emulation
From: Sean Christopherson
Date: Mon May 11 2026 - 11:51:55 EST
On Thu, Dec 18, 2025, Hou Wenlong wrote:
> Hou Wenlong (9):
> KVM: x86: Capture "struct x86_exception" in
> inject_emulated_exception()
> KVM: x86: Set guest DR6 by kvm_queue_exception_p() in instruction
> emulation
> KVM: x86: Check guest debug in DR access instruction emulation
> KVM: x86: Only check effective code breakpoint in emulation
> KVM: x86: Consolidate KVM_GUESTDBG_SINGLESTEP check into the
> kvm_inject_emulated_db()
> KVM: x86: Move kvm_set_rflags() up before kvm_vcpu_do_singlestep()
> KVM: VMX: Refresh 'PENDING_DBG_EXCEPTIONS.BS' bit during instruction
> emulation
> KVM: selftests: Verify guest debug DR7.GD checking during instruction
> emulation
> KVM: selftests: Verify 'BS' bit checking in pending debug exception
> during VM entry
>
> arch/x86/include/asm/kvm-x86-ops.h | 1 +
> arch/x86/include/asm/kvm_host.h | 1 +
> arch/x86/kvm/emulate.c | 14 +--
> arch/x86/kvm/kvm_emulate.h | 7 +-
> arch/x86/kvm/vmx/main.c | 9 ++
> arch/x86/kvm/vmx/vmx.c | 15 ++-
> arch/x86/kvm/vmx/x86_ops.h | 1 +
> arch/x86/kvm/x86.c | 116 ++++++++++--------
> arch/x86/kvm/x86.h | 7 ++
> .../selftests/kvm/include/x86/processor.h | 3 +-
> tools/testing/selftests/kvm/x86/debug_regs.c | 72 ++++++++++-
> 11 files changed, 178 insertions(+), 68 deletions(-)
One goof and some nits on patch 3, but I'll fix them up when applying, i.e. no
need for a v3. I'll probably also add some comments and elaborate on some of
the changelogs.