From: Logan Gunthorpe <logang@deltatee.com>
To: Koichiro Den <den@valinux.co.jp>,
ntb@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com
Subject: Re: [PATCH 1/4] NTB: ntb_transport: Handle remapped contiguous region in vmalloc space
Date: Mon, 27 Oct 2025 10:30:52 -0600 [thread overview]
Message-ID: <030a4195-ed20-4f5f-8841-ea5385bb4a8c@deltatee.com> (raw)
In-Reply-To: <20251027004331.562345-2-den@valinux.co.jp>
On 2025-10-26 18:43, Koichiro Den wrote:
> The RX buffer virtual address may reside in vmalloc space depending on
> the allocation path, where virt_to_page() is invalid.
>
> Use a helper that chooses vmalloc_to_page() or virt_to_page() as
> appropriate. This is safe since the buffer is guaranteed to be
> physically contiguous.
I think this statement needs some explanation.
vmalloc memory is generally not contiguous and using vmalloc_to_page()
like this seems very questionable.
I did a very quick look and found that "offset" may come from
dma_alloc_attrs() which can also return coherent memory that would be in
vmalloc space and would be contiguous.
However, in my cursory look, it appears that the kernel address returned
by dma_alloc_attrs() is eventually passed to dma_map_page() in order to
obtain the dma address a second time. This is really ugly, and almost
certainly not expected by the dma layer.
This requires a bit of a change, but it seems to me that if
dma_alloc_attrs() is used, the dma address it returns should be used
directly and a second map should be avoided completely. Then we wouldn't
need the unusual use of vmalloc_to_page().
At the very least, I think these issues need to be mentioned in the
commit message.
Logan
next prev parent reply other threads:[~2025-10-27 16:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 0:43 [PATCH 0/4] NTB: ntb_transport: DMA fixes and scalability improvements Koichiro Den
2025-10-27 0:43 ` [PATCH 1/4] NTB: ntb_transport: Handle remapped contiguous region in vmalloc space Koichiro Den
2025-10-27 16:30 ` Logan Gunthorpe [this message]
2025-10-28 1:14 ` Koichiro Den
2025-10-28 1:24 ` Koichiro Den
2025-10-28 15:45 ` Logan Gunthorpe
2025-10-29 7:14 ` Koichiro Den
2025-10-27 0:43 ` [PATCH 2/4] NTB: ntb_transport: Ack DMA memcpy descriptors to avoid wait-list growth Koichiro Den
2025-10-27 0:43 ` [PATCH 3/4] NTB: ntb_transport: Add module parameters use_tx_dma/use_rx_dma Koichiro Den
2025-10-27 0:43 ` [PATCH 4/4] NTB: ntb_transport: Support multi-channel DMA via module parameters Koichiro Den
2025-10-27 15:50 ` Dave Jiang
2025-10-28 1:17 ` Koichiro Den
2025-12-01 4:58 ` [PATCH 0/4] NTB: ntb_transport: DMA fixes and scalability improvements Koichiro Den
2025-12-01 19:04 ` Dave Jiang
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=030a4195-ed20-4f5f-8841-ea5385bb4a8c@deltatee.com \
--to=logang@deltatee.com \
--cc=allenbh@gmail.com \
--cc=dave.jiang@intel.com \
--cc=den@valinux.co.jp \
--cc=jdmason@kudzu.us \
--cc=linux-kernel@vger.kernel.org \
--cc=ntb@lists.linux.dev \
/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®