Re: [PATCH V2 1/5] KVM: SVM: Move STGI and CLGI intercept handling
From: Sean Christopherson
Date: Thu Jan 15 2026 - 12:29:42 EST
On Thu, Jan 15, 2026, Yosry Ahmed wrote:
> On Thu, Jan 15, 2026 at 09:00:07AM -0800, Sean Christopherson wrote:
> > On Thu, Jan 15, 2026, Yosry Ahmed wrote:
> > > Or maybe it's clearer if we just put the checks in a helper like
> > > svm_waiting_for_gif() or svm_pending_gif_interrupt().
> >
> > This was my first idea as well, though I would name it svm_has_pending_gif_event()
> > to better align with kvm_vcpu_has_events().
>
> svm_has_pending_gif_event() sounds good.
>
> >
> > I suggested a single helper because I don't love that how to react to the pending
> > event is duplicated. But I definitely don't object to open coding the request if
> > the consensus is that it's more readable overall.
>
> A single helper is nice, but I can't think of a name that would read
> well. My first instinct is svm_check_pending_gif_event(), but we are not
> really checking the event as much as requesting for it to be checked.
Ya, that's the same problem I'm having. I can't even come up with an absurdly
verbose name to describe the behavior.
> We can do svm_request_gif_event(), perhaps? Not sure if that's better or
> worse than svm_has_pending_gif_event().
Definitely worse in my opinion. My entire motivation for a single helper would
be to avoid bleeding implementation details (use of KVM_REQ_EVENT) to trigger
the potential re-evaluation STGI/CLGI intercepts. And then there's the fact that
in most cases, there probably isn't a pending event, i.e. not request will be
made.
Let's just go with svm_has_pending_gif_event().