From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: dhowells@redhat.com, Andrew Lunn <andrew@lunn.ch>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
David Hildenbrand <david@redhat.com>,
John Hubbard <jhubbard@nvidia.com>,
Mina Almasry <almasrymina@google.com>,
willy@infradead.org, Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
netdev@vger.kernel.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: How to handle P2P DMA with only {physaddr,len} in bio_vec?
Date: Mon, 23 Jun 2025 11:50:58 +0100 [thread overview]
Message-ID: <1098395.1750675858@warthog.procyon.org.uk> (raw)
In-Reply-To: <2135907.1747061490@warthog.procyon.org.uk>
Hi Christoph,
Looking at the DMA address mapping infrastructure, it makes use of the page
struct to access the physical address (which obviously shouldn't be a problem)
and to find out if the page is involved in P2P DMA.
dma_direct_map_page() calls is_pci_p2pdma_page():
static inline bool is_pci_p2pdma_page(const struct page *page)
{
return IS_ENABLED(CONFIG_PCI_P2PDMA) &&
is_zone_device_page(page) &&
page_pgmap(page)->type == MEMORY_DEVICE_PCI_P2PDMA;
}
What's the best way to manage this without having to go back to the page
struct for every DMA mapping we want to make? Do we need to have
iov_extract_user_pages() note this in the bio_vec?
struct bio_vec {
physaddr_t bv_base_addr; /* 64-bits */
size_t bv_len:56; /* Maybe just u32 */
bool p2pdma:1; /* Region is involved in P2P */
unsigned int spare:7;
};
I'm guessing that only folio-type pages can be involved in this:
static inline struct dev_pagemap *page_pgmap(const struct page *page)
{
VM_WARN_ON_ONCE_PAGE(!is_zone_device_page(page), page);
return page_folio(page)->pgmap;
}
as only struct folio has a pointer to dev_pagemap? And I assume this is going
to get removed from struct page itself at some point soonish.
David
next prev parent reply other threads:[~2025-06-23 10:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1069540.1746202908@warthog.procyon.org.uk>
[not found] ` <165f5d5b-34f2-40de-b0ec-8c1ca36babe8@lunn.ch>
[not found] ` <0aa1b4a2-47b2-40a4-ae14-ce2dd457a1f7@lunn.ch>
[not found] ` <1015189.1746187621@warthog.procyon.org.uk>
[not found] ` <1021352.1746193306@warthog.procyon.org.uk>
2025-05-12 14:51 ` AF_UNIX/zerocopy/pipe/vmsplice/splice vs FOLL_PIN David Howells
2025-05-12 21:59 ` David Hildenbrand
2025-06-23 11:50 ` Christian Brauner
2025-06-23 13:53 ` Christoph Hellwig
2025-06-23 14:16 ` David Howells
2025-06-23 10:50 ` David Howells [this message]
2025-06-23 13:46 ` How to handle P2P DMA with only {physaddr,len} in bio_vec? Christoph Hellwig
2025-06-23 23:38 ` Alistair Popple
2025-06-24 9:02 ` David Howells
2025-06-24 12:18 ` Jason Gunthorpe
2025-06-24 12:39 ` Christoph Hellwig
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=1098395.1750675858@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=almasrymina@google.com \
--cc=andrew@lunn.ch \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=edumazet@google.com \
--cc=hch@infradead.org \
--cc=jhubbard@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--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
all inboxes | Powered by JetHome®