public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix SSR unable to wake up bug
@ 2025-11-06 14:01 Shuai Zhang
  2025-11-06 14:01 ` [PATCH v2 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
  2025-11-06 14:01 ` [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms Shuai Zhang
  0 siblings, 2 replies; 8+ messages in thread
From: Shuai Zhang @ 2025-11-06 14:01 UTC (permalink / raw)
  To: dmitry.baryshkov, marcel, luiz.dentz
  Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
	quic_chejiang, Shuai Zhang

This patch series fixes delayed hw_error handling during SSR.

Patch 1 adds a wakeup to ensure hw_error is processed promptly after coredump collection.
Patch 2 corrects the timeout unit from jiffies to ms.

Changes v2:
- Split timeout conversion into a separate patch.
- Clarified commit messages and added test case description.
- Link to v1
  https://lore.kernel.org/all/20251104112601.2670019-1-quic_shuaz@quicinc.com/

Shuai Zhang (2):
  Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup
    during SSR
  Bluetooth: hci_qca: Convert timeout from jiffies to ms

 drivers/bluetooth/hci_qca.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH v2 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR
  2025-11-06 14:01 [PATCH v2 0/2] Fix SSR unable to wake up bug Shuai Zhang
@ 2025-11-06 14:01 ` Shuai Zhang
  2025-11-06 14:37   ` Fix SSR unable to wake up bug bluez.test.bot
  2025-11-06 14:01 ` [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms Shuai Zhang
  1 sibling, 1 reply; 8+ messages in thread
From: Shuai Zhang @ 2025-11-06 14:01 UTC (permalink / raw)
  To: dmitry.baryshkov, marcel, luiz.dentz
  Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
	quic_chejiang, Shuai Zhang

When Bluetooth controller encounters a coredump, it triggers
the Subsystem Restart (SSR) mechanism. The controller first
reports the coredump data, and once the data upload is complete,
it sends a hw_error event. The host relies on this event to
proceed with subsequent recovery actions.

If the host has not finished processing the coredump data
when the hw_error event is received,
it sets a timer to wait until either the data processing is complete
or the timeout expires before handling the event.

The current implementation lacks a wakeup trigger. As a result,
even if the coredump data has already been processed, the host
continues to wait until the timer expires, causing unnecessary
delays in handling the hw_error event.

To fix this issue, adds a `wake_up_bit()` call after the host finishes
processing the coredump data. This ensures that the waiting thread is
promptly notified and can proceed to handle the hw_error event without
waiting for the timeout.

Test case:
- Trigger controller coredump using the command: `hcitool cmd 0x3f 0c 26`.
- Use `btmon` to capture HCI logs.
- Observe the time interval between receiving the hw_error event
and the execution of the power-off sequence in the HCI log.

Cc: stable@vger.kernel.org
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 drivers/bluetooth/hci_qca.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 888176b0f..fa6be1992 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1103,7 +1103,7 @@ static void qca_controller_memdump(struct work_struct *work)
 				qca->qca_memdump = NULL;
 				qca->memdump_state = QCA_MEMDUMP_COLLECTED;
 				cancel_delayed_work(&qca->ctrl_memdump_timeout);
-				clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
+				clear_and_wake_up_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
 				clear_bit(QCA_IBS_DISABLED, &qca->flags);
 				mutex_unlock(&qca->hci_memdump_lock);
 				return;
@@ -1181,7 +1181,7 @@ static void qca_controller_memdump(struct work_struct *work)
 			kfree(qca->qca_memdump);
 			qca->qca_memdump = NULL;
 			qca->memdump_state = QCA_MEMDUMP_COLLECTED;
-			clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
+			clear_and_wake_up_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
 		}
 
 		mutex_unlock(&qca->hci_memdump_lock);
-- 
2.34.1


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

* [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms
  2025-11-06 14:01 [PATCH v2 0/2] Fix SSR unable to wake up bug Shuai Zhang
  2025-11-06 14:01 ` [PATCH v2 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
@ 2025-11-06 14:01 ` Shuai Zhang
  2025-11-06 14:27   ` Paul Menzel
  2025-11-11 12:40   ` Dmitry Baryshkov
  1 sibling, 2 replies; 8+ messages in thread
From: Shuai Zhang @ 2025-11-06 14:01 UTC (permalink / raw)
  To: dmitry.baryshkov, marcel, luiz.dentz
  Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
	quic_chejiang, Shuai Zhang

Since the timer uses jiffies as its unit rather than ms, the timeout value
must be converted from ms to jiffies when configuring the timer. Otherwise,
the intended 8s timeout is incorrectly set to approximately 33s.

Cc: stable@vger.kernel.org
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 drivers/bluetooth/hci_qca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index fa6be1992..c14b2fa9d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1602,7 +1602,7 @@ static void qca_wait_for_dump_collection(struct hci_dev *hdev)
 	struct qca_data *qca = hu->priv;
 
 	wait_on_bit_timeout(&qca->flags, QCA_MEMDUMP_COLLECTION,
-			    TASK_UNINTERRUPTIBLE, MEMDUMP_TIMEOUT_MS);
+			    TASK_UNINTERRUPTIBLE, msecs_to_jiffies(MEMDUMP_TIMEOUT_MS));
 
 	clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
 }
-- 
2.34.1


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

* Re: [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms
  2025-11-06 14:01 ` [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms Shuai Zhang
@ 2025-11-06 14:27   ` Paul Menzel
  2025-11-07  3:36     ` Shuai Zhang
  2025-11-11 12:40   ` Dmitry Baryshkov
  1 sibling, 1 reply; 8+ messages in thread
From: Paul Menzel @ 2025-11-06 14:27 UTC (permalink / raw)
  To: Shuai Zhang
  Cc: dmitry.baryshkov, marcel, luiz.dentz, linux-bluetooth, stable,
	linux-arm-msm, linux-kernel, quic_chejiang

Dear Shuai,


Thank you for your patch.

Am 06.11.25 um 15:01 schrieb Shuai Zhang:
> Since the timer uses jiffies as its unit rather than ms, the timeout value
> must be converted from ms to jiffies when configuring the timer. Otherwise,
> the intended 8s timeout is incorrectly set to approximately 33s.
> 
> Cc: stable@vger.kernel.org

A Fixes: tag is needed.

> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> ---
>   drivers/bluetooth/hci_qca.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index fa6be1992..c14b2fa9d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1602,7 +1602,7 @@ static void qca_wait_for_dump_collection(struct hci_dev *hdev)
>   	struct qca_data *qca = hu->priv;
>   
>   	wait_on_bit_timeout(&qca->flags, QCA_MEMDUMP_COLLECTION,
> -			    TASK_UNINTERRUPTIBLE, MEMDUMP_TIMEOUT_MS);
> +			    TASK_UNINTERRUPTIBLE, msecs_to_jiffies(MEMDUMP_TIMEOUT_MS));
>   
>   	clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
>   }

With the Fixes: tag added, feel free to add:

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

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

* RE: Fix SSR unable to wake up bug
  2025-11-06 14:01 ` [PATCH v2 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
@ 2025-11-06 14:37   ` bluez.test.bot
  0 siblings, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2025-11-06 14:37 UTC (permalink / raw)
  To: linux-bluetooth, quic_shuaz

[-- Attachment #1: Type: text/plain, Size: 2376 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/project/bluetooth/list/?series=1020461

---Test result---

Test Summary:
CheckPatch                    PENDING   0.43 seconds
GitLint                       PENDING   0.30 seconds
SubjectPrefix                 PASS      0.16 seconds
BuildKernel                   PASS      25.84 seconds
CheckAllWarning               PASS      28.28 seconds
CheckSparse                   PASS      32.04 seconds
BuildKernel32                 PASS      25.24 seconds
TestRunnerSetup               PASS      516.12 seconds
TestRunner_l2cap-tester       PASS      23.91 seconds
TestRunner_iso-tester         PASS      63.77 seconds
TestRunner_bnep-tester        PASS      5.99 seconds
TestRunner_mgmt-tester        FAIL      116.24 seconds
TestRunner_rfcomm-tester      PASS      9.17 seconds
TestRunner_sco-tester         PASS      14.33 seconds
TestRunner_ioctl-tester       PASS      9.78 seconds
TestRunner_mesh-tester        FAIL      11.86 seconds
TestRunner_smp-tester         PASS      8.38 seconds
TestRunner_userchan-tester    PASS      6.48 seconds
IncrementalBuild              PENDING   0.79 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.096 seconds
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.161 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Timed out    2.031 seconds
Mesh - Send cancel - 2                               Timed out    1.997 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms
  2025-11-06 14:27   ` Paul Menzel
@ 2025-11-07  3:36     ` Shuai Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Shuai Zhang @ 2025-11-07  3:36 UTC (permalink / raw)
  To: Paul Menzel
  Cc: dmitry.baryshkov, marcel, luiz.dentz, linux-bluetooth, stable,
	linux-arm-msm, linux-kernel, quic_chejiang

Dear Paul

On 11/6/2025 10:27 PM, Paul Menzel wrote:
> Dear Shuai,
> 
> 
> Thank you for your patch.
> 
> Am 06.11.25 um 15:01 schrieb Shuai Zhang:
>> Since the timer uses jiffies as its unit rather than ms, the timeout value
>> must be converted from ms to jiffies when configuring the timer. Otherwise,
>> the intended 8s timeout is incorrectly set to approximately 33s.
>>
>> Cc: stable@vger.kernel.org
> 
> A Fixes: tag is needed.
> 
>> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
>> ---
>>   drivers/bluetooth/hci_qca.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index fa6be1992..c14b2fa9d 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -1602,7 +1602,7 @@ static void qca_wait_for_dump_collection(struct hci_dev *hdev)
>>       struct qca_data *qca = hu->priv;
>>         wait_on_bit_timeout(&qca->flags, QCA_MEMDUMP_COLLECTION,
>> -                TASK_UNINTERRUPTIBLE, MEMDUMP_TIMEOUT_MS);
>> +                TASK_UNINTERRUPTIBLE, msecs_to_jiffies(MEMDUMP_TIMEOUT_MS));
>>         clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
>>   }
> 
> With the Fixes: tag added, feel free to add:
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> 

Thank you for your suggestion. I will update and resubmit. 

> Kind regards,
> 
> Paul

Best regards,
Shuai


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

* RE: Fix SSR unable to wake up bug
  2025-11-07  3:39 [PATCH v3 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
@ 2025-11-07  4:02 ` bluez.test.bot
  0 siblings, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2025-11-07  4:02 UTC (permalink / raw)
  To: linux-bluetooth, quic_shuaz

[-- Attachment #1: Type: text/plain, Size: 2296 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/project/bluetooth/list/?series=1020728

---Test result---

Test Summary:
CheckPatch                    PENDING   0.43 seconds
GitLint                       PENDING   0.35 seconds
SubjectPrefix                 PASS      0.13 seconds
BuildKernel                   PASS      23.16 seconds
CheckAllWarning               PASS      25.66 seconds
CheckSparse                   PASS      28.63 seconds
BuildKernel32                 PASS      23.13 seconds
TestRunnerSetup               PASS      467.12 seconds
TestRunner_l2cap-tester       PASS      23.50 seconds
TestRunner_iso-tester         PASS      73.83 seconds
TestRunner_bnep-tester        PASS      6.05 seconds
TestRunner_mgmt-tester        FAIL      109.65 seconds
TestRunner_rfcomm-tester      PASS      9.18 seconds
TestRunner_sco-tester         PASS      14.11 seconds
TestRunner_ioctl-tester       PASS      9.78 seconds
TestRunner_mesh-tester        FAIL      11.58 seconds
TestRunner_smp-tester         PASS      8.34 seconds
TestRunner_userchan-tester    PASS      6.47 seconds
IncrementalBuild              PENDING   0.95 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 487 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.098 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Timed out    2.058 seconds
Mesh - Send cancel - 2                               Timed out    1.995 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms
  2025-11-06 14:01 ` [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms Shuai Zhang
  2025-11-06 14:27   ` Paul Menzel
@ 2025-11-11 12:40   ` Dmitry Baryshkov
  1 sibling, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2025-11-11 12:40 UTC (permalink / raw)
  To: Shuai Zhang
  Cc: marcel, luiz.dentz, linux-bluetooth, stable, linux-arm-msm,
	linux-kernel, quic_chejiang

On Thu, Nov 06, 2025 at 10:01:03PM +0800, Shuai Zhang wrote:
> Since the timer uses jiffies as its unit rather than ms, the timeout value
> must be converted from ms to jiffies when configuring the timer. Otherwise,
> the intended 8s timeout is incorrectly set to approximately 33s.
> 
> Cc: stable@vger.kernel.org

Missing Fixes tag

> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> ---
>  drivers/bluetooth/hci_qca.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index fa6be1992..c14b2fa9d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1602,7 +1602,7 @@ static void qca_wait_for_dump_collection(struct hci_dev *hdev)
>  	struct qca_data *qca = hu->priv;
>  
>  	wait_on_bit_timeout(&qca->flags, QCA_MEMDUMP_COLLECTION,
> -			    TASK_UNINTERRUPTIBLE, MEMDUMP_TIMEOUT_MS);
> +			    TASK_UNINTERRUPTIBLE, msecs_to_jiffies(MEMDUMP_TIMEOUT_MS));
>  
>  	clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
>  }
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry

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

end of thread, other threads:[~2025-11-11 12:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06 14:01 [PATCH v2 0/2] Fix SSR unable to wake up bug Shuai Zhang
2025-11-06 14:01 ` [PATCH v2 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
2025-11-06 14:37   ` Fix SSR unable to wake up bug bluez.test.bot
2025-11-06 14:01 ` [PATCH v2 2/2] Bluetooth: hci_qca: Convert timeout from jiffies to ms Shuai Zhang
2025-11-06 14:27   ` Paul Menzel
2025-11-07  3:36     ` Shuai Zhang
2025-11-11 12:40   ` Dmitry Baryshkov
  -- strict thread matches above, loose matches on Subject: below --
2025-11-07  3:39 [PATCH v3 1/2] Bluetooth: qca: Fix delayed hw_error handling due to missing wakeup during SSR Shuai Zhang
2025-11-07  4:02 ` Fix SSR unable to wake up bug bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox