public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: nSVM: Use vcpu->arch.cr2 when updating vmcb12 on nested #VMEXIT
Date: Thu, 12 Feb 2026 10:14:07 -0800	[thread overview]
Message-ID: <aY4Yb3I3k1LOgn4O@google.com> (raw)
In-Reply-To: <rncblgei6isym2hsbw2jwgfpxwmpp5xbvfgoeut3fmvkbzzucj@eat3nisvyyoo>

On Wed, Feb 11, 2026, Yosry Ahmed wrote:
>  
> > So, with all of that in mind, I believe the best we can do is fully defer delivery
> > of the exception until it's actually injected, and then apply the quirk to the
> > relevant GET APIs.
> > @@ -5747,6 +5759,8 @@ static int kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu,
> >  	    vcpu->arch.guest_state_protected)
> >  		return -EINVAL;
> >  
> > +	kvm_handle_exception_payload_quirk(vcpu);
> > +
> >  	memset(dbgregs, 0, sizeof(*dbgregs));
> >  
> >  	BUILD_BUG_ON(ARRAY_SIZE(vcpu->arch.db) != ARRAY_SIZE(dbgregs->db));
> > @@ -12123,6 +12137,8 @@ static void __get_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
> >  	if (vcpu->arch.guest_state_protected)
> >  		goto skip_protected_regs;
> >  
> > +	kvm_handle_exception_payload_quirk(vcpu);
> > +
> 
> Hmm looking at this again, I realized it also affects the code path from
> store_regs(), I think we don't want to prematurely deliver exception
> payloads in that path.

Hrm, I actually think delivering the payload in store_regs() is the least awful
option.  E.g. a VMM that saves sregs on exit to userspace could elide KVM_GET_SREGS
when doing a save/restore.

In practice, it's all moot, because AFAICT nothing uses KVM_SYNC_X86_SREGS.

> So maybe it's best to move this to
> kvm_arch_vcpu_ioctl_get_sregs() and kvm_arch_vcpu_ioctl()?
> 
> The other option is to plumb a boolean that is only set to true in the
> ioctl code path.
> 
> >  	kvm_get_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
> >  	kvm_get_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
> >  	kvm_get_segment(vcpu, &sregs->es, VCPU_SREG_ES);
> > 
> > base-commit: 55671237401edd1ec59276b852b9361cc170915b
> > --

      reply	other threads:[~2026-02-12 18:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03  1:13 [PATCH] KVM: nSVM: Use vcpu->arch.cr2 when updating vmcb12 on nested #VMEXIT Yosry Ahmed
2026-02-03 15:33 ` Yosry Ahmed
2026-02-03 16:12 ` Sean Christopherson
2026-02-03 16:51   ` Yosry Ahmed
2026-02-03 18:03     ` Sean Christopherson
2026-02-03 19:08       ` Yosry Ahmed
2026-02-03 19:42         ` Sean Christopherson
2026-02-03 19:54           ` Yosry Ahmed
2026-02-11 20:40       ` Yosry Ahmed
2026-02-12 18:14         ` Sean Christopherson [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=aY4Yb3I3k1LOgn4O@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yosry.ahmed@linux.dev \
    /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