Skip to contentSkip to conversation

Bluetooth: btintel: Dump exception event

PATCH In review Kiran K 2 participants 4 messages Apr 1, 2024 – Apr 25, 2024 Bluetooth drivers

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH v2 1/2 Bluetooth: btintel: Dump exception event

Having exception event dump in kernel log helps debugging the use cases where snoop traces are not available.

dmesg:

[27.032666] Bluetooth: hci0: Exception occurred - type: 0xde
[27.032703] Bluetooth: hci0: ff 4f 87 80 03 01 01 de 07 01 de 06 1c ef be ad
[27.032729] Bluetooth: hci0: de ef be ad de ef be ad de ef be ad de ef be ad
[27.032753] Bluetooth: hci0: de ef be ad de ef be ad de 05 14 ef be ad de ef
[27.032778] Bluetooth: hci0: be ad de ef be ad de ef be ad de ef be ad de 43
[27.032803] Bluetooth: hci0: 10 ef be ad de ef be ad de ef be ad de ef be ad
[27.032827] Bluetooth: hci0: de
---
 drivers/bluetooth/btintel.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bluetooth/btintel.c +7 -0
index a19ebe47bd95..c0dbbd1a2032 100644
@@ -3119,6 +3119,7 @@ EXPORT_SYMBOL_GPL(btintel_configure_setup);
 static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct intel_tlv *tlv = (void *)&skb->data[5];
+	char prefix[64];
 
 	/* The first event is always an event type TLV */
 	if (tlv->type != INTEL_TLV_TYPE_ID)
@@ -3129,6 +3130,12 @@ static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb)
 	case INTEL_TLV_FATAL_EXCEPTION:
 	case INTEL_TLV_DEBUG_EXCEPTION:
 	case INTEL_TLV_TEST_EXCEPTION:
+		bt_dev_err(hdev, "Exception occurred - type: 0x%2.2x",
+			   tlv->val[0]);
+		snprintf(prefix, sizeof(prefix), "Bluetooth: %s: ",
+			 bt_dev_name(hdev));
+		print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_NONE, 16, 1,
+			       skb->data, skb->len, false);
 		/* Generate devcoredump from exception */
 		if (!hci_devcd_init(hdev, skb->len)) {
 			hci_devcd_append(hdev, skb);
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 2/2 Bluetooth: btintel: Direct exception event to bluetooth stack

Have exception event part of HCI traces which helps for debug.

snoop traces:

Quoted 1 line

HCI Event: Vendor (0xff) plen 79

Vendor Prefix (0x8780)
Intel Extended Telemetry (0x03)
Unknown extended telemetry event type (0xde) 01 01 de
Unknown extended subevent 0x07
01 01 de 07 01 de 06 1c ef be ad de ef be ad de ef be ad de ef be ad de ef be ad de ef be ad de ef be ad de 05 14 ef be ad de ef be ad de ef be ad de ef be ad de ef be ad de 43 10 ef be ad de ef be ad de ef be ad de ef be ad de

---
 drivers/bluetooth/btintel.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bluetooth/btintel.c +2 -3
index c0dbbd1a2032..dde1dc45df9c 100644
@@ -3138,13 +3138,12 @@ static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb)
 			       skb->data, skb->len, false);
 		/* Generate devcoredump from exception */
 		if (!hci_devcd_init(hdev, skb->len)) {
-			hci_devcd_append(hdev, skb);
+			hci_devcd_append(hdev, skb_clone(skb, GFP_KERNEL));
 			hci_devcd_complete(hdev);
 		} else {
 			bt_dev_err(hdev, "Failed to generate devcoredump");
-			kfree_skb(skb);
 		}
-		return 0;
+	break;
 	default:
 		bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]);
 	}
Signature · 1 line
2.34.1
#2 lore raw
In reply to Kiran K

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

---Test result---

Test Summary:

