The content of this message was lost. It was probably cross-posted to multiple lists and previously handled on another list.
nit: s/reggistration/registration/ in subject
Also a MODULE_IMPORT_NS("DMA_BUF") needs to be added, since it now uses symbols from the DMA_BUF namespace, otherwise we got a build error
Splitting this trivial stub from the substantial parts in the next patch feels odd. Please merge them.
(and better commit logs and comments really would be useful for others to understand what you've done).
+const struct dma_buf_attach_ops nvme_dmabuf_importer_ops = {
- .move_notify = nvme_dmabuf_move_notify,
- .allow_peer2peer = true,
+};
Tab-align the =, please.
+static int nvme_init_dma_token(struct request_queue *q,
struct blk_mq_dma_token *token)+{
- struct dma_buf_attachment *attach;
- struct nvme_ns *ns = q->queuedata;
- struct nvme_dev *dev = to_nvme_dev(ns->ctrl);
- struct dma_buf *dmabuf = token->dmabuf;
- if (dmabuf->size % NVME_CTRL_PAGE_SIZE)
return -EINVAL;
Why do you care about alignment to the controller page size?
- for_each_sgtable_dma_sg(sgt, sg, tmp) {
dma_addr_t dma = sg_dma_address(sg);unsigned long sg_len = sg_dma_len(sg);while (sg_len) {dma_list[i++] = dma;dma += NVME_CTRL_PAGE_SIZE;sg_len -= NVME_CTRL_PAGE_SIZE;}- }
Why does this build controller pages sized chunks?
On Thu, Dec 04, 2025 at 03:00:02AM -0800, Christoph Hellwig wrote:
Why do you care about alignment to the controller page size?
- for_each_sgtable_dma_sg(sgt, sg, tmp) {
dma_addr_t dma = sg_dma_address(sg);unsigned long sg_len = sg_dma_len(sg);while (sg_len) {dma_list[i++] = dma;dma += NVME_CTRL_PAGE_SIZE;sg_len -= NVME_CTRL_PAGE_SIZE;}- }
Why does this build controller pages sized chunks?
I think the idea was that having fixed size entries aligned to the device's PRP unit is that it's efficient to jump to the correct index for any given offset. A vector of mixed sizes would require you walk the list to find the correct starting point, which we want to avoid.
This is similar to the way io_uring registered memory is set up, though io_uring has extra logic to use largest common contiguous segment size, or even just one segment if it coalesces. We could probably do that too.
Anyway, that representation naturally translates to the PRP format, but this could be done in the SGL format too.
linaro-mm-sig@lists.linaro.org