[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204204947.GM2296753@ziepe.ca>
Date: Tue, 4 Feb 2025 16:49:47 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: David Hildenbrand <david@...hat.com>
Cc: Asahi Lina <lina@...hilina.net>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Jann Horn <jannh@...gle.com>, Matthew Wilcox <willy@...radead.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Danilo Krummrich <dakr@...nel.org>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Valentin Obst <kernel@...entinobst.de>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
airlied@...hat.com, Abdiel Janulgue <abdiel.janulgue@...il.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
asahi@...ts.linux.dev
Subject: Re: [PATCH 0/6] rust: page: Support borrowing `struct page` and
physaddr conversion
On Tue, Feb 04, 2025 at 09:41:29PM +0100, David Hildenbrand wrote:
> On 04.02.25 21:26, Jason Gunthorpe wrote:
> > On Tue, Feb 04, 2025 at 09:05:47PM +0100, David Hildenbrand wrote:
> > > Fully agreed, this is going into the right direction. Dumping what's mapped
> > > is a different story. Maybe that dumping logic could simply be written in C
> > > for the time being?
> >
> > ?
> >
> > Isn't dumping just a
> > decode pte -> phys_to_virt() -> for_each_u64(virt) -> printk?
> >
>
> IIUC, the problematic bit is that you might not have a directmap such that
> phys_to_virt() would tell you the whole story.
The phys_to_virt() I mean is on the page table pages themselves, not
on a leaf.
All page table pages came from alloc_pages_node() and you'd do
virt_to_phys() to stick them into a next-table PTE, then
phys_to_virt() to bring them back:
phys_to_virt(virt_to_phys(page_address(alloc_pages_node())))
Effectively.
The leaf pages could be anything and you should enver phys_to_virt
those, this is what I mean by:
> > Or do you mean trying to decode the leaf entires into some struct page
> > detail? Does a GPU need to do that? Agree that would be better as some
> > C function to take in a KVA instead of a struct page and populate a
> > string with details about that KVA from the struct page.
Though I should have said phys_addr_t not KVA
Jason
Powered by blists - more mailing lists