From: sashiko-bot@kernel.org
To: "Pavel Begunkov" <asml.silence@gmail.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v9 08/13] nvme-pci: add SGL support for the dmabuf path
Date: Wed, 07 Oct 2026 02:00:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-162577@kernel.org> (raw)
In-Reply-To: <0613da77bbb89c3128221ffed3a76af4817981cd.1791336930.git.asml.silence@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] nvme: redundant loop in dmabuf SGL chunk calculation executes only once
--
commit 5d24f863d7ba89114279230e25c2589da96688b4
Author: Anuj Gupta <anuj20.g@samsung.com>
nvme-pci: add SGL support for the dmabuf path
Add SGL support in addition to PRP for dmabuf-backed requests,
building the descriptor list from the mapping's sg_table.
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
[ ... ]
> +static unsigned int nvme_pci_dmabuf_sgl_nents(struct request *req)
> +{
[ ... ]
> + do {
> + size_t chunk = min(remaining, sg_len);
> +
> + nents++;
> + sg_len -= chunk;
> + remaining -= chunk;
> + } while (sg_len && remaining);
> + }
> +
> + if (unlikely(remaining))
[Severity: Low]
Since chunk is the minimum of remaining and sg_len, subtracting it from both
guarantees that at least one of them will become zero on the first iteration.
Does this mean the while (sg_len && remaining) condition is always false
immediately, making the loop execute exactly once?
Is there a missing SGL segment length cap that was intended here?
[ ... ]
> +static blk_status_t nvme_rq_setup_dmabuf_sgl(struct request *req,
> + struct nvme_queue *nvmeq, unsigned int entries)
> +{
[ ... ]
> + do {
> + u32 chunk = min_t(size_t, remaining, sg_len);
> +
> + if (WARN_ON_ONCE(mapped == entries))
> + goto err_free;
> + nvme_pci_sgl_set_data(&sg_list[mapped++], addr, chunk);
> +
> + addr += chunk;
> + sg_len -= chunk;
> + remaining -= chunk;
> + } while (sg_len && remaining);
> + }
[Severity: Low]
This mapping loop shares the same logic as nvme_pci_dmabuf_sgl_nents().
Since chunk will fully consume either remaining or sg_len, the loop condition
(sg_len && remaining) will evaluate to false after the first iteration.
Could this logic be simplified, or was a chunk size limit omitted?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791336930.git.asml.silence@gmail.com?part=8
next prev parent reply other threads:[~2026-10-07 2:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 1:42 [PATCH v9 00/13] Add dmabuf read/write via io_uring Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 01/13] dma-buf: introduce initial file I/O infrastructure Pavel Begunkov
2026-10-07 1:52 ` sashiko-bot
2026-10-07 1:42 ` [PATCH v9 02/13] iov_iter: add iterator type for dmabuf maps Pavel Begunkov
2026-10-07 1:57 ` sashiko-bot
2026-10-07 1:42 ` [PATCH v9 03/13] block: always adjust bi_offset on bio_advance_iter Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 04/13] block: introduce dma map backed bio type Pavel Begunkov
2026-10-07 1:59 ` sashiko-bot
2026-10-07 1:42 ` [PATCH v9 05/13] block: add dma-buf support for raw bdev Pavel Begunkov
2026-10-08 12:27 ` Anuj Gupta/Anuj Gupta
2026-10-07 1:42 ` [PATCH v9 06/13] nvme-pci: rename nvme_pci_sgl_set_data to nvme_pci_dma_iter_set_sgl Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 07/13] nvme-pci: implement dma-buf backed requests Pavel Begunkov
2026-10-07 2:01 ` sashiko-bot
2026-10-07 1:42 ` [PATCH v9 08/13] nvme-pci: add SGL support for the dmabuf path Pavel Begunkov
2026-10-07 2:00 ` sashiko-bot [this message]
2026-10-07 1:42 ` [PATCH v9 09/13] io_uring/rsrc: introduce buf registration structure Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 10/13] io_uring/rsrc: extend buffer update Pavel Begunkov
2026-10-07 1:51 ` sashiko-bot
2026-10-07 1:42 ` [PATCH v9 11/13] io_uring/rsrc: add uncloneable regbuf flag Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 12/13] io_uring/rsrc: add regbuf import flags Pavel Begunkov
2026-10-07 1:42 ` [PATCH v9 13/13] io_uring/rsrc: add dmabuf backed registered buffers Pavel Begunkov
2026-10-07 1:55 ` sashiko-bot
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=sashiko-outbox-162577@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=asml.silence@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@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