On Fri, Feb 17, 2023 at 11:02:14AM +0800, Ming Lei wrote: > On Thu, Feb 16, 2023 at 08:12:18PM +0800, Xiaoguang Wang wrote: > > hello, ... > > io_prep_prog is called when ublk_queue_rq() is called, this bpf > > prog will initialize one or more sqes according to user logic, and > > io_prep_prog will put these sqes in an ebpf map structure, then > > execute a task_work_add() to notify ubq_daemon to execute > > io_submit_prog. Note, we can not call io_uring_submit_sqe() > > in task context that calls ublk_queue_rq(), that context does not > > have io_uring instance owned by ubq_daemon. > > Later ubq_daemon will call io_submit_prog to submit sqes. > > Submitting sqe from kernel looks interesting, but I guess > performance may be hurt, given plugging(batching) can't be applied > any more, which is supposed to affect io perf a lot. If submitting SQE in kernel is really doable, maybe we can add another command, such as, UBLK_IO_SUBMIT_SQE(just like UBLK_IO_NEED_GET_DATA), and pass the built SQE(which represents part of user logic result) as io_uring command payload, and ask ublk driver to build buffer for this SQE, then submit this SQE in kernel. But there is SQE order problem, net usually requires SQEs to be linked and submitted in order, with this way, it becomes not easy to maintain SQEs order(some linked in user, and some in kernel). Thanks, Ming