Bluetooth: Move LE scan changes behind req_workqueue
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest12 patches 1 replyIn review
- v112 patches 2 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | Bluetooth: Add stubs for synchronous HCI request functionalitynet/ net/ net/ | +15 | 0 replies | |
| 2/12 | Bluetooth: Run all background scan updates through req_workqueueinclude/ net/ net/ +1 more | +25 | 0 replies | |
| 3/12 | Bluetooth: Don't wait for HCI in Add/Remove Devicenet/ | +50 | 0 replies | |
| 4/12 | Bluetooth: Add HCI status return parameter to hci_req_sync()include/ net/ net/ +1 more | +26 | 0 replies | |
| 5/12 | Bluetooth: Use req_workqueue for explicit connect requestsnet/ net/ | +18 | 0 replies | |
| 6/12 | Bluetooth: Use req_workqueue for background scanning when powering onnet/ | +4 | 0 replies | |
| 7/12 | Bluetooth: Make __hci_update_background_scan private to hci_request.cnet/ net/ | +1 | 0 replies | |
| 8/12 | Bluetooth: Move LE scan disable/restart behind req_workqueueinclude/ net/ net/ +1 more | +183 | 0 replies | |
| 9/12 | Bluetooth: Add discovery type validity helpernet/ | +40 | 0 replies | |
| 10/12 | Bluetooth: Add error return value to hci_req_sync callbacknet/ net/ net/ | +54 | 0 replies | |
| 11/12 | Bluetooth: Move Start Discovery to req_workqueueinclude/ net/ net/ | +214 | 0 replies | |
| 12/12 | Bluetooth: Move Stop Discovery to req_workqueueinclude/ net/ net/ +1 more | +71 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 00/12] Bluetooth: Move LE scan changes behind req_workqueue
Hi,
v2: updated version with feedback for 01/12 and 02/12 taken into account.
Quoted 1 line
From the original cover letter:
The current bluetooth-next tree is not able to reliably and in a race-free manner handle updates to the LE scan state. This results in the kernel ending up out of sync with the actual LE scan state and starts sending incorrect scan state HCI commands, often resulting in "not allowed" HCI responses.
This is an initial set of patches to try solve the issue. I've tried to retain as much as possible of the original logic so that it's easier to see that nothing should get broken. Because of this, there are still many simplifications and cleanups that can be done. However, since I've already got 12 patches lined up I wanted to get them sent, reviewed and merged. After that I can concentrate on the cleanups and I'll also be looking into moving the adverising state changes to hci_request.c as well.
The general solution that this set takes to solve the synchronization issues with the LE scan state, is to move all of it behind the hdev->req_workqueue and perform the actions synchronously. The main tool I've used for this is the hci_req_sync() API which allows taking existing asynchronous HCI request helpers and using them to perform the same commands synchronously (by passing the helper as the callback to hci_req_sync).
Since only one work callback is active at a time we get an easy way to avoid races between the changes. All of the new synchronous code can be found in hci_request.c which seemed like an appropriate place for it.
I've done a fair amount of testing with the patches, including mgmt-tester, l2cap-tester and various bluetoothd tests (both with controllers supporting simultaneous Inquiry+LE scan as well as those not supporting it). However, because of the size of the changes it's perfectly possible that I've missed or broken something, so it'd be good if others could give the set a spin before merging it.
Johan
----------------------------------------------------------------
Johan Hedberg (12):
Bluetooth: Add stubs for synchronous HCI request functionality
Bluetooth: Run all background scan updates through req_workqueue
Bluetooth: Don't wait for HCI in Add/Remove Device
Bluetooth: Add HCI status return parameter to hci_req_sync()
Bluetooth: Use req_workqueue for explicit connect requests
Bluetooth: Use req_workqueue for background scanning when powering on
Bluetooth: Make __hci_update_background_scan private to hci_request.c
Bluetooth: Move LE scan disable/restart behind req_workqueue
Bluetooth: Add discovery type validity helper
Bluetooth: Add error return value to hci_req_sync callback
Bluetooth: Move Start Discovery to req_workqueue
Bluetooth: Move Stop Discovery to req_workqueue
include/net/bluetooth/hci.h | 3 +- include/net/bluetooth/hci_core.h | 10 +- net/bluetooth/hci_conn.c | 39 +-- net/bluetooth/hci_core.c | 243 ++++------------- net/bluetooth/hci_request.c | 537 +++++++++++++++++++++++++++++++++++--- net/bluetooth/hci_request.h | 26 +- net/bluetooth/mgmt.c | 503 +++++++---------------------------- 7 files changed, 684 insertions(+), 677 deletions(-)