All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown
@ 2026-09-30  7:44 Runyu Xiao
  2026-09-30 13:53 ` bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Runyu Xiao @ 2026-09-30  7:44 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Luiz Augusto von Dentz, Tedd Ho-Jeong An, Kiran K,
	linux-bluetooth, linux-kernel, stable, Runyu Xiao, Jianhao Xu

The PCIe driver registers its MSI-X handlers with
devm_request_threaded_irq(), but remove() uses free_irq() directly. The
devres actions then retain registrations and attempt to release them again
during device cleanup.

Use devm_free_irq() for the remove path and for already registered vectors
when a later setup request fails. This removes the managed resource at the
same time as the IRQ is released and keeps MSI-X vector teardown ordered
after IRQ ownership is gone.

Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/bluetooth/btintel_pcie.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 005c77a4f..f8901df7c 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -1750,7 +1750,7 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id)
 static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
 {
 	int err;
-	int num_irqs, i;
+	int num_irqs, i, j;
 
 	for (i = 0; i < BTINTEL_PCIE_MSIX_VEC_MAX; i++)
 		data->msix_entries[i].entry = i;
@@ -1779,6 +1779,10 @@ static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
 						KBUILD_MODNAME,
 						msix_entry);
 		if (err) {
+			for (j = 0; j < i; j++)
+				devm_free_irq(&data->pdev->dev,
+					      data->msix_entries[j].vector,
+					      &data->msix_entries[j]);
 			pci_free_irq_vectors(data->pdev);
 			data->alloc_vecs = 0;
 			return err;
@@ -3101,7 +3105,7 @@ static void btintel_pcie_remove(struct pci_dev *pdev)
 		struct msix_entry *msix_entry;
 
 		msix_entry = &data->msix_entries[i];
-		free_irq(msix_entry->vector, msix_entry);
+		devm_free_irq(&pdev->dev, msix_entry->vector, msix_entry);
 	}
 
 	pci_free_irq_vectors(pdev);
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-09-30  7:44 [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown Runyu Xiao
@ 2026-09-30 13:53 ` bluez.test.bot
  2026-10-02 16:40 ` [PATCH] " patchwork-bot+bluetooth
  2026-10-05  4:14 ` Ravindra
  2 siblings, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2026-09-30 13:53 UTC (permalink / raw)
  To: linux-bluetooth, runyu.xiao

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1176654/

---Test result---

Test Summary:
CheckPatch                    PASS      1.07 seconds
VerifyFixes                   PASS      2.09 seconds
VerifySignedoff               PASS      0.16 seconds
GitLint                       PASS      0.38 seconds
SubjectPrefix                 PASS      0.13 seconds
BuildKernel                   PASS      29.90 seconds
CheckAllWarning               PASS      34.33 seconds
CheckSparse                   PASS      37.18 seconds
BuildKernel32                 PASS      29.82 seconds
CheckKernelLLVM               PASS      35.95 seconds
TestRunnerSetup               PASS      811.33 seconds
IncrementalBuild              PASS      28.12 seconds



