All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Chenyi Qiang <chenyi.qiang@intel.com>
Subject: Re: [kvm-unit-tests PATCH v3 2/2] x86/vmx: (Re)Add a nVMX test to validate load/save of DEBUGCTL
Date: Thu, 28 May 2026 15:16:48 +0800	[thread overview]
Message-ID: <eef665f7-45d7-49ae-9cda-e8eb51a0ed4a@intel.com> (raw)
In-Reply-To: <20260527151232.4058615-3-seanjc@google.com>

On 5/27/2026 11:12 PM, Sean Christopherson wrote:
> From: Chenyi Qiang <chenyi.qiang@intel.com>
> 
> Add a nVMX test to verify that DEBUGCTL is/isn't loaded/saved on entry/exit
> as per vmcs12's controls.  Validate all combinations of legal values (only
> three bits are supported, i.e. there are only 8 unique combinations), for
> both the host and the guest, along with '0'.
> 
> Validate that:
> 
>   - DEBUGCTL is loaded from vmcs.GUEST_DEBUGCTL iff "Load debug controls"
>     is set, otherwise the guest should see the host's value.
>   - DEBUGCTL is saved to vmcs.GUEST_DEBUGCTL iff "Save debug controls" is
>     set, otherwise the VMCS should retain its previous value.
>   - DEBUGCTL is *always* zeroed on VM-Exit, irrespective of guest controls.
> 
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> Co-developed-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> +static void __vmx_debugctl_test(u64 host_val, u64 guest_val)
> +{
> +	u64 val, rand;
> +
> +	/* Validate VM-Entrywhen save/load debug controls are set */

missing a space between "VM-Entry" and "when".

But I don't understand why we need such a comment at all. Does it 
explain the purpose of following vmcs write is to validate that the two 
vmcs bits are allowed/supported on VM-Entry?

> +	vmcs_set_bits(ENT_CONTROLS, ENT_LOAD_DBGCTLS);
> +	vmcs_set_bits(EXI_CONTROLS, EXI_SAVE_DBGCTLS);

      parent reply	other threads:[~2026-05-28  7:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 15:12 [kvm-unit-tests PATCH v3 0/2] nVMX: Improve DEBUGCTL test coverage Sean Christopherson
2026-05-27 15:12 ` [kvm-unit-tests PATCH v3 1/2] nVMX: Remove the IA32_DEBUGCTLMSR access in debugctls test Sean Christopherson
2026-05-27 15:12 ` [kvm-unit-tests PATCH v3 2/2] x86/vmx: (Re)Add a nVMX test to validate load/save of DEBUGCTL Sean Christopherson
2026-05-27 15:19   ` Xiaoyao Li
2026-05-27 15:21     ` Sean Christopherson
2026-05-28  1:43   ` Chenyi Qiang
2026-05-28  7:16   ` Xiaoyao Li [this message]

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=eef665f7-45d7-49ae-9cda-e8eb51a0ed4a@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=chenyi.qiang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.