public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
@ 2026-01-08  6:03 Yang Li via B4 Relay
  2026-01-08  6:48 ` bluez.test.bot
  2026-01-08 15:20 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 4+ messages in thread
From: Yang Li via B4 Relay @ 2026-01-08  6:03 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, Yang Li

From: Yang Li <yang.li@amlogic.com>

PA sync HCI commands incorrectly use conn->conn_timeout, which defaults
to 20s and is too long. If the PA Sync Established event is not
received, the command remains pending and causes userspace timeouts.

Signed-off-by: Yang Li <yang.li@amlogic.com>
---
 net/bluetooth/hci_sync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index f04a90bce4a9..58292b01f062 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
 	if (conn->sid == HCI_SID_INVALID) {
 		err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
 					       HCI_EV_LE_EXT_ADV_REPORT,
-					       conn->conn_timeout, NULL);
+					       HCI_CMD_TIMEOUT, NULL);
 		if (err == -ETIMEDOUT)
 			goto done;
 	}
@@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
 	err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_PA_CREATE_SYNC,
 				       sizeof(cp), &cp,
 				       HCI_EV_LE_PA_SYNC_ESTABLISHED,
-				       conn->conn_timeout, NULL);
+				       HCI_CMD_TIMEOUT, NULL);
 	if (err == -ETIMEDOUT)
 		__hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL,
 				      0, NULL, HCI_CMD_TIMEOUT);

---
base-commit: bdb9aba465a85122bcba01a6154e237b9843e25b
change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2a

Best regards,
-- 
Yang Li <yang.li@amlogic.com>



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

* RE: Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
  2026-01-08  6:03 [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands Yang Li via B4 Relay
@ 2026-01-08  6:48 ` bluez.test.bot
  2026-01-08 15:20 ` [PATCH] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-01-08  6:48 UTC (permalink / raw)
  To: linux-bluetooth, yang.li

[-- Attachment #1: Type: text/plain, Size: 2941 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=1039696

---Test result---

Test Summary:
CheckPatch                    PENDING   0.45 seconds
GitLint                       PENDING   0.37 seconds
SubjectPrefix                 PASS      0.06 seconds
BuildKernel                   PASS      26.24 seconds
CheckAllWarning               PASS      28.65 seconds
CheckSparse                   PASS      32.23 seconds
BuildKernel32                 PASS      25.81 seconds
TestRunnerSetup               PASS      558.09 seconds
TestRunner_l2cap-tester       FAIL      28.40 seconds
TestRunner_iso-tester         PASS      57.14 seconds
TestRunner_bnep-tester        PASS      6.28 seconds
TestRunner_mgmt-tester        FAIL      124.49 seconds
TestRunner_rfcomm-tester      PASS      9.56 seconds
TestRunner_sco-tester         FAIL      14.93 seconds
TestRunner_ioctl-tester       PASS      10.08 seconds
TestRunner_mesh-tester        FAIL      11.50 seconds
TestRunner_smp-tester         PASS      8.50 seconds
TestRunner_userchan-tester    PASS      6.68 seconds
IncrementalBuild              PENDING   0.57 seconds

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

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

##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
Total: 96, Passed: 94 (97.9%), Failed: 2, Not Run: 0

Failed Test Cases
L2CAP BR/EDR Server - Set PHY 2M                     Failed       0.120 seconds
L2CAP LE Client - Set PHY Coded                      Failed       0.156 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.110 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
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    1.903 seconds
Mesh - Send cancel - 2                               Timed out    1.994 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
  2026-01-08  6:03 [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands Yang Li via B4 Relay
  2026-01-08  6:48 ` bluez.test.bot
@ 2026-01-08 15:20 ` Luiz Augusto von Dentz
  2026-01-09  3:06   ` Yang Li
  1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-01-08 15:20 UTC (permalink / raw)
  To: yang.li; +Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel

Hi Yang,

On Thu, Jan 8, 2026 at 1:03 AM Yang Li via B4 Relay
<devnull+yang.li.amlogic.com@kernel.org> wrote:
>
> From: Yang Li <yang.li@amlogic.com>
>
> PA sync HCI commands incorrectly use conn->conn_timeout, which defaults
> to 20s and is too long. If the PA Sync Established event is not
> received, the command remains pending and causes userspace timeouts.

Im pretty sure this is impossible scenario with bluetooth-next, since
1. only one work can be running hci_le_pa_create_sync at time so
HCI_EV_LE_PA_SYNC_ESTABLISHED cannot be outstanding 2. The
conn->timeout shall be aligned with socket timeout so perhaps the
problem is userspace is not setting the socket timeout correctly or
something.