https://github.com/bluez/bluetooth-next/pull/843

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-09-30  7:44 [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown Runyu Xiao
  2026-09-30 13:53 ` bluez.test.bot
@ 2026-10-02 16:40 ` patchwork-bot+bluetooth
  2026-10-05  4:14 ` Ravindra
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-02 16:40 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: marcel, luiz.dentz, tedd.an, kiran.k, linux-bluetooth,
	linux-kernel, stable, jianhao.xu

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 30 Sep 2026 15:44:53 +0800 you wrote:
> The PCIe driver registers its MSI-X handlers with
> devm_request_threaded_irq(), but remove() uses free_irq() directly. The
> devres actions then retain registrations and attempt to release them again
> during device cleanup.
> 
> Use devm_free_irq() for the remove path and for already registered vectors
> when a later setup request fails. This removes the managed resource at the
> same time as the IRQ is released and keeps MSI-X vector teardown ordered
> after IRQ ownership is gone.
> 
> [...]

Here is the summary with links:
  - Bluetooth: btintel_pcie: use managed IRQ teardown
    https://git.kernel.org/bluetooth/bluetooth-next/c/25016fe8c1ed

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-09-30  7:44 [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown Runyu Xiao
  2026-09-30 13:53 ` bluez.test.bot
  2026-10-02 16:40 ` [PATCH] " patchwork-bot+bluetooth
@ 2026-10-05  4:14 ` Ravindra
  2026-10-06  9:56   ` Runyu Xiao
  2026-10-06  9:56   ` [PATCH v2] " Runyu Xiao
  2 siblings, 2 replies; 8+ messages in thread
From: Ravindra @ 2026-10-05  4:14 UTC (permalink / raw)
  To: runyu.xiao
  Cc: jianhao.xu, kiran.k, linux-bluetooth, linux-kernel, luiz.dentz,
	marcel, stable, tedd.an, Ravindra

Hi Runyu,

Thanks for the fix.

I have tested this patch with repeated Bluetooth load/unload cycles on
an Intel PCIe Bluetooth device and did not observe any kernel warnings
or issues with the patch applied.

Tested-by: Ravindra <ravindra@intel.com>

Could you please send a v2 including the above Tested-by tag?

Thanks,
Ravindra

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-10-05  4:14 ` Ravindra
@ 2026-10-06  9:56   ` Runyu Xiao
  2026-10-06  9:56   ` [PATCH v2] " Runyu Xiao
  1 sibling, 0 replies; 8+ messages in thread
From: Runyu Xiao @ 2026-10-06  9:56 UTC (permalink / raw)
  To: Ravindra
  Cc: Jianhao Xu, Kiran K, linux-bluetooth, linux-kernel,
	Luiz Augusto von Dentz, Marcel Holtmann, stable, Tedd Ho-Jeong An

On Mon, 5 Oct 2026 09:44:57 +0530, Ravindra wrote:
> I have tested this patch with repeated Bluetooth load/unload cycles on
> an Intel PCIe Bluetooth device and did not observe any kernel warnings
> or issues with the patch applied.
>
> Tested-by: Ravindra <ravindra@intel.com>
>
> Could you please send a v2 including the above Tested-by tag?

Thanks for testing this patch. I'll send a v2 shortly with your
Tested-by tag.

Thanks,
Runyu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-10-05  4:14 ` Ravindra
  2026-10-06  9:56   ` Runyu Xiao
@ 2026-10-06  9:56   ` Runyu Xiao
  2026-10-06 13:56     ` Luiz Augusto von Dentz
  2026-10-06 14:50     ` [v2] " bluez.test.bot
  1 sibling, 2 replies; 8+ messages in thread
From: Runyu Xiao @ 2026-10-06  9:56 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Luiz Augusto von Dentz, Tedd Ho-Jeong An, Kiran K,
	linux-bluetooth, linux-kernel, stable, Ravindra, Runyu Xiao,
	Jianhao Xu

The PCIe driver registers its MSI-X handlers with
devm_request_threaded_irq(), but remove() uses free_irq() directly. The
devres actions then retain registrations and attempt to release them again
during device cleanup.

Use devm_free_irq() for the remove path and for already registered vectors
when a later setup request fails. This removes the managed resource at the
same time as the IRQ is released and keeps MSI-X vector teardown ordered
after IRQ ownership is gone.

Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Cc: stable@vger.kernel.org
Tested-by: Ravindra <ravindra@intel.com>
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
Changes in v2:
- Add Ravindra's Tested-by tag.

 drivers/bluetooth/btintel_pcie.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 005c77a4f..f8901df7c 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -1750,7 +1750,7 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id)
 static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
 {
 	int err;
-	int num_irqs, i;
+	int num_irqs, i, j;
 
 	for (i = 0; i < BTINTEL_PCIE_MSIX_VEC_MAX; i++)
 		data->msix_entries[i].entry = i;
@@ -1779,6 +1779,10 @@ static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
 						KBUILD_MODNAME,
 						msix_entry);
 		if (err) {
+			for (j = 0; j < i; j++)
+				devm_free_irq(&data->pdev->dev,
+					      data->msix_entries[j].vector,
+					      &data->msix_entries[j]);
 			pci_free_irq_vectors(data->pdev);
 			data->alloc_vecs = 0;
 			return err;
@@ -3101,7 +3105,7 @@ static void btintel_pcie_remove(struct pci_dev *pdev)
 		struct msix_entry *msix_entry;
 
 		msix_entry = &data->msix_entries[i];
-		free_irq(msix_entry->vector, msix_entry);
+		devm_free_irq(&pdev->dev, msix_entry->vector, msix_entry);
 	}
 
 	pci_free_irq_vectors(pdev);
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-10-06  9:56   ` [PATCH v2] " Runyu Xiao
@ 2026-10-06 13:56     ` Luiz Augusto von Dentz
  2026-10-06 14:50     ` [v2] " bluez.test.bot
  1 sibling, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-06 13:56 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: Marcel Holtmann, Tedd Ho-Jeong An, Kiran K, linux-bluetooth,
	linux-kernel, stable, Ravindra, Jianhao Xu

Hi Runyu,

On Tue, Oct 6, 2026 at 5:56 AM Runyu Xiao <runyu.xiao@seu.edu.cn> wrote:
>
> The PCIe driver registers its MSI-X handlers with
> devm_request_threaded_irq(), but remove() uses free_irq() directly. The
> devres actions then retain registrations and attempt to release them again
> during device cleanup.
>
> Use devm_free_irq() for the remove path and for already registered vectors
> when a later setup request fails. This removes the managed resource at the
> same time as the IRQ is released and keeps MSI-X vector teardown ordered
> after IRQ ownership is gone.
>
> Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
> Cc: stable@vger.kernel.org
> Tested-by: Ravindra <ravindra@intel.com>
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
> Changes in v2:
> - Add Ravindra's Tested-by tag.

v1 has already been applied.

>
>  drivers/bluetooth/btintel_pcie.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index 005c77a4f..f8901df7c 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -1750,7 +1750,7 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id)
>  static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
>  {
>         int err;
> -       int num_irqs, i;
> +       int num_irqs, i, j;
>
>         for (i = 0; i < BTINTEL_PCIE_MSIX_VEC_MAX; i++)
>                 data->msix_entries[i].entry = i;
> @@ -1779,6 +1779,10 @@ static int btintel_pcie_setup_irq(struct btintel_pcie_data *data)
>                                                 KBUILD_MODNAME,
>                                                 msix_entry);
>                 if (err) {
> +                       for (j = 0; j < i; j++)
> +                               devm_free_irq(&data->pdev->dev,
> +                                             data->msix_entries[j].vector,
> +                                             &data->msix_entries[j]);
>                         pci_free_irq_vectors(data->pdev);
>                         data->alloc_vecs = 0;
>                         return err;
> @@ -3101,7 +3105,7 @@ static void btintel_pcie_remove(struct pci_dev *pdev)
>                 struct msix_entry *msix_entry;
>
>                 msix_entry = &data->msix_entries[i];
> -               free_irq(msix_entry->vector, msix_entry);
> +               devm_free_irq(&pdev->dev, msix_entry->vector, msix_entry);
>         }
>
>         pci_free_irq_vectors(pdev);
> --
> 2.34.1



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [v2] Bluetooth: btintel_pcie: use managed IRQ teardown
  2026-10-06  9:56   ` [PATCH v2] " Runyu Xiao
  2026-10-06 13:56     ` Luiz Augusto von Dentz
@ 2026-10-06 14:50     ` bluez.test.bot
  1 sibling, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2026-10-06 14:50 UTC (permalink / raw)
  To: linux-bluetooth, runyu.xiao

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: drivers/bluetooth/btintel_pcie.c:1750
error: drivers/bluetooth/btintel_pcie.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-06 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30  7:44 [PATCH] Bluetooth: btintel_pcie: use managed IRQ teardown Runyu Xiao
2026-09-30 13:53 ` bluez.test.bot
2026-10-02 16:40 ` [PATCH] " patchwork-bot+bluetooth
2026-10-05  4:14 ` Ravindra
2026-10-06  9:56   ` Runyu Xiao
2026-10-06  9:56   ` [PATCH v2] " Runyu Xiao
2026-10-06 13:56     ` Luiz Augusto von Dentz
2026-10-06 14:50     ` [v2] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.