zephyr/subsys
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
..
bluetooth Bluetooth: Fix host RX thread deadlock 2020-07-06 11:15:39 +02:00
canbus canbus: canopen: fix reference to CAN in Automation draft standard 2020-06-29 14:10:56 -04:00
console console: tty: Fix k_sem_take with wait time from ISR 2020-06-17 17:10:08 +02:00
cpp cpp: Fixed compile warning with extern array declaration 2020-06-09 14:42:16 +02:00
debug zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dfu dfu: flash_img: Constify flash_img_buffered_write() data parameter 2020-06-10 09:30:08 +02:00
disk zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
fb zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
fs subsys/fs: Fix fs_* operations crashing when file closed 2020-07-03 12:16:11 -04:00
jwt zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
logging logging: enhanced external logsystems 2020-06-17 17:08:12 +02:00
mgmt mgmt: correct MPU_ALLOW_FLASH_WRITE selection 2020-07-02 12:28:06 +02:00
net net: l2: openthread: Implement enable API function 2020-07-02 08:43:45 -04:00
power soc: arm: st_stm32 add low power to stm32wb series 2020-07-02 08:45:40 -04:00
random random: entropy: Fix invalid memory access 2020-07-01 07:22:18 -04:00
settings settings: Fix uninitialised variables 2020-06-17 08:55:59 +03:00
shell shell: kernel: select dependencies 2020-06-24 21:37:12 -04:00
stats zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
storage storage/stream: allow NULL data pointer 2020-06-22 14:36:05 +02:00
testsuite test: remove TEST_SHELL 2020-06-24 21:37:12 -04:00
tracing zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
usb usb: Correct USB setup packet endianness in USB core. 2020-06-23 19:21:41 +02:00
CMakeLists.txt tracing: move tracing under subsys/ 2020-02-07 15:58:05 -05:00
Kconfig tracing: move tracing under subsys/ 2020-02-07 15:58:05 -05:00