Re: [PATCH 1/3] KVM: nSVM: Use intuitive local variables in recalc_intercepts()
From: Sean Christopherson
Date: Wed Feb 04 2026 - 13:00:05 EST
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...