Skip to contentSkip to conversation

Reason to disable adv during power off without clearing

PATCH In review Zhengping Jiang 3 participants 9 messages Jan 25, 2023 – Jan 26, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Reason to disable adv during power off without clearing

This change was made to keep the same behavior as before the hci_sync rework. When the adapter is powered off, the advertisement will be disabled, instead of being cleared. As a result, when the adapter is powered on, the advertisement can be re-enabled. There is no need to re-register the same advertisement.

However, if the adv is not cleared and the user requested to remove the adv when the adapter is off, it will trigger GPIO reset, so we will not send the HCI command in this case.

Changes in v1:
- Mark the advertisement as disabled instead of clearing it.
- Remove the advertisement without sending HCI command if the adapter is off.

Archie Pusaka (1):
Bluetooth: Don't send HCI commands to remove adv if adapter is off

 net/bluetooth/hci_sync.c | 57 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.1.456.gfc5497dd1b-goog
#1 lore raw

PATCH 1/1 Bluetooth: Don't send HCI commands to remove adv if adapter is off

From: Archie Pusaka <[email protected]>

Mark the advertisement as disabled when powering off the adapter without removing the advertisement, so they can be correctly re-enabled when adapter is powered on again.

When adapter is off and user requested to remove advertisement, a HCI command will be issued. This causes the command to timeout and trigger GPIO reset.

Therefore, immediately remove the advertisement without sending any HCI commands.

Note that the above scenario only happens with extended advertisement (i.e. not using software rotation), because on the SW rotation scenario, we just wait until the rotation timer runs out before sending the HCI command. Since the timer is inactive when adapter is off, no HCI commands are sent.

---

Changes in v1:
- Mark the advertisement as disabled instead of clearing it.
- Remove the advertisement without sending HCI command if the adapter is off.

 net/bluetooth/hci_sync.c | 57 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)
net/bluetooth/hci_sync.c +53 -4
index 117eedb6f709..08da68a30acc 100644
@@ -1591,6 +1591,16 @@ int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
 	if (!ext_adv_capable(hdev))
 		return 0;
 
+	/* When adapter is off, remove adv without sending HCI commands */
+	if (!hdev_is_powered(hdev)) {
+		hci_dev_lock(hdev);
+		err = hci_remove_adv_instance(hdev, instance);
+		if (!err)
+			mgmt_advertising_removed(sk, hdev, instance);
+		hci_dev_unlock(hdev);
+		return err;
+	}
+
 	err = hci_disable_ext_adv_instance_sync(hdev, instance);
 	if (err)
 		return err;
@@ -1772,6 +1782,23 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
 	return hci_start_adv_sync(hdev, instance);
 }
 
+static void hci_clear_ext_adv_ins_during_power_off(struct hci_dev *hdev,
+						   struct sock *sk)
+{
+	struct adv_info *adv, *n;
+	int err;
+
+	hci_dev_lock(hdev);
+	list_for_each_entry_safe(adv, n, &hdev->adv_instances, list) {
+		u8 instance = adv->instance;
+
+		err = hci_remove_adv_instance(hdev, instance);
+		if (!err)
+			mgmt_advertising_removed(sk, hdev, instance);
+	}
+	hci_dev_unlock(hdev);
+}
+
 static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk)
 {
 	int err;
@@ -1779,6 +1806,12 @@ static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk)
 	if (!ext_adv_capable(hdev))
 		return 0;
 
+	/* When adapter is off, remove adv without sending HCI commands */
+	if (!hdev_is_powered(hdev)) {
+		hci_clear_ext_adv_ins_during_power_off(hdev, sk);
+		return 0;
+	}
+
 	/* Disable instance 0x00 to disable all instances */
 	err = hci_disable_ext_adv_instance_sync(hdev, 0x00);
 	if (err)
@@ -5177,9 +5210,27 @@ static int hci_disconnect_all_sync(struct hci_dev *hdev, u8 reason)
 	return 0;
 }
 
+static void hci_disable_ext_advertising_temporarily(struct hci_dev *hdev)
+{
+	struct adv_info *adv, *n;
+
+	if (!ext_adv_capable(hdev))
+		return;
+
+	hci_dev_lock(hdev);
+
+	list_for_each_entry_safe(adv, n, &hdev->adv_instances, list)
+		adv->enabled = false;
+
+	hci_dev_clear_flag(hdev, HCI_LE_ADV);
+
+	hci_dev_unlock(hdev);
+}
+
 /* This function perform power off HCI command sequence as follows:
  *
- * Clear Advertising
+ * Disable Advertising Instances. Do not clear adv instances so advertising
+ * can be re-enabled on power on.
  * Stop Discovery
  * Disconnect all connections
  * hci_dev_close_sync
@@ -5199,9 +5250,7 @@ static int hci_power_off_sync(struct hci_dev *hdev)
 			return err;
 	}
 
-	err = hci_clear_adv_sync(hdev, NULL, false);
-	if (err)
-		return err;
+	hci_disable_ext_advertising_temporarily(hdev);
 
 	err = hci_stop_discovery_sync(hdev);
 	if (err)
Signature · 1 line
2.39.1.456.gfc5497dd1b-goog
#2 lore raw

Re: [kernel PATCH v1 1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

Hi Zhengping,

Quoted 10 lines · Zhengping Jiang

From: Archie Pusaka <[email protected]>

Mark the advertisement as disabled when powering off the adapter without removing the advertisement, so they can be correctly re-enabled when adapter is powered on again.

When adapter is off and user requested to remove advertisement, a HCI command will be issued. This causes the command to timeout and trigger GPIO reset.

Please include the btmon portion when the issue occurs.

Quoted 9 lines

Therefore, immediately remove the advertisement without sending any HCI commands.

Note that the above scenario only happens with extended advertisement (i.e. not using software rotation), because on the SW rotation scenario, we just wait until the rotation timer runs out before sending the HCI command. Since the timer is inactive when adapter is off, no HCI commands are sent.

Quoted 8 lines

---

Changes in v1:
- Mark the advertisement as disabled instead of clearing it.
- Remove the advertisement without sending HCI command if the adapter is off.

Perhaps we should split these into 2 separated changes then, on top of it it perhaps would be a good idea to implement a test in mgmt-tester to check the correct behavior.

Quoted 8 lines
 net/bluetooth/hci_sync.c | 57 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)
net/bluetooth/hci_sync.c +0 -0
index 117eedb6f709..08da68a30acc 100644

net/bluetooth/hci_sync.c int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance, · line 1599

Quoted 9 lines
net/bluetooth/hci_sync.c +6 -0
@@ -1591,6 +1591,16 @@ int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
        if (!ext_adv_capable(hdev))
                return 0;
 
+       /* When adapter is off, remove adv without sending HCI commands */
+       if (!hdev_is_powered(hdev)) {
+               hci_dev_lock(hdev);
+               err = hci_remove_adv_instance(hdev, instance);
+               if (!err)
+                       mgmt_advertising_removed(sk, hdev, instance);

This code above is duplicated in a few places so we might as well have it as a separate function e.g. hci_remove_adv

Quoted 14 lines
net/bluetooth/hci_sync.c +7 -0
+               hci_dev_unlock(hdev);
+               return err;
+       }
+
        err = hci_disable_ext_adv_instance_sync(hdev, instance);
        if (err)
                return err;
@@ -1772,6 +1782,23 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
        return hci_start_adv_sync(hdev, instance);
 }
 
+static void hci_clear_ext_adv_ins_during_power_off(struct hci_dev *hdev,
+                                                  struct sock *sk)
+{

net/bluetooth/hci_sync.c int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance, · line 1797

Quoted 10 lines
net/bluetooth/hci_sync.c +10 -0
+       struct adv_info *adv, *n;
+       int err;
+
+       hci_dev_lock(hdev);
+       list_for_each_entry_safe(adv, n, &hdev->adv_instances, list) {
+               u8 instance = adv->instance;
+
+               err = hci_remove_adv_instance(hdev, instance);
+               if (!err)
+                       mgmt_advertising_removed(sk, hdev, instance);

Then just call hci_remove_adv.

Quoted 8 lines
net/bluetooth/hci_sync.c +4 -0
+       }
+       hci_dev_unlock(hdev);
+}
+
 static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk)
 {
        int err;

net/bluetooth/hci_sync.c static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk) · line 1811

Quoted 6 lines
net/bluetooth/hci_sync.c +3 -0
@@ -1779,6 +1806,12 @@ static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk)
        if (!ext_adv_capable(hdev))
                return 0;
 
+       /* When adapter is off, remove adv without sending HCI commands */
+       if (!hdev_is_powered(hdev)) {
+               hci_clear_ext_adv_ins_during_power_off(hdev, sk);

Use the remove to describe the action e.g. hci_remove_all_adv.

Quoted 36 lines
net/bluetooth/hci_sync.c +22 -1
+               return 0;
+       }
+
        /* Disable instance 0x00 to disable all instances */
        err = hci_disable_ext_adv_instance_sync(hdev, 0x00);
        if (err)
@@ -5177,9 +5210,27 @@ static int hci_disconnect_all_sync(struct hci_dev *hdev, u8 reason)
        return 0;
 }
 
+static void hci_disable_ext_advertising_temporarily(struct hci_dev *hdev)
+{
+       struct adv_info *adv, *n;
+
+       if (!ext_adv_capable(hdev))
+               return;
+
+       hci_dev_lock(hdev);
+
+       list_for_each_entry_safe(adv, n, &hdev->adv_instances, list)
+               adv->enabled = false;
+
+       hci_dev_clear_flag(hdev, HCI_LE_ADV);
+
+       hci_dev_unlock(hdev);
+}
+
 /* This function perform power off HCI command sequence as follows:
  *
- * Clear Advertising
+ * Disable Advertising Instances. Do not clear adv instances so advertising
+ * can be re-enabled on power on.
  * Stop Discovery
  * Disconnect all connections
  * hci_dev_close_sync

net/bluetooth/hci_sync.c static int hci_power_off_sync(struct hci_dev *hdev) · line 5253

Quoted 7 lines
net/bluetooth/hci_sync.c +1 -3
@@ -5199,9 +5250,7 @@ static int hci_power_off_sync(struct hci_dev *hdev)
                        return err;
        }
 
-       err = hci_clear_adv_sync(hdev, NULL, false);
-       if (err)
-               return err;
+       hci_disable_ext_advertising_temporarily(hdev);

Something like hci_disable_all_adv sounds better here.

Quoted 6 lines
net/bluetooth/hci_sync.c +0 -1
        err = hci_stop_discovery_sync(hdev);
        if (err)
--

2.39.1.456.gfc5497dd1b-goog

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw
In reply to Zhengping Jiang

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

---
Regards,
Linux Bluetooth

#4 lore raw

Hi,

Quoted 48 lines · On Wed, Jan 25, 2023 at 2:06 PM <[email protected]> wrote:

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Quoted 2 lines

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

Looks like there is something not quite right wrt assumption that power off don't remove clear the adv, at least this test says otherwise and this test is actually quite old so I don't know if it has always been like that or we did change this behavior and forgot to change the test, anyway this explains why we have done the clearing with cmd_sync work since that is what this test expects.

Quoted 5 lines

---
Regards,
Linux Bluetooth

Signature · 1 line
Luiz Augusto von Dentz
#5 lore raw

Hi Luiz,

Thanks for the comment. Is there a way to get more information about the failed test? After we cherry picked the hci_sync rework to our branch, some existing tests failed. The failed test will register a few advertisements, then run a power cycle. After the power cycle, the advertisements should be re-enabled automatically. I believe this used to be the behavior before the hci_sync rework? Now calling "hci_clear_adv_sync" during hci_power_off_sync will remove all advertisement instances, so the client code needs to "manually" re-register the advertisement after powering on the adapter. Please let me know if I understood correctly.

Thanks,
Zhengping

Quoted 71 lines · Luiz Augusto von Dentz

Hi,

Quoted 48 lines · On Wed, Jan 25, 2023 at 2:06 PM <[email protected]> wrote:

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Quoted 2 lines

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

Looks like there is something not quite right wrt assumption that power off don't remove clear the adv, at least this test says otherwise and this test is actually quite old so I don't know if it has always been like that or we did change this behavior and forgot to change the test, anyway this explains why we have done the clearing with cmd_sync work since that is what this test expects.

Quoted 5 lines

---
Regards,
Linux Bluetooth

--
Luiz Augusto von Dentz

#6 lore raw

Hi Tedd,

Quoted 13 lines · Zhengping Jiang

Hi Luiz,

Thanks for the comment. Is there a way to get more information about the failed test? After we cherry picked the hci_sync rework to our branch, some existing tests failed. The failed test will register a few advertisements, then run a power cycle. After the power cycle, the advertisements should be re-enabled automatically. I believe this used to be the behavior before the hci_sync rework? Now calling "hci_clear_adv_sync" during hci_power_off_sync will remove all advertisement instances, so the client code needs to "manually" re-register the advertisement after powering on the adapter. Please let me know if I understood correctly.

What test are you talking about? The one in mgmt-tester which the CI runs or your own tests?

@Tedd Ho-Jeong An Perhaps we could add the github PR link to pw that way people can inspect the errors.

Quoted 76 lines

Thanks,
Zhengping

Quoted 71 lines · Luiz Augusto von Dentz

Hi,

Quoted 48 lines · On Wed, Jan 25, 2023 at 2:06 PM <[email protected]> wrote:

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Quoted 2 lines

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

Looks like there is something not quite right wrt assumption that power off don't remove clear the adv, at least this test says otherwise and this test is actually quite old so I don't know if it has always been like that or we did change this behavior and forgot to change the test, anyway this explains why we have done the clearing with cmd_sync work since that is what this test expects.

Quoted 5 lines

---
Regards,
Linux Bluetooth

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
#7 lore raw

Hi Luiz,

Quoted 1 line

What test are you talking about? The one in mgmt-tester which the CI

runs or your own tests?

Sorry for the confusion, I mean our own tests. Are the advertisement instances fully cleared before the hci_sync rework? I looked at the old hci_power_off before commit cf75ad8b41d2aa0 and did not find the code to do that.

Thanks
Zhengping

Quoted 105 lines · Luiz Augusto von Dentz

Hi Tedd,

Quoted 13 lines · Zhengping Jiang

Hi Luiz,

Thanks for the comment. Is there a way to get more information about the failed test? After we cherry picked the hci_sync rework to our branch, some existing tests failed. The failed test will register a few advertisements, then run a power cycle. After the power cycle, the advertisements should be re-enabled automatically. I believe this used to be the behavior before the hci_sync rework? Now calling "hci_clear_adv_sync" during hci_power_off_sync will remove all advertisement instances, so the client code needs to "manually" re-register the advertisement after powering on the adapter. Please let me know if I understood correctly.

What test are you talking about? The one in mgmt-tester which the CI runs or your own tests?

@Tedd Ho-Jeong An Perhaps we could add the github PR link to pw that way people can inspect the errors.

Quoted 76 lines

Thanks,
Zhengping

Quoted 71 lines · Luiz Augusto von Dentz

Hi,

Quoted 48 lines · On Wed, Jan 25, 2023 at 2:06 PM <[email protected]> wrote:

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Quoted 2 lines

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

Looks like there is something not quite right wrt assumption that power off don't remove clear the adv, at least this test says otherwise and this test is actually quite old so I don't know if it has always been like that or we did change this behavior and forgot to change the test, anyway this explains why we have done the clearing with cmd_sync work since that is what this test expects.

Quoted 5 lines

---
Regards,
Linux Bluetooth

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

#8 lore raw

Hi Zhengping,

Quoted 10 lines · Zhengping Jiang

Hi Luiz,

Quoted 1 line

What test are you talking about? The one in mgmt-tester which the CI

runs or your own tests?

Sorry for the confusion, I mean our own tests. Are the advertisement instances fully cleared before the hci_sync rework? I looked at the old hci_power_off before commit cf75ad8b41d2aa0 and did not find the code to do that.

The test expects Advertising Removed (0x0024) to pass:

https://gist.github.com/Vudentz/82938a4b7d501d5fea43a3b71e265e12

Like I said I suspect that test was broken, perhaps we change the behavior but did not change the tests which then caused us to revert to the old behavior in order to pass the test, anyway Add Advertising does allow instances to be programmed while powered off but Add Extended Advertising Data doesn't:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/mgmt-api.txt#n3745

So I think it is better to maintain the current behavior and handle this in the daemon, meaning we shall handle if the Advertising got removed we just re-add it on power on, so at D-Bus level we allow application to register advertising instance regardless of the power state but while at the kernel level the instances are cleared on power off. We can actually introduce a property to tell if the instance is active or not at the kernel level so the daemon is able to notify the application when they are currently programmed in the controller or not.

Quoted 111 lines

Thanks
Zhengping

Quoted 105 lines · Luiz Augusto von Dentz

Hi Tedd,

Quoted 13 lines · Zhengping Jiang

Hi Luiz,

Thanks for the comment. Is there a way to get more information about the failed test? After we cherry picked the hci_sync rework to our branch, some existing tests failed. The failed test will register a few advertisements, then run a power cycle. After the power cycle, the advertisements should be re-enabled automatically. I believe this used to be the behavior before the hci_sync rework? Now calling "hci_clear_adv_sync" during hci_power_off_sync will remove all advertisement instances, so the client code needs to "manually" re-register the advertisement after powering on the adapter. Please let me know if I understood correctly.

What test are you talking about? The one in mgmt-tester which the CI runs or your own tests?

@Tedd Ho-Jeong An Perhaps we could add the github PR link to pw that way people can inspect the errors.

Quoted 76 lines

Thanks,
Zhengping

Quoted 71 lines · Luiz Augusto von Dentz

Hi,

Quoted 48 lines · On Wed, Jan 25, 2023 at 2:06 PM <[email protected]> wrote:

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=715641

---Test result---

Test Summary:

CheckPatch                    PASS      0.65 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      31.31 seconds
CheckAllWarning               PASS      33.97 seconds
CheckSparse                   PASS      38.25 seconds
CheckSmatch                   PASS      107.12 seconds
BuildKernel32                 PASS      29.96 seconds
TestRunnerSetup               PASS      430.17 seconds
TestRunner_l2cap-tester       PASS      16.16 seconds
TestRunner_iso-tester         PASS      16.36 seconds
TestRunner_bnep-tester        PASS      5.43 seconds
TestRunner_mgmt-tester        FAIL      110.68 seconds
TestRunner_rfcomm-tester      PASS      8.62 seconds
TestRunner_sco-tester         PASS      7.99 seconds
TestRunner_ioctl-tester       PASS      9.42 seconds
TestRunner_mesh-tester        PASS      6.79 seconds
TestRunner_smp-tester         PASS      7.81 seconds
TestRunner_userchan-tester    PASS      5.73 seconds
IncrementalBuild              PASS      27.75 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off

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
1: T1 Title exceeds max length (82>80): "[kernel,v1,1/1] Bluetooth: Don't send HCI commands to remove adv if adapter is off"
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 493 (99.8%), Failed: 1, Not Run: 0

Quoted 2 lines

Failed Test Cases
Add Advertising - Success 18 (Power -> off, Remove) Timed out 2.314 seconds

Looks like there is something not quite right wrt assumption that power off don't remove clear the adv, at least this test says otherwise and this test is actually quite old so I don't know if it has always been like that or we did change this behavior and forgot to change the test, anyway this explains why we have done the clearing with cmd_sync work since that is what this test expects.

Quoted 5 lines

---
Regards,
Linux Bluetooth

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz