Skip to content

Conversation

jhedberg
Copy link
Member

@jhedberg jhedberg commented Feb 21, 2025

The buffer allocation in conn.c will trigger warnings if we try to use anything else than K_NO_WAIT for the timeout when called from within the system workqueue.

The calls in l2cap.c and att.c which may pass non-zero timeouts already have proper handling for failed allocations, so make sure we use K_NO_WAIT to avoid unnecessary warnings from conn.c.

@jhedberg
Copy link
Member Author

Hmm, seems like this is not sufficient to get rid of the warning. I get it e.g. with the shell when enabling advertising and connecting to it from my phone:

LE conn param updated: int 0x0024 lat 0 to 42
[00:00:33.211,944] <wrn> bt_conn: Timeout discarded. No blocking in syswq.

So there's some other code path that's also passing a non-zero timeout.

@jhedberg
Copy link
Member Author

Hmm, seems like this is not sufficient to get rid of the warning.

Now updated with another check in l2cap.c. The code paths leading to this point seem to be purely internal and have failed allocation handling in place, so it should be ok for us to do this.

@jhedberg jhedberg requested a review from JordanYates February 21, 2025 08:18
@jhedberg jhedberg changed the title Bluetoth: Host: ATT: Fix buffer allocation warnings in system workqueue Bluetoth: Host: Fix buffer allocation warnings in system workqueue Feb 21, 2025
The buffer allocation in conn.c will trigger warnings if we try to use
anything else than K_NO_WAIT for the timeout when called from within the
system workqueue.

The calls in l2cap.c and att.c which may pass non-zero timeouts already
have proper handling for failed allocations, so make sure we use K_NO_WAIT
to avoid unnecessary warnings from conn.c.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
@fabiobaltieri fabiobaltieri added this to the v4.1.0 milestone Feb 21, 2025
@fabiobaltieri fabiobaltieri merged commit 05b16b9 into zephyrproject-rtos:main Feb 25, 2025
23 checks passed
@jhedberg jhedberg deleted the conn_sys_wq_block branch April 29, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants