On Tue, Oct 15, 2024 at 02:51:14PM -0600, Uday Shankar wrote: > On Thu, Oct 10, 2024 at 11:45:03AM +0800, Ming Lei wrote: > > > static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq) > > > { > > > - struct ublk_rq_data *data = blk_mq_rq_to_pdu(rq); > > > - > > > - if (llist_add(&data->node, &ubq->io_cmds)) { > > > - struct ublk_io *io = &ubq->ios[rq->tag]; > > > + struct ublk_io *io = &ubq->ios[rq->tag]; > > > > > > - io_uring_cmd_complete_in_task(io->cmd, ublk_rq_task_work_cb); > > > - } > > > + ublk_get_uring_cmd_pdu(io->cmd)->req = rq; > > > + io_uring_cmd_complete_in_task(io->cmd, __ublk_rq_task_work); > > > } > > > > I'd suggest to comment that io_uring_cmd_complete_in_task() needs to > > maintain io command order. > > Sorry, can you explain why this is important? Generally speaking > out-of-order completion of I/Os is considered okay, so what's the issue > if the dispatch to the ublk server here is not in order? It is just okay, but proper implementation requires to keep IO order. Please see: 1) 7d4a93176e01 ("ublk_drv: don't forward io commands in reserve order") 2) [Report] requests are submitted to hardware in reverse order from nvme/virtio-blk queue_rqs() https://lore.kernel.org/linux-block/ZbD7ups50ryrlJ%2FG@fedora/ I am also working on ublk-bpf which needs this extra list for submitting IO in batch, please hold on this patch now. I plan to send out bpf patches in this cycle or next, and we can restart the cleanup if the bpf thing turns out not doable. Thanks, Ming