All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
@ 2021-08-20  3:28 Manish Mandlik
  2021-08-20  4:11 ` [v5] " bluez.test.bot
  2021-08-30 15:02 ` [PATCH v5] " Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Manish Mandlik @ 2021-08-20  3:28 UTC (permalink / raw)
  To: marcel, luiz.dentz
  Cc: Archie Pusaka, linux-bluetooth, Alain Michaud,
	chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
	Miao-chen Chou, Manish Mandlik, David S. Miller, Jakub Kicinski,
	Johan Hedberg, linux-kernel, netdev

From: Miao-chen Chou <mcchou@chromium.org>

This moves msft_do_close() from hci_dev_do_close() to
hci_unregister_dev() to avoid clearing MSFT extension info. This also
re-reads MSFT info upon every msft_do_open() even if MSFT extension has
been initialized.

The following test steps were performed.
(1) boot the test device and verify the MSFT support debug log in syslog
(2) restart bluetoothd and verify msft_do_close() doesn't get invoked
    and msft_do_open re-reads the MSFT support.

Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Manish Mandlik <mmandlik@google.com>
---

Changes in v5:
- Rebase on ToT and remove extra blank line

Changes in v4:
- Re-read the MSFT data instead of skipping if it's initiated already

Changes in v3:
- Remove the accepted commits from the series

 net/bluetooth/hci_core.c |  3 ++-
 net/bluetooth/msft.c     | 20 +++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fb296478b86e..681c6dabb550 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1798,7 +1798,6 @@ int hci_dev_do_close(struct hci_dev *hdev)
 	hci_sock_dev_event(hdev, HCI_DEV_DOWN);
 
 	aosp_do_close(hdev);
-	msft_do_close(hdev);
 
 	if (hdev->flush)
 		hdev->flush(hdev);
@@ -4026,6 +4025,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
 		cancel_work_sync(&hdev->suspend_prepare);
 	}
 
+	msft_do_close(hdev);
+
 	hci_dev_do_close(hdev);
 
 	if (!test_bit(HCI_INIT, &hdev->flags) &&
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index b4bfae41e8a5..c2568e93598a 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -184,16 +184,30 @@ static void reregister_monitor_on_restart(struct hci_dev *hdev, int handle)
 
 void msft_do_open(struct hci_dev *hdev)
 {
-	struct msft_data *msft;
+	struct msft_data *msft = NULL;
 
 	if (hdev->msft_opcode == HCI_OP_NOP)
 		return;
 
 	bt_dev_dbg(hdev, "Initialize MSFT extension");
 
-	msft = kzalloc(sizeof(*msft), GFP_KERNEL);
-	if (!msft)
+	/* If MSFT data exists, reset its members */
+	if (hdev->msft_data) {
+		msft = hdev->msft_data;
+		hdev->msft_data = NULL;
+
+		msft->features = 0;
+		kfree(msft->evt_prefix);
+		msft->evt_prefix = NULL;
+		msft->evt_prefix_len = 0;
+	} else {
+		msft = kzalloc(sizeof(*msft), GFP_KERNEL);
+	}
+
+	if (!msft) {
+		bt_dev_err(hdev, "Failed to init MSFT extension");
 		return;
+	}
 
 	if (!read_supported_features(hdev, msft)) {
 		kfree(msft);
-- 
2.33.0.rc2.250.ged5fa647cd-goog


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

* RE: [v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-08-20  3:28 [PATCH v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Manish Mandlik
@ 2021-08-20  4:11 ` bluez.test.bot
  2021-08-30 15:02 ` [PATCH v5] " Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-08-20  4:11 UTC (permalink / raw)
  To: linux-bluetooth, mmandlik

[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.75 seconds
GitLint                       PASS      0.13 seconds
BuildKernel                   PASS      682.24 seconds
TestRunner: Setup             PASS      452.62 seconds
TestRunner: l2cap-tester      PASS      3.17 seconds
TestRunner: bnep-tester       PASS      2.19 seconds
TestRunner: mgmt-tester       PASS      34.53 seconds
TestRunner: rfcomm-tester     PASS      2.48 seconds
TestRunner: sco-tester        PASS      2.42 seconds
TestRunner: smp-tester        FAIL      2.52 seconds
TestRunner: userchan-tester   PASS      2.26 seconds

Details
##############################
Test: CheckPatch - PASS - 0.75 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - PASS - 0.13 seconds
Run gitlint with rule in .gitlint


##############################
Test: BuildKernel - PASS - 682.24 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 452.62 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 3.17 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 2.19 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - PASS - 34.53 seconds
Run test-runner with mgmt-tester
Total: 448, Passed: 445 (99.3%), Failed: 0, Not Run: 3

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.48 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.42 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - FAIL - 2.52 seconds
Run test-runner with smp-tester
Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0

Failed Test Cases
SMP Client - SC Request 2                            Failed       0.028 seconds

##############################
Test: TestRunner: userchan-tester - PASS - 2.26 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44385 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3593 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 616863 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11712 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9948 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11741 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5489 bytes --]

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

* Re: [PATCH v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-08-20  3:28 [PATCH v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Manish Mandlik
  2021-08-20  4:11 ` [v5] " bluez.test.bot
@ 2021-08-30 15:02 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2021-08-30 15:02 UTC (permalink / raw)
  To: Manish Mandlik
  Cc: Luiz Augusto von Dentz, Archie Pusaka,
	open list:BLUETOOTH SUBSYSTEM, Alain Michaud, CrosBT Upstreaming,
	Abhishek Pandit-Subedi, Miao-chen Chou, David S. Miller,
	Jakub Kicinski, Johan Hedberg, open list, netdev

Hi Manish,

> This moves msft_do_close() from hci_dev_do_close() to
> hci_unregister_dev() to avoid clearing MSFT extension info. This also
> re-reads MSFT info upon every msft_do_open() even if MSFT extension has
> been initialized.
> 
> The following test steps were performed.
> (1) boot the test device and verify the MSFT support debug log in syslog
> (2) restart bluetoothd and verify msft_do_close() doesn't get invoked
>    and msft_do_open re-reads the MSFT support.

so tell me how this can be correct. The msft_do_close does cleanup of instances. If we close the device via power down I would expect that these instances are cleared. Do they survive a HCI Reset command?

I think it would be better to introduce an additional msft_register / msft_unregister pair if this needs to be more complex.

Regards

Marcel


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

end of thread, other threads:[~2021-08-30 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  3:28 [PATCH v5] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Manish Mandlik
2021-08-20  4:11 ` [v5] " bluez.test.bot
2021-08-30 15:02 ` [PATCH v5] " Marcel Holtmann

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.