From: sashiko-bot@kernel.org
To: "Xin Tian" <tianx@yunsilicon.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v1 05/15] net/xsc: add event queues, interrupts and the
Date: Thu, 05 Nov 2026 16:09:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-199427@kernel.org> (raw)
In-Reply-To: <20261104155701.37053-6-tianx@yunsilicon.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net/xsc: deadlock in xsc_cmd_use_polling() if xsc_cmd_enable_msix() times out
- [Low] net/xsc: missing select AUXILIARY_BUS in Kconfig for xsc_adev_add()
--
commit bbb498d789473438951b00cc57ce44b8544a92ad
Author: Xin Tian <tianx@yunsilicon.com>
net/xsc: add event queues, interrupts and the
This commit adds event queue support, MSI-X interrupt allocation and event
dispatch, DMA buffer allocation helpers, and auxiliary bus device registration
for the ethernet and RDMA function drivers.
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> new file mode 100644
> index 0000000000000..c8e8f1a9ff5e3
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> @@ -0,0 +1,142 @@
[ ... ]
> +int xsc_adev_add(struct xsc_core_device *xdev, int idx)
> +{
[ ... ]
> + ret = auxiliary_device_init(adev);
> + if (ret) {
> + kfree(xsc_adev);
> + return ret;
> + }
> +
> + ret = auxiliary_device_add(adev);
[Severity: Low]
In drivers/net/ethernet/yunsilicon/xsc/pci/Makefile, adev.o is unconditionally
linked into xsc_pci.o when CONFIG_YUNSILICON_XSC_PCI is enabled, and
xsc_adev_add() calls auxiliary_device_init() and auxiliary_device_add().
In drivers/net/ethernet/yunsilicon/xsc/pci/Kconfig, YUNSILICON_XSC_PCI only
specifies:
config YUNSILICON_XSC_PCI
tristate "Yunsilicon XSC PCI driver"
depends on PCI
Since AUXILIARY_BUS is a hidden symbol without fallback stubs when disabled,
will building with CONFIG_YUNSILICON_XSC_PCI enabled and CONFIG_AUXILIARY_BUS
unselected fail at link time with undefined references to
auxiliary_device_init() and __auxiliary_device_add()? Should
YUNSILICON_XSC_PCI select AUXILIARY_BUS in Kconfig?
[ ... ]
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/pci_irq.c b/drivers/net/ethernet/yunsilicon/xsc/pci/pci_irq.c
> new file mode 100644
> index 0000000000000..d83f13f38e9b8
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/pci_irq.c
> @@ -0,0 +1,494 @@
[ ... ]
> +int xsc_irq_eq_create(struct xsc_core_device *xdev)
> +{
[ ... ]
> + xsc_cmd_use_events(xdev);
> + err = xsc_cmd_enable_msix(xdev);
> + if (err) {
> + pci_err(xdev->pdev, "xsc_cmd_enable_msix failed %d.\n", err);
> + xsc_cmd_use_polling(xdev);
> + goto err_clear_hints;
> + }
[Severity: High]
Can this sequence deadlock in xsc_cmd_use_polling() if xsc_cmd_enable_msix()
times out?
In xsc_irq_eq_create(), xsc_cmd_use_events() stops the command CQ polling
kthread (cmd->cq_task) and switches cmd->mode to XSC_CMD_MODE_EVENTS before
xsc_cmd_enable_msix() issues XSC_CMD_OP_ENABLE_MSIX to the firmware.
When xsc_cmd_enable_msix() calls xsc_cmd_exec() -> _xsc_cmd_exec() ->
xsc_cmd_invoke(), cmd_work_handler() acquires one permit of cmd->sem via
down(&cmd->sem). Because polling is already stopped and MSI-X is not yet
enabled in firmware (or if MSI-X delivery fails), no completion interrupt may
arrive on cmd->irqn. When xsc_wait_func() times out, xsc_cmd_invoke() leaves
the cmd->sem permit held for the completion handler:
drivers/net/ethernet/yunsilicon/xsc/pci/cmdq.c:xsc_cmd_invoke() {
...
err = xsc_wait_func(xdev, ent);
if (err == -ETIMEDOUT)
/* leave the entry for the completion handler; the driver
* is marked timed out and rejects all further commands
*/
return err;
...
}
The error path in xsc_irq_eq_create() then calls xsc_cmd_use_polling(), which
disables cmd->irqn and waits to acquire all cmd->max_reg_cmds permits of
cmd->sem before recreating cmd->cq_task:
drivers/net/ethernet/yunsilicon/xsc/pci/cmdq.c:xsc_cmd_use_polling() {
...
flush_workqueue(cmd->wq);
disable_irq(cmd->irqn);
for (i = 0; i < cmd->max_reg_cmds; i++)
down(&cmd->sem);
...
}
With one permit still held by the timed-out command and both the IRQ disabled
and the polling kthread stopped, wouldn't down(&cmd->sem) block forever? Should
xsc_cmd_enable_msix() be called while the command interface is still in
polling mode before switching to events with xsc_cmd_use_events()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104155650.37053-1-tianx@yunsilicon.com?part=5
next prev parent reply other threads:[~2026-11-05 16:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 15:57 [PATCH v1 00/15] Yunsilicon XSC ethernet and RDMA drivers Xin Tian
2026-11-04 15:56 ` [PATCH v1 01/15] MAINTAINERS: add the Yunsilicon XSC drivers Xin Tian
2026-11-04 15:56 ` [PATCH v1 02/15] net/xsc: add PCI core driver skeleton Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:56 ` [PATCH v1 03/15] net/xsc: add the register HAL Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 04/15] net/xsc: add the command queue Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 05/15] net/xsc: add event queues, interrupts and the Xin Tian
2026-11-05 16:09 ` sashiko-bot [this message]
2026-11-04 15:57 ` [PATCH v1 06/15] net/xsc: add the CQ and QP resource pools Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 07/15] net/xsc: add ethernet netdev registration Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 08/15] net/xsc: add ethernet TX path Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 09/15] net/xsc: add ethernet RX path and statistics Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 10/15] RDMA/xsc: add RDMA device support Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 11/15] RDMA/xsc: add RDMA PD/MR Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 12/15] RDMA/xsc: add RDMA CQ/SRQ/AH Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 13/15] RDMA/xsc: add QP verbs Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 14/15] RDMA/xsc: add the RDMA send path Xin Tian
2026-11-05 16:09 ` sashiko-bot
2026-11-04 15:57 ` [PATCH v1 15/15] RDMA/xsc: add RDMA counters and sysfs Xin Tian
2026-11-05 16:09 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-199427@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tianx@yunsilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox