Re: [RFC PATCH 1/2] KVM: x86: Introduce KVM_{G, S}ET_ONE_REG uAPIs support

From: Sean Christopherson
Date: Wed Sep 11 2024 - 10:59:26 EST


On Wed, Sep 11, 2024, Nikolas Wipper wrote:
> On Wed Sep 11, 2024 at 04:36 PM UTC+0200, Sean Christopherson wrote:
> > On Wed, Sep 11, 2024, Nikolas Wipper wrote:
> >> Having this API, and specifically having a definite kvm_one_reg structure
> >> for x86 registers, would be interesting for register pinning/intercepts.
> >> With one_reg for x86 the API could be platform agnostic and possible even
> >> replace MSR filters for x86.
> >
> > I don't follow. MSR filters let userspace intercept accesses for a variety of
> > reasons, these APIs simply provide a way to read/write a register value that is
> > stored in KVM. I don't see how this could replace MSR filters.
>
> Nope, that would be an entirely different API, but if that uses one reg IDs it
> could be unified to cover CRs and MSRs all in one.

Oooh, gotcha. Yeah, uniquely identifiable registers would allow for a generic
filtering API, though I'm not entirely sure that's actually a good idea in the
long run. Most x86 registers can't be intercepted; having a generic filtering
API might incur an annoyingly high maintenance cost. Hmm, though it should be
easy enough to explicitly allow only MSR and CR types, so if/when we get to the
point where CR pinning/filtering is desirable/ready, then a unified API probably
does make sense.