rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: David Hildenbrand <david@redhat.com>
Cc: "Asahi Lina" <lina@asahilina.net>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Jann Horn" <jannh@google.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Valentin Obst" <kernel@valentinobst.de>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org, airlied@redhat.com,
	"Abdiel Janulgue" <abdiel.janulgue@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	asahi@lists.linux.dev
Subject: Re: [PATCH 0/6] rust: page: Support borrowing `struct page` and physaddr conversion
Date: Tue, 4 Feb 2025 16:49:47 -0400	[thread overview]
Message-ID: <20250204204947.GM2296753@ziepe.ca> (raw)
In-Reply-To: <08ce9562-9ded-4d95-a495-b60f90d75490@redhat.com>

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

  parent reply	other threads:[~2025-02-04 20:49 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-02 13:05 [PATCH 0/6] rust: page: Support borrowing `struct page` and physaddr conversion Asahi Lina
2025-02-02 13:05 ` [PATCH 1/6] rust: types: Add Ownable/Owned types Asahi Lina
2025-02-03  9:13   ` Alice Ryhl
2025-02-03 14:17     ` Asahi Lina
2025-02-03 18:17       ` Alice Ryhl
2025-02-03 19:17         ` Asahi Lina
2025-02-19  8:34           ` Andreas Hindborg
2025-02-19  8:37   ` Andreas Hindborg
2025-02-02 13:05 ` [PATCH 2/6] rust: page: Convert to Ownable Asahi Lina
2025-02-03  9:17   ` Alice Ryhl
2025-02-03  9:39   ` Fiona Behrens
2025-02-19  8:46   ` Andreas Hindborg
2025-02-02 13:05 ` [PATCH 3/6] rust: page: Make with_page_mapped() and with_pointer_into_page() public Asahi Lina
2025-02-03  9:10   ` Alice Ryhl
2025-02-03  9:43   ` Fiona Behrens
2025-02-19  8:48   ` Andreas Hindborg
2025-02-02 13:05 ` [PATCH 4/6] rust: addr: Add a module to declare core address types Asahi Lina
2025-02-03  9:09   ` Alice Ryhl
2025-02-03 15:04   ` Boqun Feng
2025-02-04 11:50     ` Asahi Lina
2025-02-04 14:50       ` Boqun Feng
2025-02-19  8:51   ` Andreas Hindborg
2025-02-02 13:05 ` [PATCH 5/6] rust: page: Add physical address conversion functions Asahi Lina
2025-02-03  9:35   ` Alice Ryhl
2025-02-04 11:43     ` Asahi Lina
2025-02-03  9:53   ` Fiona Behrens
2025-02-03 10:01     ` Alice Ryhl
2025-02-19  9:06   ` Andreas Hindborg
2025-02-02 13:05 ` [PATCH 6/6] rust: page: Make Page::as_ptr() pub(crate) Asahi Lina
2025-02-03  9:08   ` Alice Ryhl
2025-02-19  9:08   ` Andreas Hindborg
2025-02-03  9:58 ` [PATCH 0/6] rust: page: Support borrowing `struct page` and physaddr conversion Simona Vetter
2025-02-03 14:32   ` Asahi Lina
2025-02-03 21:05     ` Zi Yan
2025-02-04 10:26       ` David Hildenbrand
2025-02-04 11:41         ` Asahi Lina
2025-02-04 11:59           ` David Hildenbrand
2025-02-04 13:05             ` Asahi Lina
2025-02-04 14:38               ` David Hildenbrand
2025-02-04 17:59                 ` Asahi Lina
2025-02-04 20:10                   ` David Hildenbrand
2025-02-04 21:06                     ` Asahi Lina
2025-02-06 17:58                       ` David Hildenbrand
2025-02-06 19:18                         ` Asahi Lina
2025-02-06 19:27                           ` Asahi Lina
2025-02-12 19:06                             ` David Hildenbrand
2025-02-12 19:01                           ` David Hildenbrand
2025-02-05  7:40                 ` Simona Vetter
2025-02-12 19:07                   ` David Hildenbrand
2025-02-04 10:33   ` David Hildenbrand
2025-02-04 18:39     ` Jason Gunthorpe
2025-02-04 19:01       ` Asahi Lina
2025-02-04 20:05       ` David Hildenbrand
2025-02-04 20:26         ` Jason Gunthorpe
2025-02-04 20:41           ` David Hildenbrand
2025-02-04 20:47             ` David Hildenbrand
2025-02-04 21:18               ` Asahi Lina
2025-02-06 18:02                 ` David Hildenbrand
2025-02-04 20:49             ` Jason Gunthorpe [this message]
2025-02-05 23:17               ` Matthew Wilcox
2025-02-06 18:04                 ` David Hildenbrand
2025-02-03 10:22 ` Danilo Krummrich
2025-02-03 14:41   ` Asahi Lina
2025-02-15 19:47     ` Asahi Lina
2025-02-17  8:50       ` Abdiel Janulgue
2025-02-19  9:24         ` Andreas Hindborg
  -- strict thread matches above, loose matches on Subject: below --
2025-03-06 19:21 Oliver Mangold

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=20250204204947.GM2296753@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=asahi@lists.linux.dev \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=david@redhat.com \
    --cc=gary@garyguo.net \
    --cc=jannh@google.com \
    --cc=kernel@valentinobst.de \
    --cc=lina@asahilina.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ojeda@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=wedsonaf@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;
as well as URLs for NNTP newsgroup(s).