CheckPatch                    PASS      1.05 seconds
GitLint                       PASS      0.48 seconds
SubjectPrefix                 PASS      0.18 seconds
BuildKernel                   PASS      30.06 seconds
CheckAllWarning               PASS      32.69 seconds
CheckSparse                   PASS      37.65 seconds
CheckSmatch                   FAIL      34.67 seconds
BuildKernel32                 PASS      28.90 seconds
TestRunnerSetup               PASS      522.61 seconds
TestRunner_l2cap-tester       PASS      17.84 seconds
TestRunner_iso-tester         FAIL      31.02 seconds
TestRunner_bnep-tester        PASS      4.68 seconds
TestRunner_mgmt-tester        PASS      112.40 seconds
TestRunner_rfcomm-tester      PASS      7.39 seconds
TestRunner_sco-tester         PASS      15.34 seconds
TestRunner_ioctl-tester       PASS      7.70 seconds
TestRunner_mesh-tester        PASS      5.75 seconds
TestRunner_smp-tester         PASS      6.75 seconds
TestRunner_userchan-tester    PASS      4.86 seconds
IncrementalBuild              PASS      32.48 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 117, Passed: 116 (99.1%), Failed: 1, Not Run: 0

Failed Test Cases
ISO Connect2 Suspend - Success Failed 4.219 seconds

---
Regards,
Linux Bluetooth

author
#3 lore raw
In reply to Kiran K

Hi Luiz,

Friendly reminder.

Quoted 53 lines

-----Original Message-----
From: K, Kiran <[email protected]>
Sent: Monday, April 1, 2024 5:56 PM
To: [email protected]
Cc: Srivatsa, Ravishankar <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; K, Kiran <[email protected]>
Subject: [PATCH v2 1/2] Bluetooth: btintel: Dump exception event

Having exception event dump in kernel log helps debugging the use cases where snoop traces are not available.

dmesg:

[27.032666] Bluetooth: hci0: Exception occurred - type: 0xde [27.032703]

Bluetooth: hci0: ff 4f 87 80 03 01 01 de 07 01 de 06 1c ef be ad [27.032729]
Bluetooth: hci0: de ef be ad de ef be ad de ef be ad de ef be ad [27.032753]
Bluetooth: hci0: de ef be ad de ef be ad de 05 14 ef be ad de ef [27.032778]
Bluetooth: hci0: be ad de ef be ad de ef be ad de ef be ad de 43 [27.032803]
Bluetooth: hci0: 10 ef be ad de ef be ad de ef be ad de ef be ad [27.032827]
Bluetooth: hci0: de

---
 drivers/bluetooth/btintel.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bluetooth/btintel.c index renamed from drivers/bluetooth/btintel.c +0 -0

a19ebe47bd95..c0dbbd1a2032 100644

drivers/bluetooth/btintel.c +7 -0
@@ -3119,6 +3119,7 @@ EXPORT_SYMBOL_GPL(btintel_configure_setup);
 static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb)  {
 	struct intel_tlv *tlv = (void *)&skb->data[5];
+	char prefix[64];
 
 	/* The first event is always an event type TLV */
 	if (tlv->type != INTEL_TLV_TYPE_ID)
@@ -3129,6 +3130,12 @@ static int btintel_diagnostics(struct hci_dev *hdev,
 struct sk_buff *skb)
 	case INTEL_TLV_FATAL_EXCEPTION:
 	case INTEL_TLV_DEBUG_EXCEPTION:
 	case INTEL_TLV_TEST_EXCEPTION:
+		bt_dev_err(hdev, "Exception occurred - type: 0x%2.2x",
+			   tlv->val[0]);
+		snprintf(prefix, sizeof(prefix), "Bluetooth: %s: ",
+			 bt_dev_name(hdev));
+		print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_NONE, 16,
 1,
+			       skb->data, skb->len, false);
 		/* Generate devcoredump from exception */
drivers/bluetooth/btintel.c +0 -1
 		if (!hci_devcd_init(hdev, skb->len)) {
 			hci_devcd_append(hdev, skb);
--
Quoted 1 line

2.34.1

Thanks,
Kiran