lkml.org 
[lkml]   [2021]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2021-07-20 16:14    [W:0.106 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site