Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Baoli Zhang <baoli.zhang@linux.intel.com>
To: stable@vger.kernel.org
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Yanx L Liu <yanx.l.liu@intel.com>,
	Baoli Zhang <baoli.zhang@linux.intel.com>
Subject: [PATCH 6.18.y 0/4] KVM: x86: Fix DR6.BLD regression in guests
Date: Mon, 23 Nov 2026 20:14:23 +0800	[thread overview]
Message-ID: <20261123121427.2803358-1-baoli.zhang@linux.intel.com> (raw)

Hi,

a58917a271cb ("KVM: x86: Preserve DR6.BLD (Bus Lock Detect) when
delivering #DB payload"), upstream 719a1d58bf43, went into 6.18.61
without the rest of its upstream series. Since then kvm-unit-tests
x86/debug fails on hosts with Bus Lock Detect when the guest CPU model
doesn't have it, e.g. the default qemu64:

  FAIL: Wanted #DB on 0x400da7 w/ DR6 = 0xffff0ff4, got 1 #DBs, addr[0] = 0x400da7, DR6 = 0xffff07f4
  ...
  SUMMARY: 25 tests, 17 unexpected failures

Once KVM stops intercepting DR accesses, the guest's write of 0 to DR6
goes to hardware and clears BLD. sync_dirty_debug_regs() copies that into
vcpu->arch.dr6, and since a58917a271cb the #DB payload path no longer
sets BLD back, so the guest sees it cleared.

Later patches in the same series fix this upstream (v7.4-rc1). This
backports those two fixes and the two cleanups they depend on. Patch 3
needed a small change: 6.18 has no arch/x86/kvm/regs.h, so the new
declaration goes in asm/kvm_host.h.

Tested on an Intel host with bus_lock_detect with a 6.18.64-based kernel
whose DR6 handling matches v6.18.64: x86/debug goes from 17 failures to
all 25 passing.

7.3.y, 6.12.y, 6.6.y and 6.1.y picked up the same commit (in 7.3.2,
6.12.117, 6.6.163 and 6.1.193) and probably need these too. I haven't
tested those, but can send backports if wanted.

Thanks,
Baoli

Sean Christopherson (4):
  KVM: x86: Rename kvm_dr6_fixed() => kvm_get_dr6_fixed_1()
  KVM: Return an "unsigned long", not "u64" for the fixed-1 DR6 bits
  KVM: x86: Force fixed-1 bits in DR6 after synchronizing with hardware
  KVM: x86: Set guest's fixed-1 DR6 bits when delivering #DB payload

 arch/x86/include/asm/kvm_host.h | 1 +
 arch/x86/kvm/regs.c             | 7 ++++---
 arch/x86/kvm/x86.c              | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-11-23 12:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 12:14 Baoli Zhang [this message]
2026-11-23 12:14 ` [PATCH 6.18.y 1/4] KVM: x86: Rename kvm_dr6_fixed() => kvm_get_dr6_fixed_1() Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 2/4] KVM: Return an "unsigned long", not "u64" for the fixed-1 DR6 bits Baoli Zhang
2026-11-23 12:29   ` sashiko-bot
2026-11-23 12:14 ` [PATCH 6.18.y 3/4] KVM: x86: Force fixed-1 bits in DR6 after synchronizing with hardware Baoli Zhang
2026-11-23 12:14 ` [PATCH 6.18.y 4/4] KVM: x86: Set guest's fixed-1 DR6 bits when delivering #DB payload Baoli Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123121427.2803358-1-baoli.zhang@linux.intel.com \
    --to=baoli.zhang@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=yanx.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox