Re: [PATCH v6 4/4] KVM: nSVM: implement on demand allocation of the nested state

From: Sean Christopherson
Date: Wed Sep 30 2020 - 20:27:06 EST


On Wed, Sep 30, 2020 at 06:35:40PM +0300, Maxim Levitsky wrote:
> On Mon, 2020-09-28 at 22:15 -0700, Sean Christopherson wrote:
> > Side topic, do we actually need 'initialized'? Wouldn't checking for a
> > valid nested.msrpm or nested.hsave suffice?
>
> It a matter of taste - I prefer to have a single variable controlling this,
> rather than two.
> a WARN_ON(svm->nested.initialized && !svm->nested.msrpm || !svm->nested.hsave))
> would probably be nice to have. IMHO I rather leave this like it is if you
> don't object.

I don't have a strong preference. I wouldn't bother with the second WARN_ON.
Unless you take action, e.g. bail early, a NULL pointer will likely provide a
stack trace soon enough :-).