-
Notifications
You must be signed in to change notification settings - Fork 736
Host cherry pick tx processor thread #3606
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
Open
KyraLengfeld
wants to merge
4
commits into
nrfconnect:main
Choose a base branch
from
KyraLengfeld:host_cherry_pick_tx_processor_thread
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Host cherry pick tx processor thread #3606
KyraLengfeld
wants to merge
4
commits into
nrfconnect:main
from
KyraLengfeld:host_cherry_pick_tx_processor_thread
+179
−10
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Dec 4, 2025
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-zephyr#3606 Signed-off-by: Nordic Builder <[email protected]>
KyraLengfeld
pushed a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Dec 5, 2025
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-zephyr#3606 Signed-off-by: Nordic Builder <[email protected]>
78d2eec to
f5a51d6
Compare
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Dec 8, 2025
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-zephyr#3606 Signed-off-by: Nordic Builder <[email protected]>
f5a51d6 to
9b29f90
Compare
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Dec 9, 2025
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-zephyr#3606 Signed-off-by: Nordic Builder <[email protected]>
ATT is invoking user callbacks in its net_buf destroy function. It is
common practice that these callbacks can block on bt_hci_cmd_alloc().
This is a deadlock when the net_buf_unref() happens inside the HCI
driver, invoked from tx_processor.
Blocking callbacks like this appear in our own samples. See further down
about how this problem was detected.
tx_processor not protect against blocking callbacks so it is de-facto
forbidden. The Host should not equip net_bufs with dangerous destroy
callbacks.
This commit makes ATT defer its net_buf destruction and user callback
invocation to the system workqueue, so that net_buf_unref is safe to
call from non-blocking threads. In the case of the deadlock, the
net_buf_unref() was below the tx_processor in the call stack, which (at
the time of this commit) is on the system work queue, so defering it to
the system work queue is preserving the existing behavior.
Future improvement may be to allow the user to provide their own
workqueue for ATT callbacks.
This deadlock was detected because the following test was failing while
moving tx_processor to the bt_taskq:
tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh
The above test has an ATT callback `write_cmd_cb` invokes
`bt_conn_le_param_update` can block waiting for `tx_processor`.
The reason it was not failing while tx_processor was on the system work
queue is that the GATT API has a special non-blocking behavior when
called from the system work queue.
Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit 6889042)
Signed-off-by: Kyra Lengfeld <[email protected]>
…al_identity Reduce BT_MAX_CONN from 62 to 61 to make it build on integration platform qemu_cortex_m3/ti_lm3s6965 when we add bt_taskq in subsequent commit. The number 62 seems arbitrary here, so reducing it by one should not have any practical impact. Signed-off-by: Aleksander Wasaznik <[email protected]> (cherry picked from commit 0ee5d70) Signed-off-by: Kyra Lengfeld <[email protected]>
When thread that TX processor is used to send commands and data to Controller is also used for sync commands sending and command buffer allocation, a deadlock happens. This thread is used to avoid such deadlocks by moving TX processor to its own dedicated thread exclusively used by tx processor only. Co-authored-by: Pavel Vasilyev <[email protected]> Signed-off-by: Pavel Vasilyev <[email protected]> Signed-off-by: Aleksander Wasaznik <[email protected]> (cherry picked from commit f101976) Signed-off-by: Kyra Lengfeld <[email protected]>
The workaround in bt_cmd_send_sync should no longer by needed when tx_processor is not on the system work queue. Signed-off-by: Aleksander Wasaznik <[email protected]> (cherry picked from commit 04b8dba) Signed-off-by: Kyra Lengfeld <[email protected]>
9b29f90 to
0b03f4b
Compare
NordicBuilder
added a commit
to NordicBuilder/sdk-nrf
that referenced
this pull request
Dec 10, 2025
Automatically created by action-manifest-pr GH action from PR: nrfconnect/sdk-zephyr#3606 Signed-off-by: Nordic Builder <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry picks the four commits from zephyrproject-rtos/zephyr#97913 to run tx_processor on its own thread.