On Tue, Dec 1, 2026 at 5:22 PM Xin Tian <tia…@yunsilicon.com> wrote:
>
...
> >> +static int xsc_cmd_cq_polling(void *data) > >> +{ > >> + struct xsc_core_device *xdev = data; > >> + struct xsc_cmd *cmd = xdev->cmd; > >> + struct xsc_rsp_layout *rsp; > >> + u32 err_status; > >> + u32 cq_pid; > >> + > >> + while (!kthread_should_stop()) { > >> + if (need_resched()) > >> + schedule();
> > cond_resched()
> Will use cond_resched().
> >
> >> + > >> + err_status = xsc_read_cmdq_err_status(xdev); > >> + if (err_status) > >> + xsc_cmd_err_handler(xdev, err_status); > >> + > >> + cq_pid = xsc_get_cmdq_rsp_pid(xdev) & XSC_CMDQ_INDEX_MASK; > >> + if (cmd->cq_cid == cq_pid) { > >> + usleep_range(1000, 2000);
> > xsc_cmd_init() creates a kthread that polls the response ring every > > 1-2ms, even with no command in flight. 1-2ms means around 1000 > > periodic wakeups/context switches on one cpu. > > > > It reminds me of future RDMA support. I noticed there are a few > > production applications where frequent create/modify/destroy of pairs > > are unavoidable, meaning the latency there is sensitive. It's unlike > > TCP 3-way handshake. 1-2ms will possibly add huge latency > > comparatively. > > > > With that said, what I had in my mind is there are three directions: > > 1. event-driven as you mentioned. Patch 5 already brings up the EQ and MSI-X. > > 2. demand-driven (dedicated) thread. Keep the kthread, but let the > > submitter wake it and have it sleep on a waitqueue once no command is > > outstanding. > > 3. Or drop the kthread and let the submitter poll in xsc_cmd_invoke() > > with read_poll_timeout(), using a staged delay (udelay(1) a few times, > > then usleep_range(20, 30), then 1ms) as bnxt does in __hwrm_send(). > > This also removes the fixed 1ms floor per command. > > > > Any thoughts on this? > > > > Thanks, > > Jason
> This is an intentional trade-off for > this series. The command queue only serves the control plane (QP/CQ/EQ > create/destroy, queries, config), not the data path, so the completion
Yep, but as I said I saw some applications heavily and frequently using create qp and friends.
> latency does not affect throughput. This version ships a single-channel > ethernet driver where polling is sufficient, and to keep the series lean > (the earlier ~6000-line concern) we keep only the poller for now. We do > plan to move the command queue to EQ-driven completion when multi-channel > and RDMA support land. So I'd like to keep the poller -- I hope the > > rationale makes sense.
Sure. Sounds good to me. Thanks, Jason