Re: [PATCH V2 0/5] KVM: X86: permission_fault() for SMAP

From: Lai Jiangshan
Date: Tue Mar 15 2022 - 22:38:48 EST


On Wed, Mar 16, 2022 at 5:06 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 3/11/22 08:03, Lai Jiangshan wrote:
> > From: Lai Jiangshan<jiangshan.ljs@xxxxxxxxxxxx>
> >
> > Some change in permission_fault() for SMAP. It also reduces
> > calls two callbacks to get CPL and RFLAGS in come cases, but it
> > has not any measurable performance change in tests (kernel build
> > in guest).
>
> I am going to queue patches 1-4. The last one shouldn't really have any
> performance impact with static calls.
>

It is not about performance, it is about "less surprise".

The patchset was made due to it surprised me that "what the hell
is it when L0 is using L2's rflags when building shadow EPT/NPT for L1".

After some investigation, I knew the L2's rflags is "ignored" in a very
hidden and complicated way which relies on code in several other places.

I think some additional comment is necessary if that patch is not applied.