[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPbYdtRx6dMH52oO@google.com>
Date: Tue, 20 Jul 2021 15:06:46 +0100
From: Quentin Perret <qperret@...gle.com>
To: Fuad Tabba <tabba@...gle.com>
Cc: maz@...nel.org, james.morse@....com, alexandru.elisei@....com,
suzuki.poulose@....com, catalin.marinas@....com, will@...nel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org, ardb@...nel.org, qwandor@...gle.com,
dbrazdil@...gle.com, kernel-team@...roid.com
Subject: Re: [PATCH 08/14] KVM: arm64: Add support for tagging shared pages
in page-table
On Tuesday 20 Jul 2021 at 14:48:09 (+0100), Fuad Tabba wrote:
> This might tie in to Marc's comments for using enums, but
> consolidating the translation between prot and ignored/software bits
> in one place would be good: thinking about patch 10 as well, where you
> get the prot from the ignored bits. Even though you have documented
> it, I'm finding the part where a field can be borrowed and shared as
> opposed to being only shared not very intuitive, and I need to reread
> the comment here to remember the difference while going through the
> code.
>
> You also mention lending as potentially reserved for the future, but I
> think that lending is the other side of borrowing (depends on who's
> doing the giving/taking). I wonder if in this case it would be clearer
> to describe it in terms of whether it's exclusively owned vs owned but
> shared (for the owner), and just shared for the sharer...
Argh so I actually found the encoding pretty neat :/
The idea is the following:
- an entity that has a page mapped as SHARED in its PT means it
doesn't have exclusive access to the page;
- an entity that has a page mapped as BORROWED in its PT means it has
access to a page it doesn't own;
>From that we can build the states we need:
- when an entity shares a page with another, the original owner gets a
SHARED mapping, and the recipient a SHARED+BORROWED mapping.
- and in the future when/if we implement lending (which means an
entity gives exclusive access to a page to another entity, but
retains ownership) we can map the page in the recipient as
'BORROWED' only, but not 'SHARED'. And the original owner will have
an invalid mapping with a new state 'LENT', which is encoded with
both SW bits set.
How does that sound? Did you have something else in mind?
Thanks,
Quentin
Powered by blists - more mailing lists