[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1A77268F-2781-407C-A35A-693F3A41AAE5@nutanix.com>
Date: Tue, 23 Dec 2025 04:15:41 +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 10:14 PM, Jon Kohler <jon@...anix.com> wrote:
>
>> On May 12, 2025, at 2:32 PM, Sean Christopherson <seanjc@...gle.com> wrote:
>>
>> 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.
Turns out, I got in a fair amount of trouble on this one. In v1, I’ve added a
prep patch that does this; however, I ended up having to revert it to get it to
work. I left the prep patch and the revert in the series to show my work on how
I got to that conclusion, but I’d appreciate some tips on how to resolve it. I
must just be missing something silly.
Powered by blists - more mailing lists