linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org,
	"Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: Re: [PATCH 1/2] s390: Convert gmap code to use ptdesc
Date: Fri, 20 Dec 2024 10:22:09 +0100	[thread overview]
Message-ID: <78662fe4-00ce-4927-ab62-4545bb6fc289@redhat.com> (raw)
In-Reply-To: <Z2SO6p5MJuPBUwRf@casper.infradead.org>

On 19.12.24 22:23, Matthew Wilcox wrote:
> On Thu, Dec 19, 2024 at 04:22:49PM +0000, Matthew Wilcox (Oracle) wrote:
>> There was originally some doubt about whether these page tables
>> should be represented by a vanilla struct page or whether they
>> should be a ptdesc.  As we continue on our quest to shrink
>> struct page, we seem to have crossed the line into believing that
>> thse page tables should be a ptdesc.  At least for now.
> 
> Looking at this patch some more, I'm not sure that pt_index is really
> what we should be calling this.  Would pt_gmap_addr make sense?  If
> not, what's the right name?

Let me try to refresh my memory.

(1) Ordinary gmap for running virtual machines

We set it to the guest physical address that this page table is 
responsible for. So we can easily translate from a given gmap page table 
+ offset back to the guest physical address.

We set it for PGD/P4D/PUD/PMD page tables in gmap_alloc_table(), and to 
0 for the highest level (which logically corresponds to guest physical 
address 0: page->index = 0).

We really only use it for PMD page tables in __gmap_segment_gaddr(), to 
calculate the guest physical address.

(PTE page tables are shared with the process space page tables, which is 
why we don't maually allocate them or set/get page->index)


(2) Shadow gmaps for nested virtualization

We set it to the guest physical address of the page table we are 
shadowing. Meaning, this gmap page table shadows a page table in guest 
physical address space, and we have to

We set it for all page table levels when shadowing them (when marking 
the to-be-shadowed page table R/O in the gmap so we can catch 
modifications).

We use it in gmap_shadow_pgt_lookup() to translate from a nested guest 
physical address to a guest physical address, required to resolve faults 
for our nested guest.

We only used "ptdesc->pt_index" in gmap_shadow_pgt() so far, because 
there we allocate PTE page tables as a shadow page table (not for user 
space page tables, though!).



Long story short, they are "guest physical addresses", which we simply 
call "gaddr" in that code. So "pt_gaddr" or "pt_gmap_gaddr" make sense. 
(we should fixup that one pt_index user)

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-12-20  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 16:22 [PATCH 0/2] s390: Remove uses of page->index Matthew Wilcox (Oracle)
2024-12-19 16:22 ` [PATCH 1/2] s390: Convert gmap code to use ptdesc Matthew Wilcox (Oracle)
2024-12-19 21:23   ` Matthew Wilcox
2024-12-20  9:22     ` David Hildenbrand [this message]
2024-12-19 16:22 ` [PATCH 2/2] s390: Convert vsie code to use page->private Matthew Wilcox (Oracle)
2024-12-20  9:55   ` David Hildenbrand
2024-12-20 11:40     ` Claudio Imbrenda
2024-12-19 16:33 ` [PATCH 0/2] s390: Remove uses of page->index David Hildenbrand
2024-12-19 16:52   ` Matthew Wilcox
2024-12-19 16:56     ` David Hildenbrand
2025-01-03 14:53 ` Claudio Imbrenda
2025-01-07 10:23   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78662fe4-00ce-4927-ab62-4545bb6fc289@redhat.com \
    --to=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=vishal.moola@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox