[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A72BD2D1-4D38-4F3E-B05F-A9002256BFBF@nutanix.com>
Date: Tue, 13 May 2025 02:14:45 +0000
From: Jon Kohler <jon@...anix.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: "pbonzini@...hat.com" <pbonzini@...hat.com>,
"tglx@...utronix.de"
<tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de"
<bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
Mickaël Salaün
<mic@...ikod.net>,
Sergey Dyasli <sergey.dyasli@...anix.com>
Subject: Re: [RFC PATCH 09/18] KVM: x86/mmu: Extend access bitfield in
kvm_mmu_page_role
> On May 12, 2025, at 2:32 PM, Sean Christopherson <seanjc@...gle.com> wrote:
>
> !-------------------------------------------------------------------|
> CAUTION: External Email
>
> |-------------------------------------------------------------------!
>
> On Thu, Mar 13, 2025, Jon Kohler wrote:
>> diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h
>> index 71d6fe28fafc..d9e22133b6d0 100644
>> --- a/arch/x86/kvm/mmu/spte.h
>> +++ b/arch/x86/kvm/mmu/spte.h
>> @@ -45,7 +45,9 @@ static_assert(SPTE_TDP_AD_ENABLED == 0);
>> #define ACC_EXEC_MASK 1
>> #define ACC_WRITE_MASK PT_WRITABLE_MASK
>> #define ACC_USER_MASK PT_USER_MASK
>> -#define ACC_ALL (ACC_EXEC_MASK | ACC_WRITE_MASK | ACC_USER_MASK)
>> +#define ACC_USER_EXEC_MASK (1ULL << 3)
>> +#define ACC_ALL (ACC_EXEC_MASK | ACC_WRITE_MASK | ACC_USER_MASK | \
>> + ACC_USER_EXEC_MASK)
>
> This is very subtly a massive change, and I'm not convinced its one we want to
> make. All usage in the non-nested TDP flows is arguably wrong, because KVM should
> never enable MBEC when using non-nested TDP.
>
> And the use in kvm_calc_shadow_ept_root_page_role() is wrong, because the root
> page role shouldn't include ACC_USER_EXEC_MASK if the associated VMCS doesn't
> have MBEC. Ditto for the use in kvm_calc_cpu_role().
>
> So I'm pretty sure the only bit of this change that is desriable/correct is the
> usage in kvm_mmu_page_get_access(). (And I guess maybe trace_mark_mmio_spte()?)
>
> Off the cuff, I don't know what the best approach is. One thought would be to
> prep for adding ACC_USER_EXEC_MASK to ACC_ALL by introducing ACC_RWX and using
> that where KVM really just wants to set RWX permissions. That would free up
> ACC_ALL for the few cases where KVM really truly wants to capture all access bits.
At first blush, I like this ACC_RWX idea. I’ll chew on that and see what
trouble I can get in.
Powered by blists - more mailing lists