Linux block layer
 help / color / mirror / Atom feed
From: Anuj Gupta/Anuj Gupta <anuj20.g@samsung.com>
To: Pavel Begunkov <asml.silence@gmail.com>, linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org,
	io-uring@vger.kernel.org, "Christoph Hellwig" <hch@lst.de>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Keith Busch" <kbusch@kernel.org>,
	"Sagi Grimberg" <sagi@grimberg.me>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jens Axboe" <axboe@kernel.dk>,
	"Nitesh Shetty" <nj.shetty@samsung.com>,
	"Kanchan Joshi" <joshi.k@samsung.com>,
	"Mike Snitzer" <snitzer@kernel.org>,
	"Mikulas Patocka" <mpatocka@redhat.com>,
	"Benjamin Marzinski" <bmarzins@redhat.com>,
	dm-devel@lists.linux.dev
Subject: Re: [PATCH v9 05/13] block: add dma-buf support for raw bdev
Date: Thu, 8 Oct 2026 17:57:47 +0530	[thread overview]
Message-ID: <bbb87d6b-b7a3-487a-8be4-27f3f9ce4a1b@samsung.com> (raw)
In-Reply-To: <af2b48a490186edf38f1d4a5dfd9513574f7a350.1791336930.git.asml.silence@gmail.com>

On 10/7/2026 7:12 AM, Pavel Begunkov wrote:
> +static int blkdev_init_dma_buf_io_ctx(struct file *file,
> +				      struct dma_buf_io_ctx *ctx)
> +{
> +	struct block_device *bdev = file_bdev(file);
> +	struct gendisk *disk = bdev->bd_disk;
> +
> +	if (!(file->f_flags & O_DIRECT))
> +		return -EINVAL;
> +	if (!disk->fops->init_dma_buf_io_ctx)
> +		return -EOPNOTSUPP;

dma-buf doesn't work with PI: bi_dmabuf_map aliases bi_io_vec, and 
blk_integrity_iterate() walks it as bvecs to generate/verify the 
checksum. rw-dmabuf liburing test hangs on a PI enabled NVMe. Something 
like below is needed:

diff --git a/block/blk-mq.c b/block/blk-mq.c
index e929f94b25c7..1b7f8cbbda8b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3150,6 +3150,12 @@ void blk_mq_submit_bio(struct bio *bio)
                 goto queue_exit;
         }

+       if (unlikely(op_is_dmabuf(bio->bi_opf) &&
+               bdev_has_integrity_csum(bio->bi_bdev))) {
+               bio_endio_status(bio, BLK_STS_NOTSUPP);
+               goto queue_exit;
+       }
+
         if ((bio->bi_opf & REQ_POLLED) && !blk_mq_can_poll(q)) {
                 bio_endio_status(bio, BLK_STS_NOTSUPP);
                 goto queue_exit;
diff --git a/block/fops.c b/block/fops.c
index e9da48ab73be..6c6700df943c 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -976,6 +976,8 @@ static int blkdev_init_dma_buf_io_ctx(struct file *file,
                 return -EINVAL;
         if (!disk->fops->init_dma_buf_io_ctx)
                 return -EOPNOTSUPP;
+       if (bdev_has_integrity_csum(bdev))
+               return -EOPNOTSUPP;
         return disk->fops->init_dma_buf_io_ctx(bdev, ctx);
  }


  reply	other threads:[~2026-10-08 12:27 UTC|newest]

Thread overview: 15+ 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:42 ` [PATCH v9 02/13] iov_iter: add iterator type for dmabuf maps Pavel Begunkov
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:42 ` [PATCH v9 05/13] block: add dma-buf support for raw bdev Pavel Begunkov
2026-10-08 12:27   ` Anuj Gupta/Anuj Gupta [this message]
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  1:42 ` [PATCH v9 08/13] nvme-pci: add SGL support for the dmabuf path Pavel Begunkov
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: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

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=bbb87d6b-b7a3-487a-8be4-27f3f9ce4a1b@samsung.com \
    --to=anuj20.g@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bmarzins@redhat.com \
    --cc=brauner@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=io-uring@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=joshi.k@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mpatocka@redhat.com \
    --cc=nj.shetty@samsung.com \
    --cc=sagi@grimberg.me \
    --cc=snitzer@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    /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