Add new tracepoints for dma_fence
authorRouven Czerwinski via lttng-dev <lttng-dev@lists.lttng.org>
Thu, 8 Sep 2022 08:23:51 +0000 (10:23 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Sep 2022 15:39:36 +0000 (11:39 -0400)
Allows usage of dma_fence tracepoints from lttng.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/instrumentation/events/dma_fence.h [new file with mode: 0644]
src/probes/Kbuild
src/probes/lttng-probe-dma-fence.c [new file with mode: 0644]

diff --git a/include/instrumentation/events/dma_fence.h b/include/instrumentation/events/dma_fence.h
new file mode 100644 (file)
index 0000000..95d94ed
--- /dev/null
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM dma_fence
+
+#if !defined(LTTNG_TRACE_DMA_FENCE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define LTTNG_TRACE_DMA_FENCE_H
+
+#include <lttng/tracepoint-event.h>
+
+LTTNG_TRACEPOINT_EVENT_CLASS(dma_fence_class,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence),
+
+       TP_FIELDS(
+               ctf_string(driver, fence->ops->get_driver_name(fence))
+               ctf_string(timeline, fence->ops->get_timeline_name(fence))
+               ctf_integer(unsigned int, context, fence->context)
+               ctf_integer(unsigned int, seqno, fence->seqno)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_emit,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_init,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_destroy,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_enable_signal,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_signaled,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_wait_start,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(dma_fence_class,
+       dma_fence_wait_end,
+
+       TP_PROTO(struct dma_fence *fence),
+
+       TP_ARGS(fence)
+)
+
+#endif /*  LTTNG_TRACE_DMA_FENCE_H */
+
+/* This part must be outside protection */
+#include <lttng/define_trace.h>
index aa002534ab5424e59318f8c6b86715f935a807e6..7597389b1e6b31580ac2a0ee37e24923a3b7c5c5 100644 (file)
@@ -97,6 +97,13 @@ endif # CONFIG_X86
 
 obj-$(CONFIG_LTTNG) += lttng-probe-signal.o
 
+ifneq ($(CONFIG_DMA_SHARED_BUFFER),)
+  obj-$(CONFIG_LTTNG) += $(shell \
+    if [ $(VERSION) -ge 5 \
+       -o \( $VERSION -eq 4 -a $(PATCHLEVEL) -ge 9 \) ] ; then \
+      echo "lttng-probe-dma-fence.o" ; fi;)
+endif # CONFIG_DMA_SHARED_BUFFER
+
 ifneq ($(CONFIG_BLOCK),)
   # need blk_cmd_buf_len
   ifneq ($(CONFIG_EVENT_TRACING),)
diff --git a/src/probes/lttng-probe-dma-fence.c b/src/probes/lttng-probe-dma-fence.c
new file mode 100644 (file)
index 0000000..a6c9cd1
--- /dev/null
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * probes/lttng-probe-dma-fence.c
+ *
+ * LTTng dma-fence probes.
+ *
+ * Copyright (C) 2022 Pengutronix, Rouven Czerwinski <entwicklung@pengutronix.de>
+ */
+
+#include <linux/dma-fence.h>
+/*
+ * Create the tracepoint static inlines from the kernel to validate that our
+ * trace event macros match the kernel we run on.
+ */
+#include <trace/events/dma_fence.h>
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH instrumentation/events
+
+#include <instrumentation/events/dma_fence.h>
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Rouven Czerwinski <r.czerwinski@pengutronix.de>");
+MODULE_DESCRIPTION("LTTng dma-fence probes");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+       LTTNG_MODULES_EXTRAVERSION);
This page took 0.031332 seconds and 4 git commands to generate.