All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: Increase HCI_AUTO_OFF_TIMEOUT to 10 seconds
@ 2026-07-06 12:15 Shuai Zhang
  2026-07-06 13:11 ` [v1] " bluez.test.bot
  2026-07-06 13:21 ` [PATCH v1] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Shuai Zhang @ 2026-07-06 12:15 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-arm-msm, chejiang,
	quic_chezhou, wei.deng, jinwang.li, mengshi.wu, Shuai Zhang

HCI_AUTO_OFF_TIMEOUT controls how long the kernel waits after an
adapter completes its initial setup before automatically powering
it off, in case userspace (bluetoothd) has not yet issued
MGMT_OP_SET_POWERED. This avoids leaving the controller powered
while unused.

On platforms where other services are ordered ahead of it, the
actual time at which bluetooth.service starts and issues
SET_POWERED can be delayed past this 2 second window. For example,
cloud-init-local.service can perform a network metadata probe
during early boot, delaying bluetooth.service startup by several
seconds:

    $ systemd-analyze critical-chain bluetooth.service
    bluetooth.service +594ms
     `-basic.target @9.342s
        `-sockets.target @9.335s
           `-snapd.socket @9.267s +58ms
              `-sysinit.target @9.025s
                 `-cloud-init.service @8.377s +604ms
                    `-cloud-init-local.service @7.000s +1.340s
                       `-systemd-remount-fs.service @3.257s +44ms
                          `-systemd-fsck-root.service @2.803s +394ms
                             `-systemd-journald.socket @2.223s
                                `-system.slice @1.772s
                                   `--.slice @1.772s

Once the 2 second window is exceeded, HCI_AUTO_OFF fires before
SET_POWERED is received, powering off the controller and losing
its firmware state. The SET_POWERED that bluetoothd eventually
sends then has to reopen the device, triggering an otherwise
avoidable repeat setup and firmware re-download, adding several
more seconds of delay.

Increase the timeout from 2 to 10 seconds to give userspace on
systems with slower service ordering a more realistic window to
take over, avoiding this unnecessary repeat setup, while still
bounding how long an unclaimed controller stays powered on.

Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
---
 include/net/bluetooth/hci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 50f0eef71..ee3f295f9 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -483,7 +483,7 @@ enum {
 #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
 #define HCI_NCMD_TIMEOUT	msecs_to_jiffies(4000)	/* 4 seconds */
 #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
-#define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
+#define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
 #define HCI_ACL_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
 #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
 #define HCI_ISO_TX_TIMEOUT	usecs_to_jiffies(0x7fffff) /* 8388607 usecs */
-- 
2.34.1


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

end of thread, other threads:[~2026-07-06 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 12:15 [PATCH v1] Bluetooth: Increase HCI_AUTO_OFF_TIMEOUT to 10 seconds Shuai Zhang
2026-07-06 13:11 ` [v1] " bluez.test.bot
2026-07-06 13:21 ` [PATCH v1] " Luiz Augusto von Dentz

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.