Skip to contentSkip to conversation

Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

PATCH Applied Luiz Augusto von Dentz 4 participants 10 messages Aug 29, 2023 – Sep 20, 2023

Subsystems (5)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

Fixes 27d54b778ad1 ("Bluetooth: Rework le_scan_restart for hci_sync")
---
 net/bluetooth/hci_sync.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
net/bluetooth/hci_sync.c +4 -9
index 9b93653c6197..fd7c5d902856 100644
@@ -413,11 +413,6 @@ static int hci_le_scan_restart_sync(struct hci_dev *hdev)
 					   LE_SCAN_FILTER_DUP_ENABLE);
 }
 
-static int le_scan_restart_sync(struct hci_dev *hdev, void *data)
-{
-	return hci_le_scan_restart_sync(hdev);
-}
-
 static void le_scan_restart(struct work_struct *work)
 {
 	struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -427,15 +422,15 @@ static void le_scan_restart(struct work_struct *work)
 
 	bt_dev_dbg(hdev, "");
 
-	hci_dev_lock(hdev);
-
-	status = hci_cmd_sync_queue(hdev, le_scan_restart_sync, NULL, NULL);
+	status = hci_le_scan_restart_sync(hdev);
 	if (status) {
 		bt_dev_err(hdev, "failed to restart LE scan: status %d",
 			   status);
-		goto unlock;
+		return;
 	}
 
+	hci_dev_lock(hdev);
+
 	if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) ||
 	    !hdev->discovery.scan_start)
 		goto unlock;
Signature · 1 line
2.41.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=780332

---Test result---

Test Summary:

CheckPatch                    FAIL      0.96 seconds
GitLint                       FAIL      0.58 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      35.95 seconds
CheckAllWarning               PASS      35.32 seconds
CheckSparse                   PASS      39.77 seconds
CheckSmatch                   PASS      111.71 seconds
BuildKernel32                 PASS      30.60 seconds
TestRunnerSetup               PASS      472.66 seconds
TestRunner_l2cap-tester       PASS      26.59 seconds
TestRunner_iso-tester         PASS      47.41 seconds
TestRunner_bnep-tester        PASS      12.15 seconds
TestRunner_mgmt-tester        PASS      218.19 seconds
TestRunner_rfcomm-tester      PASS      15.49 seconds
TestRunner_sco-tester         PASS      18.88 seconds
TestRunner_ioctl-tester       PASS      17.38 seconds
TestRunner_mesh-tester        PASS      15.88 seconds
TestRunner_smp-tester         PASS      13.73 seconds
TestRunner_userchan-tester    PASS      10.71 seconds
IncrementalBuild              PASS      28.98 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER
WARNING: Unknown link reference 'link:', use 'Link:' or 'Closes:' instead #90:

total: 0 errors, 1 warnings, 0 checks, 30 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13369574.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
12: B1 Line exceeds max length (90>80): "link: https://lore.kernel.org/linux-bluetooth/[email protected]/#t"

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

[...]

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
Quoted 14 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

Quoted 5 lines
Quoted 1 line

[...]

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

[1] see
https://lore.kernel.org/linux-bluetooth/[email protected]/

author maintainer
#4 lore raw

Hi,

Quoted 18 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 16 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

[...]

Quoted 7 lines
Quoted 3 lines

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

We were late for including it to 6.5, that said the regression was introduced in 6.4, but I could probably have it marked for stable just to make sure it would get backported to affected versions.

Quoted 8 lines

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

[1] see
https://lore.kernel.org/linux-bluetooth/[email protected]/

Signature · 1 line
Luiz Augusto von Dentz
#5 lore raw
Quoted 21 lines · Luiz Augusto von Dentz
Quoted 19 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 17 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

[...]

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75
Quoted 6 lines
Quoted 3 lines

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

We were late for including it to 6.5, that said the regression was introduced in 6.4,

6.4? From the fixes tag it sounded like it was 6.1. Whatever, doesn't make a difference, because:

That answer doesn't answer the question afaics, as both 6.1 and 6.4 were released in the past year -- the fix thus should not wait till the next merge window, unless it's high risk or something. See this statement from Linus:
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Quoted 2 lines

but I could probably have it marked for stable just to make sure it would get backported to affected versions.

That would be great, too!

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

author maintainer
#6 lore raw

Hi Thorsten,

Quoted 27 lines · Thorsten Leemhuis
Quoted 25 lines · Luiz Augusto von Dentz
Quoted 22 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 12 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.

Quoted 5 lines
Quoted 1 line

[...]

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

Quoted 5 lines
Quoted 2 lines

We were late for including it to 6.5, that said the regression was introduced in 6.4,

6.4? From the fixes tag it sounded like it was 6.1. Whatever, doesn't make a difference, because:

It seems I had it confused with HCI_QUIRK_BROKEN_LE_CODED, so you are right about this affecting from 6.1 onwards.

Quoted 5 lines

That answer doesn't answer the question afaics, as both 6.1 and 6.4 were released in the past year -- the fix thus should not wait till the next merge window, unless it's high risk or something. See this statement from Linus:
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Thanks for the feedback, I will try to push fixes to net more often.

Quoted 4 lines
Quoted 2 lines

but I could probably have it marked for stable just to make sure it would get backported to affected versions.

That would be great, too!

Well now that it has already been merged via -next tree shall we still attempt to mark it as stable? Perhaps we need to check if it was not backported already based on the Fixes tag.

Quoted 5 lines

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

Signature · 1 line
Luiz Augusto von Dentz
#7 lore raw
Quoted 26 lines · Luiz Augusto von Dentz
Quoted 17 lines · Thorsten Leemhuis
Quoted 16 lines · Luiz Augusto von Dentz
Quoted 14 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 13 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

Quoted 7 lines

[...]

Quoted 5 lines

That answer doesn't answer the question afaics, as both 6.1 and 6.4 were released in the past year -- the fix thus should not wait till the next merge window, unless it's high risk or something. See this statement from Linus:
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Thanks for the feedback, I will try to push fixes to net more often.

Great, many thx!

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

but I could probably have it marked for stable just to make sure it would get backported to affected versions.

That would be great, too!

Well now that it has already been merged via -next tree shall we still attempt to mark it as stable? Perhaps we need to check if it was not backported already based on the Fixes tag.

Changes only get backported once they hit mainline, which hasn't happened yet. And to get them into the net branch (and from there to mainline) a new commit is needed anyway, so you might as well add the stable tag to it. Side note: And don't worry that identical commit is already in -next, git handles that well afaik (but if you rebase bluetooth-next for other reasons anyway you might as well remove it).

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

#8 lore raw

Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting for once, to make this easily accessible to everyone.

@Luiz Augusto von Dentz: did you make any progress to get this into net to make sure this rather sooner then later heads to mainline? Doesn't looks like it from here, but maybe I'm missing something.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

#regzbot poke

Quoted 56 lines · Thorsten Leemhuis
Quoted 26 lines · Luiz Augusto von Dentz
Quoted 17 lines · Thorsten Leemhuis
Quoted 16 lines · Luiz Augusto von Dentz
Quoted 14 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 13 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

Quoted 7 lines

[...]

Quoted 5 lines

That answer doesn't answer the question afaics, as both 6.1 and 6.4 were released in the past year -- the fix thus should not wait till the next merge window, unless it's high risk or something. See this statement from Linus:
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Thanks for the feedback, I will try to push fixes to net more often.

Great, many thx!

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

but I could probably have it marked for stable just to make sure it would get backported to affected versions.

That would be great, too!

Well now that it has already been merged via -next tree shall we still attempt to mark it as stable? Perhaps we need to check if it was not backported already based on the Fixes tag.

Changes only get backported once they hit mainline, which hasn't happened yet. And to get them into the net branch (and from there to mainline) a new commit is needed anyway, so you might as well add the stable tag to it. Side note: And don't worry that identical commit is already in -next, git handles that well afaik (but if you rebase bluetooth-next for other reasons anyway you might as well remove it).

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

author maintainer
#9 lore raw

Hi Thorsten,

Quoted 7 lines · Thorsten Leemhuis

Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting for once, to make this easily accessible to everyone.

@Luiz Augusto von Dentz: did you make any progress to get this into net to make sure this rather sooner then later heads to mainline? Doesn't looks like it from here, but maybe I'm missing something.

Just sent the pull-request:

https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

Quoted 66 lines

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

#regzbot poke

Quoted 56 lines · Thorsten Leemhuis
Quoted 26 lines · Luiz Augusto von Dentz
Quoted 17 lines · Thorsten Leemhuis
Quoted 16 lines · Luiz Augusto von Dentz
Quoted 14 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 13 lines · On 31.08.23 00:20, [email protected] wrote:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Tue, 29 Aug 2023 13:59:36 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires periodic restarts of the scanning procedure as the controller would consider device previously found as duplicated despite of RSSI changes, but in order to set the scan timeout properly set le_scan_restart needs to be synchronous so it shall not use hci_cmd_sync_queue which defers the command processing to cmd_sync_work.
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Here is the summary with links:
- Bluetooth: hci_sync: Fix handling of HCI_QUIRK_STRICT_DUPLICATE_FILTER

    https://git.kernel.org/bluetooth/bluetooth-next/c/52bf4fd43f75

That is (maybe among others?) a fix for a regression from 6.1, so why was this merged into a "for-next" branch instead of a branch that targets the current cycle?

Quoted 7 lines

[...]

Quoted 5 lines

That answer doesn't answer the question afaics, as both 6.1 and 6.4 were released in the past year -- the fix thus should not wait till the next merge window, unless it's high risk or something. See this statement from Linus:
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Thanks for the feedback, I will try to push fixes to net more often.

Great, many thx!

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

but I could probably have it marked for stable just to make sure it would get backported to affected versions.

That would be great, too!

Well now that it has already been merged via -next tree shall we still attempt to mark it as stable? Perhaps we need to check if it was not backported already based on the Fixes tag.

Changes only get backported once they hit mainline, which hasn't happened yet. And to get them into the net branch (and from there to mainline) a new commit is needed anyway, so you might as well add the stable tag to it. Side note: And don't worry that identical commit is already in -next, git handles that well afaik (but if you rebase bluetooth-next for other reasons anyway you might as well remove it).

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

Signature · 1 line
Luiz Augusto von Dentz