Skip to content

Commit b257e02

Browse files
committed
HCI: coredump: Log devcd dumps into the monitor
This logs the devcd dumps with hci_recv_diag so they appear in the monitor traces with proper timestamps which can then be used to relate the HCI traffic that caused the dump: = Vendor Diagnostic (len 174) 42 6c 75 65 74 6f 6f 74 68 20 64 65 76 63 6f 72 Bluetooth devcor 65 64 75 6d 70 0a 53 74 61 74 65 3a 20 32 0a 00 edump.State: 2.. 43 6f 6e 74 72 6f 6c 6c 65 72 20 4e 61 6d 65 3a Controller Name: 20 76 68 63 69 5f 63 74 72 6c 0a 46 69 72 6d 77 vhci_ctrl.Firmw 61 72 65 20 56 65 72 73 69 6f 6e 3a 20 76 68 63 are Version: vhc 69 5f 66 77 0a 44 72 69 76 65 72 3a 20 76 68 63 i_fw.Driver: vhc 69 5f 64 72 76 0a 56 65 6e 64 6f 72 3a 20 76 68 i_drv.Vendor: vh 63 69 0a 2d 2d 2d 20 53 74 61 72 74 20 64 75 6d ci.--- Start dum 70 20 2d 2d 2d 0a 74 65 73 74 20 64 61 74 61 00 p ---.test data. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .............. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent e8c00f5 commit b257e02

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

net/bluetooth/coredump.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,26 @@ static void hci_devcd_handle_pkt_pattern(struct hci_dev *hdev,
240240
bt_dev_dbg(hdev, "Failed to set pattern");
241241
}
242242

243+
static void hci_devcd_dump(struct hci_dev *hdev)
244+
{
245+
struct sk_buff *skb;
246+
u32 size;
247+
248+
bt_dev_dbg(hdev, "state %d", hdev->dump.state);
249+
250+
size = hdev->dump.tail - hdev->dump.head;
251+
252+
/* Emit a devcoredump with the available data */
253+
dev_coredumpv(&hdev->dev, hdev->dump.head, size, GFP_KERNEL);
254+
255+
/* Send a copy to monitor as a diagnostic packet */
256+
skb = bt_skb_alloc(size, GFP_ATOMIC);
257+
if (skb) {
258+
skb_put_data(skb, hdev->dump.head, size);
259+
hci_recv_diag(hdev, skb);
260+
}
261+
}
262+
243263
static void hci_devcd_handle_pkt_complete(struct hci_dev *hdev,
244264
struct sk_buff *skb)
245265
{
@@ -256,7 +276,7 @@ static void hci_devcd_handle_pkt_complete(struct hci_dev *hdev,
256276
bt_dev_dbg(hdev, "complete with size %u (expect %zu)", dump_size,
257277
hdev->dump.alloc_size);
258278

259-
dev_coredumpv(&hdev->dev, hdev->dump.head, dump_size, GFP_KERNEL);
279+
hci_devcd_dump(hdev);
260280
}
261281

262282
static void hci_devcd_handle_pkt_abort(struct hci_dev *hdev,
@@ -275,8 +295,7 @@ static void hci_devcd_handle_pkt_abort(struct hci_dev *hdev,
275295
bt_dev_dbg(hdev, "aborted with size %u (expect %zu)", dump_size,
276296
hdev->dump.alloc_size);
277297

278-
/* Emit a devcoredump with the available data */
279-
dev_coredumpv(&hdev->dev, hdev->dump.head, dump_size, GFP_KERNEL);
298+
hci_devcd_dump(hdev);
280299
}
281300

282301
/* Bluetooth devcoredump state machine.
@@ -391,8 +410,7 @@ void hci_devcd_timeout(struct work_struct *work)
391410
bt_dev_dbg(hdev, "timeout with size %u (expect %zu)", dump_size,
392411
hdev->dump.alloc_size);
393412

394-
/* Emit a devcoredump with the available data */
395-
dev_coredumpv(&hdev->dev, hdev->dump.head, dump_size, GFP_KERNEL);
413+
hci_devcd_dump(hdev);
396414

397415
hci_devcd_reset(hdev);
398416

0 commit comments

Comments
 (0)