From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: kvalo@kernel.org, jjohnson@kernel.org
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] wifi: ath12k: Set IRQ affinity hint after requesting all shared IRQs
Date: Fri, 23 Aug 2024 21:29:03 +0530 [thread overview]
Message-ID: <20240823155903.eqswl5ds4h2eynhp@thinkpad> (raw)
In-Reply-To: <20240823155502.57333-3-manivannan.sadhasivam@linaro.org>
On Fri, Aug 23, 2024 at 09:25:01PM +0530, Manivannan Sadhasivam wrote:
> If a shared IRQ is used by the driver due to platform limitation, then the
> IRQ affinity hint is set right after the allocation of IRQ vectors in
> ath11k_pci_alloc_msi(). This does no harm unless one of the functions
> requesting the IRQ fails and attempt to free the IRQ.
>
> This may end up with a warning from the IRQ core that is expecting the
> affinity hint to be cleared before freeing the IRQ:
>
> kernel/irq/manage.c:
>
> /* make sure affinity_hint is cleaned up */
> if (WARN_ON_ONCE(desc->affinity_hint))
> desc->affinity_hint = NULL;
>
> So to fix this, let's set the IRQ affinity hint after requesting all the
> shared IRQ. This will make sure that the affinity hint gets cleared in the
> error path before freeing the IRQ.
>
Apparently, I missed adding the fixes tag:
Fixes: a3012f206d07 ("wifi: ath12k: set IRQ affinity to CPU0 in case of one MSI vector")
- Mani
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> drivers/net/wireless/ath/ath12k/pci.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
> index 9e0b9e329bda..f265c1b8ce4e 100644
> --- a/drivers/net/wireless/ath/ath12k/pci.c
> +++ b/drivers/net/wireless/ath/ath12k/pci.c
> @@ -1446,16 +1446,10 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
> if (ret)
> goto err_pci_msi_free;
>
> - ret = ath12k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0));
> - if (ret) {
> - ath12k_err(ab, "failed to set irq affinity %d\n", ret);
> - goto err_pci_msi_free;
> - }
> -
> ret = ath12k_mhi_register(ab_pci);
> if (ret) {
> ath12k_err(ab, "failed to register mhi: %d\n", ret);
> - goto err_irq_affinity_cleanup;
> + goto err_pci_msi_free;
> }
>
> ret = ath12k_hal_srng_init(ab);
> @@ -1476,6 +1470,12 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
> goto err_ce_free;
> }
>
> + ret = ath12k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0));
> + if (ret) {
> + ath12k_err(ab, "failed to set irq affinity %d\n", ret);
> + goto err_free_irq;
> + }
> +
> /* kernel may allocate a dummy vector before request_irq and
> * then allocate a real vector when request_irq is called.
> * So get msi_data here again to avoid spurious interrupt
> @@ -1484,16 +1484,19 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
> ret = ath12k_pci_config_msi_data(ab_pci);
> if (ret) {
> ath12k_err(ab, "failed to config msi_data: %d\n", ret);
> - goto err_free_irq;
> + goto err_irq_affinity_cleanup;
> }
>
> ret = ath12k_core_init(ab);
> if (ret) {
> ath12k_err(ab, "failed to init core: %d\n", ret);
> - goto err_free_irq;
> + goto err_irq_affinity_cleanup;
> }
> return 0;
>
> +err_irq_affinity_cleanup:
> + ath12k_pci_set_irq_affinity_hint(ab_pci, NULL);
> +
> err_free_irq:
> ath12k_pci_free_irq(ab);
>
> @@ -1509,9 +1512,6 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
> err_pci_msi_free:
> ath12k_pci_msi_free(ab_pci);
>
> -err_irq_affinity_cleanup:
> - ath12k_pci_set_irq_affinity_hint(ab_pci, NULL);
> -
> err_pci_free_region:
> ath12k_pci_free_region(ab_pci);
>
> --
> 2.25.1
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-08-23 15:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 15:54 [PATCH 0/3] wifi: ath11k/ath12k: Set IRQ affinity hint after requesting all shared IRQs Manivannan Sadhasivam
2024-08-23 15:55 ` [PATCH 1/3] wifi: ath11k: " Manivannan Sadhasivam
2024-08-23 18:09 ` Jeff Johnson
2024-08-26 3:04 ` Baochen Qiang
2024-08-26 7:01 ` Manivannan Sadhasivam
2024-08-26 7:44 ` Baochen Qiang
2024-08-23 15:55 ` [PATCH 2/3] wifi: ath12k: " Manivannan Sadhasivam
2024-08-23 15:59 ` Manivannan Sadhasivam [this message]
2024-08-23 15:55 ` [PATCH 3/3] wifi: ath11k/ath12k: Replace irq_set_affinity_hint() with irq_set_affinity_and_hint() Manivannan Sadhasivam
2025-01-31 22:21 ` [PATCH 0/3] wifi: ath11k/ath12k: Set IRQ affinity hint after requesting all shared IRQs Jeff Johnson
2025-02-07 17:26 ` Manivannan Sadhasivam
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=20240823155903.eqswl5ds4h2eynhp@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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