Thread (32 messages) 32 messages, 6 authors, 2022-02-16

Re: [PATCH v3 5/8] perf tool: Add support for HiSilicon PCIe Tune and Trace device driver

From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Date: 2022-02-07 13:13:03
Also in: linux-iommu, linux-pci, linux-perf-users, lkml

On Mon, 24 Jan 2022 21:11:15 +0800
Yicong Yang [off-list ref] wrote:
From: Qi Liu <redacted>

'perf record' and 'perf report --dump-raw-trace' supported in this
patch.

Example usage:

Output will contain raw PTT data and its textual representation, such
as:

0 0 0x5810 [0x30]: PERF_RECORD_AUXTRACE size: 0x400000  offset: 0
ref: 0xa5d50c725  idx: 0  tid: -1  cpu: 0
.
. ... HISI PTT data: size 4194304 bytes
.  00000000: 00 00 00 00                                 Prefix
.  00000004: 08 20 00 60                                 Header DW0
.  00000008: ff 02 00 01                                 Header DW1
.  0000000c: 20 08 00 00                                 Header DW2
.  00000010: 10 e7 44 ab                                 Header DW3
.  00000014: 2a a8 1e 01                                 Time
.  00000020: 00 00 00 00                                 Prefix
.  00000024: 01 00 00 60                                 Header DW0
.  00000028: 0f 1e 00 01                                 Header DW1
.  0000002c: 04 00 00 00                                 Header DW2
.  00000030: 40 00 81 02                                 Header DW3
.  00000034: ee 02 00 00                                 Time
....

Signed-off-by: Qi Liu <redacted>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Hi. This is unfortunately out of my areas of expertise, so I just
took a quick glance and noticed one generic c thing that could be
tidied up.
quoted hunk ↗ jump to hunk
diff --git a/tools/perf/util/hisi_ptt.c b/tools/perf/util/hisi_ptt.c
new file mode 100644
index 000000000000..75fa89f3fae3
--- /dev/null
+++ b/tools/perf/util/hisi_ptt.c
...
+
+static void hisi_ptt_free_queue(void *priv)
+{
+	struct hisi_ptt_queue *pttq = priv;
+
+	if (!pttq)
+		return;
+
+	free(pttq);
free() is safe against a null ptr, so you don't need the 
if (!pttq) return;

See free(3) man page.
+}
+
+static void hisi_ptt_free_events(struct perf_session *session)
+{
+	struct hisi_ptt *ptt = container_of(session->auxtrace, struct hisi_ptt,
+					    auxtrace);
+	struct auxtrace_queues *queues = &ptt->queues;
+	unsigned int i;
+
+	for (i = 0; i < queues->nr_queues; i++) {
+		hisi_ptt_free_queue(queues->queue_array[i].priv);
+		queues->queue_array[i].priv = NULL;
+	}
+	auxtrace_queues__free(queues);
+}
+
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help