Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Cheng <chengkev@google.com>,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: nSVM: Use intuitive local variables in recalc_intercepts()
Date: Wed, 4 Feb 2026 09:55:36 -0800	[thread overview]
Message-ID: <aYOIGDlPs3bHLVo4@google.com> (raw)
In-Reply-To: <gmdou4cp47vpx72tw3mwklwixpd3ujcdcomoplosv2u2tzfub2@wtqgzkhguoap>

On Wed, Feb 04, 2026, Yosry Ahmed wrote:
> On Wed, Feb 04, 2026 at 09:29:36AM -0800, Sean Christopherson wrote:
> > 
> > >  	for (i = 0; i < MAX_INTERCEPT; i++)
> > > -		c->intercepts[i] = h->intercepts[i];
> > > +		vmcb02->control.intercepts[i] = vmcb01->control.intercepts[i];
> > >  
> > > -	if (g->int_ctl & V_INTR_MASKING_MASK) {
> > > +	if (svm->nested.ctl.int_ctl & V_INTR_MASKING_MASK) {
> > 
> > I vote to keep a pointer to the cached control as vmcb12_ctrl.  Coming from a
> > nVMX-focused background, I can never remember what svm->nested.ctl holds.  For
> > me, this is waaaay more intuivite:
> 
> I agree it reads better, but honestly all of nSVM code uses svm->nested.ctl,
> and changing its name here just makes things inconsistent imo.

Gotta start somewhere :-)  In all seriousness, if we didn't allow chipping away
to at historical oddities in KVM, the code base would be a disaster.  I'm all for
prioritizing consistency, but I draw the line at "everything else sucks, so this
needs to suck too".

I'm not saying we need to do a wholesale rename, but giving at least
nested_vmcb02_prepare_control() the same treatment will be a huge improvement.
Actually, I'm going to go do that right now...

  reply	other threads:[~2026-02-04 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 18:20 [PATCH 0/3] nSVM: Minor cleanups for intercepts code Yosry Ahmed
2026-01-12 18:20 ` [PATCH 1/3] KVM: nSVM: Use intuitive local variables in recalc_intercepts() Yosry Ahmed
2026-02-04 17:29   ` Sean Christopherson
2026-02-04 17:43     ` Yosry Ahmed
2026-02-04 17:55       ` Sean Christopherson [this message]
2026-02-04 18:24         ` Yosry Ahmed
2026-01-12 18:20 ` [PATCH 2/3] KVM: nSVM: Rename recalc_intercepts() to clarify vmcb02 as the target Yosry Ahmed
2026-02-04 17:45   ` Sean Christopherson
2026-02-04 18:26     ` Yosry Ahmed
2026-01-12 18:20 ` [PATCH 3/3] KVM: nSVM: Use vmcb12_is_intercept() in nested_sync_control_from_vmcb02() Yosry Ahmed
2026-02-04 17:47 ` [PATCH 0/3] nSVM: Minor cleanups for intercepts code Sean Christopherson
2026-02-04 18:30   ` Yosry Ahmed

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=aYOIGDlPs3bHLVo4@google.com \
    --to=seanjc@google.com \
    --cc=chengkev@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