Skip to content

Enhance async submission API#3421

Merged
igaw merged 2 commits into
linux-nvme:masterfrom
igaw:enhance-async
Jun 3, 2026
Merged

Enhance async submission API#3421
igaw merged 2 commits into
linux-nvme:masterfrom
igaw:enhance-async

Conversation

@igaw

@igaw igaw commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

The async API is only all or nothing. Extend it so it's possible to submit and wait for individual commands.

@igaw igaw force-pushed the enhance-async branch from 3cbd76c to 4d9926b Compare June 3, 2026 14:32
@igaw

igaw commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

It seems that many of the admin commands are working fine via io_uring but not all. e.g. flush is not working:

nvme/014 (tr=tcp bd=device) (flush a command from host)      [failed]
    runtime  21.332s  ...  21.740s
    --- tests/nvme/014.out	2024-04-16 16:30:22.854738245 +0000
    +++ /tmp/blktests/nodev_tr_tcp_bd_device/nvme/014.out.bad	2026-06-03 15:26:17.472392670 +0000
    @@ -1,4 +1,4 @@
     Running nvme/014
    -NVMe Flush: success
    +flush: Invalid argument
     disconnected 1 controller(s)
     Test complete

Also some of the user IO tests fail nvme/029:

   77     test_user_io "$dev" 1 512 > "$FULL" 2>&1 || echo FAIL
   78     test_user_io "$dev" 1 511 >> "$FULL" 2>&1 || echo FAIL
   79     test_user_io "$dev" 1 513 >> "$FULL" 2>&1 || echo FAIL 
   80     test_user_io "$dev" 511 1024 >> "$FULL" 2>&1 || echo FAIL 
   81     test_user_io "$dev" 511 1023 >> "$FULL" 2>&1 || echo FAIL 
   82     test_user_io "$dev" 511 1025 >> "$FULL" 2>&1 || echo FAIL      
Running nvme/029
+ echo FAIL
FAIL
+ test_user_io /dev/nvme1n1 1 511
+ echo FAIL
FAIL
+ test_user_io /dev/nvme1n1 1 513
+ echo FAIL
FAIL
+ test_user_io /dev/nvme1n1 511 1024
+ echo FAIL
FAIL
+ test_user_io /dev/nvme1n1 511 1023
+ echo FAIL
FAIL
+ test_user_io /dev/nvme1n1 511 1025
+ echo FAIL
FAIL

also the 'id-ns' or 'id-ctrl' fails:

root@localhost:/home/wagi/work/nvme-cli/.build-debian# nvme -vv id-ns /dev/nvme0n1
opcode       : 06
flags        : 00
rsvd1        : 0000
nsid         : 00000001
cdw2         : 00000000
cdw3         : 00000000
data_len     : 00001000
metadata_len : 00000000
addr         : 55a6b17e2000
metadata     : 0
cdw10        : 00000000
cdw11        : 00000000
cdw12        : 00000000
cdw13        : 00000000
cdw14        : 00000000
cdw15        : 00000000
timeout_ms   : 00000000
result       : 0
err          : -22
latency      : 103 us
identify namespace: Invalid argument

overall, it looks like there are a bit more of details to be sorted out with the io_uring interface.

igaw added 2 commits June 3, 2026 17:50
Make the async passthru interface more useful by supporting different
workflows:

- Simple synchronous (one at a time):
  libnvme_exec_admin_passthru(hdl, &cmd);

- Simple batching (submit multiple, wait for all):
  libnvme_submit_admin_passthru(hdl, &cmd1);
  libnvme_submit_admin_passthru(hdl, &cmd2);
  libnvme_wait_admin_passthru(hdl);

- Full async control (submit and reap selectively):
  libnvme_submit_admin_passthru_async(hdl, &cmd1, cookie1);
  libnvme_submit_admin_passthru_async(hdl, &cmd2, cookie2);
  libnvme_reap_admin_passthru_async(hdl, &completion);

Reverted the behavior of libnvme_submit_*_passthru() to always be
synchronous. This forces the caller to explicitly handle the switch from
async to sync logic. Explicit API behavior is more maintainable than
implicit behavior.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Add tests cases for the async submission API. Since there is no easy way to
tests async test, it only tests the fallback mode, when there is no io_uring.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
@igaw igaw force-pushed the enhance-async branch from 4d9926b to de5b4aa Compare June 3, 2026 15:51
@igaw igaw merged commit c7ca761 into linux-nvme:master Jun 3, 2026
29 of 30 checks passed
@igaw igaw deleted the enhance-async branch June 3, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant