All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Indicate PAST RX ready to userspace
@ 2026-10-11 20:39 Pauli Virtanen
  2026-10-11 20:39 ` [PATCH 1/2] Bluetooth: hci_sync: add request wait hook for __hci_cmd_sync_sk Pauli Virtanen
  2026-10-11 20:39 ` [PATCH 2/2] Bluetooth: ISO: Signal BIS PAST ready to userspace via POLLOUT Pauli Virtanen
  0 siblings, 2 replies; 5+ messages in thread
From: Pauli Virtanen @ 2026-10-11 20:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen, marcel, luiz.dentz, linux-kernel

Currently there is the following race in BASS PAST:

1. Assistant: TX Add Source
2. Delegator user: RX Add Source, listen(), TX Bcast Rcv State Nfy
3a. Assistant: RX Bcast Rcv State Nfy, Send PAST
3b. Delegator kernel (hci_sync)
     - HCI_OP_LE_PAST_PARAMS queued -> Command Complete
     - start waiting for HCI_EV_LE_PAST_RECEIVED

Steps 3a and 3b are not ordered, so LE PAST may arrive when kernel or
controller is not ready to receive it.

This is why test_bass_past_transport_acquire functional test is flaky.

Solve this by new userspace API: listen() socket signals POLLOUT when
kernel is ready for PAST.

Userspace shall notify PAST ready only after that, fixed in separate
BlueZ patch series.  Also add related iso-tester tests + uAPI
documentation there.

This needed an extension to the HCI_REQ handling, to set POLLOUT only
after hci_sync has started waiting for the PA events.  Didn't see easy
ways to simplify this, without completely changing the
hci_connect_pa_sync() -> create_pa_complete() flow.

***

An alternative uAPI here could be to have listen() block until PAST
listener is ready. The time it blocks is however not well bounded if
hci_sync queue is stuck doing something else first. We probably want to
avoid stalls in bluetoothd, so went with async notification here.

***

Testing: test_bass_past_transport_acquire: 24/24 passed at -n 6
(pre-patch baseline: 6/24 failed). In --btvirt-debug delegator 0x205c
(LE Set PAST Parameters) is before assistant 0x205b (transfer) in every
run. Pre-patch failures show the inverse (0x205b first, or in same
btvirt instant).

Not tested on real hardware, only on the emulator.

LLM was used for triage + patch review + test writing.  Design and
implementation is mine.

Assisted-by: opencode:qwen3.8-flash-next opencode:gpt-6-sol

Pauli Virtanen (2):
  Bluetooth: hci_sync: add request wait hook for __hci_cmd_sync_sk
  Bluetooth: ISO: Signal BIS PAST ready to userspace via POLLOUT

 include/net/bluetooth/bluetooth.h |   2 +
 include/net/bluetooth/hci_sync.h  |  10 ++-
 net/bluetooth/hci_core.c          |   9 ++-
 net/bluetooth/hci_sync.c          | 109 ++++++++++++++++++++++++------
 net/bluetooth/iso.c               |  45 +++++++++++-
 5 files changed, 150 insertions(+), 25 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-11 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-11 20:39 [PATCH 0/2] Indicate PAST RX ready to userspace Pauli Virtanen
2026-10-11 20:39 ` [PATCH 1/2] Bluetooth: hci_sync: add request wait hook for __hci_cmd_sync_sk Pauli Virtanen
2026-10-11 22:04   ` Pauli Virtanen
2026-10-11 22:51   ` Indicate PAST RX ready to userspace bluez.test.bot
2026-10-11 20:39 ` [PATCH 2/2] Bluetooth: ISO: Signal BIS PAST ready to userspace via POLLOUT Pauli Virtanen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.