Skip to content

Commit 4b57af4

Browse files
committed
Bluetooth: Host: Move tx_processor to bt_taskq
The Bluetooth Host itself performs operations on the system workqueue which are blocking waiting for the tx_processor to run. This results in deadlocks. TX processor is supposed to be non-blocking, so this change puts it on the new bt_taskq. This effectively gives tx_processor its own thread, like the BT TX thread that used to exist. But, this time this thread is intended to be shared with any other non-blocking Bluetooth Host tasks. Signed-off-by: Aleksander Wasaznik <[email protected]>
1 parent 964b9aa commit 4b57af4

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

subsys/bluetooth/host/bt_taskq.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ struct k_work_q bt_taskq;
1616

1717
static int bt_taskq_init(void)
1818
{
19-
const struct k_work_queue_config cfg = {
19+
struct k_work_queue_config cfg = {
2020
.name = "bt_taskq",
21-
/* Enable CONFIG_WORKQUEUE_WORK_TIMEOUT to detect tasks that take too long. */
22-
.work_timeout_ms = 10,
2321
};
2422

2523
k_work_queue_start(&bt_taskq, bt_taskq_stack, K_THREAD_STACK_SIZEOF(bt_taskq_stack),

subsys/bluetooth/host/hci_core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
#include "addr_internal.h"
5050
#include "adv.h"
51+
#include "bt_taskq.h"
5152
#include "common/hci_common_internal.h"
5253
#include "common/bt_str.h"
5354
#include "common/rpa.h"
@@ -282,8 +283,6 @@ void bt_send_one_host_num_completed_packets(uint16_t handle)
282283
BT_ASSERT_MSG(err == 0, "Unable to send Host NCP (err %d)", err);
283284
}
284285

285-
#include "bt_taskq.h"
286-
287286
#if defined(CONFIG_BT_TESTING)
288287
__weak void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf)
289288
{
@@ -5038,5 +5037,5 @@ static K_WORK_DEFINE(tx_work, tx_processor);
50385037
void bt_tx_irq_raise(void)
50395038
{
50405039
LOG_DBG("kick TX");
5041-
k_work_submit(&tx_work);
5040+
k_work_submit_to_queue(&bt_taskq, &tx_work);
50425041
}

0 commit comments

Comments
 (0)