> Signed-off-by: Yang Li <yang.li@amlogic.com>
> ---
>  net/bluetooth/hci_sync.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index f04a90bce4a9..58292b01f062 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>         if (conn->sid == HCI_SID_INVALID) {
>                 err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
>                                                HCI_EV_LE_EXT_ADV_REPORT,
> -                                              conn->conn_timeout, NULL);
> +                                              HCI_CMD_TIMEOUT, NULL);
>                 if (err == -ETIMEDOUT)
>                         goto done;
>         }
> @@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>         err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_PA_CREATE_SYNC,
>                                        sizeof(cp), &cp,
>                                        HCI_EV_LE_PA_SYNC_ESTABLISHED,
> -                                      conn->conn_timeout, NULL);
> +                                      HCI_CMD_TIMEOUT, NULL);
>         if (err == -ETIMEDOUT)
>                 __hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL,
>                                       0, NULL, HCI_CMD_TIMEOUT);
>
> ---
> base-commit: bdb9aba465a85122bcba01a6154e237b9843e25b
> change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2a
>
> Best regards,
> --
> Yang Li <yang.li@amlogic.com>
>
>


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands
  2026-01-08 15:20 ` [PATCH] " Luiz Augusto von Dentz
@ 2026-01-09  3:06   ` Yang Li
  0 siblings, 0 replies; 4+ messages in thread
From: Yang Li @ 2026-01-09  3:06 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel

Hi Luiz
> [ EXTERNAL EMAIL ]
>
> Hi Yang,
>
> On Thu, Jan 8, 2026 at 1:03 AM Yang Li via B4 Relay
> <devnull+yang.li.amlogic.com@kernel.org> wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> PA sync HCI commands incorrectly use conn->conn_timeout, which defaults
>> to 20s and is too long. If the PA Sync Established event is not
>> received, the command remains pending and causes userspace timeouts.
> Im pretty sure this is impossible scenario with bluetooth-next, since
> 1. only one work can be running hci_le_pa_create_sync at time so
> HCI_EV_LE_PA_SYNC_ESTABLISHED cannot be outstanding 2. The
> conn->timeout shall be aligned with socket timeout so perhaps the
> problem is userspace is not setting the socket timeout correctly or
> something.


Well, I got it.

I noticed that BlueZ has a default setting for sync_time with the value 
BT_ISO_SYNC_TIMEOUT=0x07d0 /* 20 secs */.

I would like to know the rationale behind setting it to 20 seconds 
initially. This value seems a bit long to me. Can I directly change this 
value as:

BT_ISO_SYNC_TIMEOUT=0x00C8 /* 2 secs */

>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> ---
>>   net/bluetooth/hci_sync.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index f04a90bce4a9..58292b01f062 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -7159,7 +7159,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>>          if (conn->sid == HCI_SID_INVALID) {
>>                  err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
>>                                                 HCI_EV_LE_EXT_ADV_REPORT,
>> -                                              conn->conn_timeout, NULL);
>> +                                              HCI_CMD_TIMEOUT, NULL);
>>                  if (err == -ETIMEDOUT)
>>                          goto done;
>>          }
>> @@ -7187,7 +7187,7 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data)
>>          err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_PA_CREATE_SYNC,
>>                                         sizeof(cp), &cp,
>>                                         HCI_EV_LE_PA_SYNC_ESTABLISHED,
>> -                                      conn->conn_timeout, NULL);
>> +                                      HCI_CMD_TIMEOUT, NULL);
>>          if (err == -ETIMEDOUT)
>>                  __hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL,
>>                                        0, NULL, HCI_CMD_TIMEOUT);
>>
>> ---
>> base-commit: bdb9aba465a85122bcba01a6154e237b9843e25b
>> change-id: 20260108-pa_sync_cmd_timeout-ff46f67b5d2a
>>
>> Best regards,
>> --
>> Yang Li <yang.li@amlogic.com>
>>
>>
>
> --
> Luiz Augusto von Dentz

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

end of thread, other threads:[~2026-01-09  3:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08  6:03 [PATCH] Bluetooth: hci_sync: use HCI_CMD_TIMEOUT for PA sync commands Yang Li via B4 Relay
2026-01-08  6:48 ` bluez.test.bot
2026-01-08 15:20 ` [PATCH] " Luiz Augusto von Dentz
2026-01-09  3:06   ` Yang Li

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