Skip to content

Commit 08652bd

Browse files
ps-ushankaraxboe
authored andcommitted
Documentation: ublk: document UBLK_F_PER_IO_DAEMON
Explain the restrictions imposed on ublk servers in two cases: 1. When UBLK_F_PER_IO_DAEMON is set (current ublk_drv) 2. When UBLK_F_PER_IO_DAEMON is not set (legacy) Remove most references to per-queue daemons, as the new UBLK_F_PER_IO_DAEMON feature renders that concept obsolete. Signed-off-by: Uday Shankar <[email protected]> Reviewed-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 17574aa commit 08652bd

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

Documentation/block/ublk.rst

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ managing and controlling ublk devices with help of several control commands:
115115

116116
- ``UBLK_CMD_START_DEV``
117117

118-
After the server prepares userspace resources (such as creating per-queue
119-
pthread & io_uring for handling ublk IO), this command is sent to the
118+
After the server prepares userspace resources (such as creating I/O handler
119+
threads & io_uring for handling ublk IO), this command is sent to the
120120
driver for allocating & exposing ``/dev/ublkb*``. Parameters set via
121121
``UBLK_CMD_SET_PARAMS`` are applied for creating the device.
122122

123123
- ``UBLK_CMD_STOP_DEV``
124124

125125
Halt IO on ``/dev/ublkb*`` and remove the device. When this command returns,
126-
ublk server will release resources (such as destroying per-queue pthread &
126+
ublk server will release resources (such as destroying I/O handler threads &
127127
io_uring).
128128

129129
- ``UBLK_CMD_DEL_DEV``
@@ -208,15 +208,15 @@ managing and controlling ublk devices with help of several control commands:
208208
modify how I/O is handled while the ublk server is dying/dead (this is called
209209
the ``nosrv`` case in the driver code).
210210

211-
With just ``UBLK_F_USER_RECOVERY`` set, after one ubq_daemon(ublk server's io
212-
handler) is dying, ublk does not delete ``/dev/ublkb*`` during the whole
211+
With just ``UBLK_F_USER_RECOVERY`` set, after the ublk server exits,
212+
ublk does not delete ``/dev/ublkb*`` during the whole
213213
recovery stage and ublk device ID is kept. It is ublk server's
214214
responsibility to recover the device context by its own knowledge.
215215
Requests which have not been issued to userspace are requeued. Requests
216216
which have been issued to userspace are aborted.
217217

218-
With ``UBLK_F_USER_RECOVERY_REISSUE`` additionally set, after one ubq_daemon
219-
(ublk server's io handler) is dying, contrary to ``UBLK_F_USER_RECOVERY``,
218+
With ``UBLK_F_USER_RECOVERY_REISSUE`` additionally set, after the ublk server
219+
exits, contrary to ``UBLK_F_USER_RECOVERY``,
220220
requests which have been issued to userspace are requeued and will be
221221
re-issued to the new process after handling ``UBLK_CMD_END_USER_RECOVERY``.
222222
``UBLK_F_USER_RECOVERY_REISSUE`` is designed for backends who tolerate
@@ -241,10 +241,11 @@ can be controlled/accessed just inside this container.
241241
Data plane
242242
----------
243243

244-
ublk server needs to create per-queue IO pthread & io_uring for handling IO
245-
commands via io_uring passthrough. The per-queue IO pthread
246-
focuses on IO handling and shouldn't handle any control & management
247-
tasks.
244+
The ublk server should create dedicated threads for handling I/O. Each
245+
thread should have its own io_uring through which it is notified of new
246+
I/O, and through which it can complete I/O. These dedicated threads
247+
should focus on IO handling and shouldn't handle any control &
248+
management tasks.
248249

249250
The's IO is assigned by a unique tag, which is 1:1 mapping with IO
250251
request of ``/dev/ublkb*``.
@@ -265,6 +266,18 @@ with specified IO tag in the command data:
265266
destined to ``/dev/ublkb*``. This command is sent only once from the server
266267
IO pthread for ublk driver to setup IO forward environment.
267268

269+
Once a thread issues this command against a given (qid,tag) pair, the thread
270+
registers itself as that I/O's daemon. In the future, only that I/O's daemon
271+
is allowed to issue commands against the I/O. If any other thread attempts
272+
to issue a command against a (qid,tag) pair for which the thread is not the
273+
daemon, the command will fail. Daemons can be reset only be going through
274+
recovery.
275+
276+
The ability for every (qid,tag) pair to have its own independent daemon task
277+
is indicated by the ``UBLK_F_PER_IO_DAEMON`` feature. If this feature is not
278+
supported by the driver, daemons must be per-queue instead - i.e. all I/Os
279+
associated to a single qid must be handled by the same task.
280+
268281
- ``UBLK_IO_COMMIT_AND_FETCH_REQ``
269282

270283
When an IO request is destined to ``/dev/ublkb*``, the driver stores

0 commit comments

Comments
 (0)