Re: [PATCH v3 09/10] KVM: selftests: Verify guest debug DR7.GD checking during instruction emulation

From: Sean Christopherson

Date: Wed May 20 2026 - 13:11:08 EST


On Fri, May 15, 2026, Sean Christopherson wrote:
> @@ -202,6 +207,22 @@ int main(void)
> run->debug.arch.pc, target_rip, run->debug.arch.dr6,
> target_dr6);
>
> + /* test global disable in emulation */
> + if (is_forced_emulation_enabled) {
> + /* Skip the 3-bytes "mov dr0" */
> + vcpu_skip_insn(vcpu, 3);
> + vcpu_run(vcpu);
> + TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
> + run->debug.arch.exception == DB_VECTOR &&
> + run->debug.arch.pc == CAST_TO_RIP(fep_bd_start) &&
> + run->debug.arch.dr6 == target_dr6,
> + "DR7.GD: exit %d exception %d rip 0x%llx "
> + "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
> + run->exit_reason, run->debug.arch.exception,
> + run->debug.arch.pc, target_rip, run->debug.arch.dr6,

Per Sashiko[*], this should print CAST_TO_RIP(fep_bd_start), not target_rip. I'll
fixup when applying.

[*] https://sashiko.dev/#/patchset/20260515222638.1949982-1-seanjc%40google.com

> + target_dr6);
> + }
> +
> /* Disable all debug controls, run to the end */
> memset(&debug, 0, sizeof(debug));
> vcpu_guest_debug_set(vcpu, &debug);
> --
> 2.54.0.563.g4f69b47b94-goog
>