* [PATCH] Bluetooth: Re-order clearing suspend tasks
@ 2020-09-09 23:53 Abhishek Pandit-Subedi
2020-09-11 7:06 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-09-09 23:53 UTC (permalink / raw)
To: marcel, linux-bluetooth
Cc: chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
David S. Miller, Johan Hedberg, netdev, linux-kernel,
Jakub Kicinski
Unregister_pm_notifier is a blocking call so suspend tasks should be
cleared beforehand. Otherwise, the notifier will wait for completion
before returning (and we encounter a 2s timeout on resume).
Fixes: 0e9952804ec9c8 (Bluetooth: Clear suspend tasks on unregister)
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
Should have caught that unregister_pm_notifier was blocking last time
but when testing the earlier patch, I got unlucky and saw that the error
message was never hit (the suspend timeout).
When re-testing this patch on the same device, I was able to reproduce
the problem on an older build with the 0e9952804ec9c8 but not on a newer
build with the same patch. Changing the order correctly fixes it
everywhere. Confirmed this by adding debug logs in btusb_disconnect and
hci_suspend_notifier to confirm what order things were getting called.
Sorry about the churn. Next I'm going try to do something about the palm
shaped indentation on my forehead...
net/bluetooth/hci_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index efc0fe2b47dac2..be9cdf5dabe5dc 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3794,8 +3794,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
cancel_work_sync(&hdev->power_on);
- unregister_pm_notifier(&hdev->suspend_notifier);
hci_suspend_clear_tasks(hdev);
+ unregister_pm_notifier(&hdev->suspend_notifier);
cancel_work_sync(&hdev->suspend_prepare);
hci_dev_do_close(hdev);
--
2.28.0.618.gf4bc123cb7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Re-order clearing suspend tasks
2020-09-09 23:53 [PATCH] Bluetooth: Re-order clearing suspend tasks Abhishek Pandit-Subedi
@ 2020-09-11 7:06 ` Marcel Holtmann
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2020-09-11 7:06 UTC (permalink / raw)
To: Abhishek Pandit-Subedi
Cc: linux-bluetooth, CrosBT Upstreaming, David S. Miller,
Johan Hedberg, netdev, linux-kernel, Jakub Kicinski
Hi Abhishek,
> Unregister_pm_notifier is a blocking call so suspend tasks should be
> cleared beforehand. Otherwise, the notifier will wait for completion
> before returning (and we encounter a 2s timeout on resume).
>
> Fixes: 0e9952804ec9c8 (Bluetooth: Clear suspend tasks on unregister)
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> Should have caught that unregister_pm_notifier was blocking last time
> but when testing the earlier patch, I got unlucky and saw that the error
> message was never hit (the suspend timeout).
>
> When re-testing this patch on the same device, I was able to reproduce
> the problem on an older build with the 0e9952804ec9c8 but not on a newer
> build with the same patch. Changing the order correctly fixes it
> everywhere. Confirmed this by adding debug logs in btusb_disconnect and
> hci_suspend_notifier to confirm what order things were getting called.
>
> Sorry about the churn. Next I'm going try to do something about the palm
> shaped indentation on my forehead...
>
> net/bluetooth/hci_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Bluetooth: Re-order clearing suspend tasks
@ 2020-09-10 1:40 Abhishek Pandit-Subedi
0 siblings, 0 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-09-10 1:40 UTC (permalink / raw)
To: linux-bluetooth
Cc: marcel, Abhishek Pandit-Subedi, David S. Miller, Johan Hedberg,
netdev, linux-kernel, Jakub Kicinski
Unregister_pm_notifier is a blocking call so suspend tasks should be
cleared beforehand. Otherwise, the notifier will wait for completion
before returning (and we encounter a 2s timeout on resume).
Fixes: 0e9952804ec9c8 (Bluetooth: Clear suspend tasks on unregister)
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
Should have caught that unregister_pm_notifier was blocking last time
but when testing the earlier patch, I got unlucky and saw that the error
message was never hit (the suspend timeout).
When re-testing this patch on the same device, I was able to reproduce
the problem on an older build with the 0e9952804ec9c8 but not on a newer
build with the same patch. Changing the order correctly fixes it
everywhere. Confirmed this by adding debug logs in btusb_disconnect and
hci_suspend_notifier to confirm what order things were getting called.
Sorry about the churn. Next I'm going try to do something about the palm
shaped indentation on my forehead...
net/bluetooth/hci_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index efc0fe2b47dac2..be9cdf5dabe5dc 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3794,8 +3794,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
cancel_work_sync(&hdev->power_on);
- unregister_pm_notifier(&hdev->suspend_notifier);
hci_suspend_clear_tasks(hdev);
+ unregister_pm_notifier(&hdev->suspend_notifier);
cancel_work_sync(&hdev->suspend_prepare);
hci_dev_do_close(hdev);
--
2.28.0.618.gf4bc123cb7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-11 7:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 23:53 [PATCH] Bluetooth: Re-order clearing suspend tasks Abhishek Pandit-Subedi
2020-09-11 7:06 ` Marcel Holtmann
2020-09-10 1:40 Abhishek Pandit-Subedi
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.