From: sashiko-bot@kernel.org
To: "Jose Ignacio Tornos Martinez" <jtornosm@redhat.com>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 4/7] ath11k: add PCIe link recovery retry
Date: Sun, 11 Oct 2026 07:59:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-167113@kernel.org> (raw)
In-Reply-To: <20261011074514.515894-5-jtornosm@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ath11k: 5000ms mdelay() causes severe CPU stall in normal contexts
--
commit 457eae9bbd9159c5c25a5626326a881f1232316d
Author: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
ath11k: add PCIe link recovery retry
When ath11k devices are passed through to VMs via PCIe passthrough, the
PCIe link may not stabilize immediately after global reset. This patch
adds a retry loop to wait for the PCIe link to recover after global
reset and prevents continuing with a dead link.
Link: https://lore.kernel.org/all/20260930140833.576941-5-jtornosm@redhat.com/
> diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
> index a163168f36176..7e29ebaf97731 100644
> --- a/drivers/net/wireless/ath/ath11k/pci.c
> +++ b/drivers/net/wireless/ath/ath11k/pci.c
[ ... ]
> @@ -215,14 +217,28 @@ static void ath11k_pci_soc_global_reset(struct ath11k_base *ab)
>
> mdelay(delay);
>
> - val = ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET);
> - if (val == 0xffffffff)
> - ath11k_warn(ab, "link down error during global reset\n");
> + /* Wait for PCIe link to recover, especially important in VM environments
> + * where timing can vary significantly from bare metal.
> + */
> + while (retries-- > 0) {
> + val = ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET);
> + if (val != 0xffffffff) {
> + link_recovered = true;
> + break;
> + }
> + mdelay(20);
> + }
[Severity: High]
Does this mdelay() loop cause a severe CPU stall?
The commit notes indicate this loop was changed to an iteration counter to
work in atomic/panic contexts. However, looking at the callers of
ath11k_pci_soc_global_reset() (such as probe, core_reset, core_restart,
and resume_early), these execute in contexts where it seems safe to sleep.
Even in resume_early, interrupts are enabled and jiffies advance normally.
Furthermore, immediately after this loop, the code calls
ath11k_pci_restore_window(), which unconditionally takes a spinlock with
spin_lock_bh():
ath11k_pci_restore_window(struct ath11k_base *ab) {
...
spin_lock_bh(&ab_pci->window_lock);
...
}
Since taking a bottom-half disabling spinlock would be invalid in a hardirq
or panic context, doesn't this mean the code runs in normal process context?
If so, spinning the CPU without yielding for up to 5000ms (250 * 20ms) might
degrade responsiveness and risk triggering the soft lockup watchdog.
Could msleep() or fsleep() be used here instead?
> + if (!link_recovered) {
> + ath11k_err(ab, "PCIe link failed to recover - device may need power cycle\n");
> + return -ETIMEDOUT;
> + }
>
> /* Restore window register as its content is cleared during
> * hardware global reset, such that it aligns with host cache.
> */
> ath11k_pci_restore_window(ab);
> +
> + return 0;
> }
>
> static void ath11k_pci_clear_dbg_registers(struct ath11k_base *ab)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261011074514.515894-1-jtornosm@redhat.com?part=4
next prev parent reply other threads:[~2026-10-11 7:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 7:45 [PATCH v2 0/7] Enable Qualcomm WiFi PCIe passthrough to VMs Jose Ignacio Tornos Martinez
2026-10-11 7:45 ` [PATCH v2 1/7] PCI: Add pci_find_free_ext_cap_offset() helper Jose Ignacio Tornos Martinez
2026-10-11 7:57 ` sashiko-bot
2026-10-11 7:45 ` [PATCH v2 2/7] vfio: Add qcom_vfio.h header for MSI cache protocol Jose Ignacio Tornos Martinez
2026-10-11 7:59 ` sashiko-bot
2026-10-11 7:45 ` [PATCH v2 3/7] vfio/pci: Add qcom-vfio-pci variant driver Jose Ignacio Tornos Martinez
2026-10-11 8:07 ` sashiko-bot
2026-10-11 7:45 ` [PATCH v2 4/7] ath11k: add PCIe link recovery retry Jose Ignacio Tornos Martinez
2026-10-11 7:59 ` sashiko-bot [this message]
2026-10-11 7:45 ` [PATCH v2 5/7] ath11k: Use VFIO MSI cache when available Jose Ignacio Tornos Martinez
2026-10-11 8:04 ` sashiko-bot
2026-10-11 7:45 ` [PATCH v2 6/7] ath12k: add PCIe link recovery retry Jose Ignacio Tornos Martinez
2026-10-11 8:05 ` sashiko-bot
2026-10-11 7:45 ` [PATCH v2 7/7] ath12k: Use VFIO MSI cache when available Jose Ignacio Tornos Martinez
2026-10-11 8:02 ` sashiko-bot
2026-10-11 18:22 ` [PATCH v2 0/7] Enable Qualcomm WiFi PCIe passthrough to VMs Jeff Johnson
2026-10-12 14:48 ` Jason Gunthorpe
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-167113@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jtornosm@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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