[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUu6nSk0jqpYpxoM@google.com>
Date: Wed, 8 Nov 2023 08:43:09 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Alexander Graf <graf@...zon.com>
Cc: Nicolas Saenz Julienne <nsaenz@...zon.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
pbonzini@...hat.com, vkuznets@...hat.com, anelkz@...zon.com,
dwmw@...zon.co.uk, jgowans@...zon.com, corbert@....net,
kys@...rosoft.com, haiyangz@...rosoft.com, decui@...rosoft.com,
x86@...nel.org, linux-doc@...r.kernel.org
Subject: Re: [RFC 25/33] KVM: Introduce a set of new memory attributes
On Wed, Nov 08, 2023, Alexander Graf wrote:
>
> On 08.11.23 12:17, Nicolas Saenz Julienne wrote:
> > Introduce the following memory attributes:
> > - KVM_MEMORY_ATTRIBUTE_READ
> > - KVM_MEMORY_ATTRIBUTE_WRITE
> > - KVM_MEMORY_ATTRIBUTE_EXECUTE
> > - KVM_MEMORY_ATTRIBUTE_NO_ACCESS
> >
> > Note that NO_ACCESS is necessary in order to make a distinction between
> > the lack of attributes for a gfn, which defaults to the memory
> > protections of the backing memory, versus explicitly prohibiting any
> > access to that gfn.
>
>
> If we negate the attributes (no read, no write, no execute), we can keep 0
> == default and 0b111 becomes "no access".
Yes, I suggested this in the initial discussion[*]. I think it makes sense to
have the uAPI flags have positive polarity, i.e. as above, but internally we can
invert things so that the default 000b gives full RWX protections. Or we could
make the push for a range-based xarray implementation so that storing 111b for
all gfns is super cheap.
Regardless of how KVM stores the information internally, there's no need for a
NO_ACCESS flag in the uAPI.
[*] https://lore.kernel.org/all/ZGfUqBLaO+cI9ypv@google.com
Powered by blists - more mailing lists