From: Yingjie Wang <x-professor@outlook.com>
To: "yangxiuwei@kylinos.cn" <yangxiuwei@kylinos.cn>
Cc: "mkp@kernel.org" <mkp@kernel.org>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"bvanassche@acm.org" <bvanassche@acm.org>,
"jthoughton@google.com" <jthoughton@google.com>,
"asml.silence@gmail.com" <asml.silence@gmail.com>,
"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v3 5/6] io_uring/cmd: allow reusing SQE storage for completion data
Date: Tue, 10 Nov 2026 12:24:38 +0000 [thread overview]
Message-ID: <20261110122434.4144043-1-x-professor@outlook.com> (raw)
In-Reply-To: <20261109025114.433681-1-yangxiuwei@kylinos.cn>
On Mon, 9 Nov 2026, Yang Xiuwei wrote:
> io_async_cmd is io_uring's own async state. sqes[] is what
> io_uring_cmd_sqe_copy() points ioucmd->sqe at. Giving that buffer to
> scsi_bsg couples the driver to the io_uring layout and lifetime.
Hi Yang,
Thanks for the review. scsi_bsg passes the required size to the helper
and gets a pointer to the storage back; it does not access io_async_cmd
or sqes[] directly. However, I agree that the helper constrains how
io_uring can reuse that internal storage.
The proposed contract is that, after a successful call, the requested
storage remains valid until io_uring_cmd_done*(). BSG requests 96 bytes;
the current implementation can provide up to 128 bytes. The caller
must also stop using the SQE and must not reissue the command, and
multishot commands cannot use the helper.
Jens, Pavel, would such a completion-storage contract be acceptable
for uring_cmd, or would you prefer the storage to be driver-owned?
> Preallocating the buffer in bsg itself may be a better fit.
Which object did you have in mind for the buffer? With 6/6, end-I/O
frees the request, and the tag can be reused before task work copies
the sense data. Storage that is reused along with the request or tag
would therefore have the same lifetime problem as scmd->sense_buffer.
Queue depth alone also does not bound the number of completed
commands waiting for task work once their tags have been released.
A BSG-owned pool would need a sizing and exhaustion policy.
bsg_open() currently allocates no per-file state.
If driver-owned storage is preferred, I can investigate a per-file
pool for v4. I would need to check that waiting for a free buffer
cannot prevent the task work that returns buffers from running.
Thanks,
Yingjie
next prev parent reply other threads:[~2026-11-10 12:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 9:50 [RFC PATCH v3 0/6] scsi: release completed passthrough requests before user copyback Yingjie Wang
2026-11-07 9:50 ` [RFC PATCH v3 1/6] scsi: core: release SG_IO request " Yingjie Wang
2026-11-07 9:50 ` [RFC PATCH v3 2/6] scsi: core: release legacy ioctl " Yingjie Wang
2026-11-07 9:50 ` [RFC PATCH v3 3/6] scsi: sr: release CDDA " Yingjie Wang
2026-11-07 9:50 ` [RFC PATCH v3 4/6] scsi: bsg: release synchronous " Yingjie Wang
2026-11-07 9:50 ` [RFC PATCH v3 5/6] io_uring/cmd: allow reusing SQE storage for completion data Yingjie Wang
2026-11-09 2:51 ` Yang Xiuwei
2026-11-10 12:24 ` Yingjie Wang [this message]
2026-11-11 0:36 ` Yang Xiuwei
2026-11-07 9:50 ` [RFC PATCH v3 6/6] scsi: bsg: release io_uring requests from end-I/O Yingjie Wang
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=20261110122434.4144043-1-x-professor@outlook.com \
--to=x-professor@outlook.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=io-uring@vger.kernel.org \
--cc=jthoughton@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=yangxiuwei@kylinos.cn \
/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®