-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Controller: Advertising can only be started 2^16 times #30480
Comments
As |
The regression was introduced here: 2b47630#diff-4b2727dd1031ae4d5de482dc43a4c5d2295a89f718b04e5480f6c8f8082846b4 The following is missing from
I will send a PR soon. Thanks for the issue report and detailed analysis. |
While I imagine this would work in most real-world cases, it's not strictly correct.
|
@JordanYates This is the LF clock which is also the core system clock, it is only started once on power up. The
By design, only one thread shall dispatch HCI cmd and data to the controller, and is a co-operative thread.
Clock setup/settle failure is consider hardware fatal error, there is no expectation to succeed future calls, example, missing/damaged 32 KHz crystal on the board. |
Fix lll_clock_wait function to wait for LF clock to settle only once after power up. Regression introduced in commit 2b47630 ("bluetooth: controller: Adapt to onoff clock control"). Fixes zephyrproject-rtos#30480. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix lll_clock_wait function to wait for LF clock to settle only once after power up. Regression introduced in commit 2b47630 ("bluetooth: controller: Adapt to onoff clock control"). Fixes #30480. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix lll_clock_wait function to wait for LF clock to settle only once after power up. Regression introduced in commit 2b47630 ("bluetooth: controller: Adapt to onoff clock control"). Fixes #30480. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix lll_clock_wait function to wait for LF clock to settle only once after power up. Regression introduced in commit 2b47630 ("bluetooth: controller: Adapt to onoff clock control"). Fixes zephyrproject-rtos#30480. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix lll_clock_wait function to wait for LF clock to settle only once after power up. Regression introduced in commit 2b47630 ("bluetooth: controller: Adapt to onoff clock control"). Fixes #30480. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Describe the bug
On Nordic devices, Bluetooth advertising can only be started ~2^16 times before all calls to
bt_le_adv_start
return-EIO
.Will eventually result in :
The root cause of this issue is the failure to release
onoff_manager
dependencies inlll_clock.c
Each time advertising is started, we wait until the LF clock is ready:
ll_adv_enable
->lll_clock_wait
->blocking_on
->onoff_request
Each call to
blocking_on
adds an additional dependency viaonoff_request
that is never released with a call toonoff_release
.Eventually the
refs
counter will reachUINT16_MAX
, which will causeonoff_request
to always return-EAGAIN
.To Reproduce
Add the following to
clock_ready
inlll_clock.c
to reduce reproduction time:If the
refs
were being properly released, there is still a headroom of ~156 to allow for normal operation.Repeatedly call
bt_le_adv_start
andbt_le_adv_stop
until-EIO
is always observed.Expected behavior
Advertising sets should be able to be started and stopped any number of times without errors.
Impact
This bug can only be recovered from by rebooting the device, as nothing will naturally reduce the reference count.
If a reboot is not triggered, the device can no longer be interacted with via Bluetooth.
For devices without physical access to the PCB, this bug bricks the device.
Logs and console output
Standard error messages are included above.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: