Re: [PATCH 0/6] rust: page: Support borrowing `struct page` and physaddr conversion

From: David Hildenbrand
Date: Thu Feb 06 2025 - 13:05:47 EST


On 06.02.25 00:17, Matthew Wilcox wrote:
On Tue, Feb 04, 2025 at 04:49:47PM -0400, Jason Gunthorpe wrote:
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.

except for s390 & ppc where the page table can be smaller than
PAGE_SIZE, so you really only have a physical address that can be
converted to a virtual address.

I recall in the context of IOMMU page tables we don't perform this packing. So what you say is certainly true for process page tables, but likely not for IOMMU etc in the context of this series.

--
Cheers,

David / dhildenb