From: Mathieu Desnoyers via lttng-dev <lttng-dev@lists.lttng.org>
To: Rouven Czerwinski <r.czerwinski@pengutronix.de>,
lttng-dev@lists.lttng.org
Subject: Re: [lttng-dev] [PATCH lttng-modules] Add new tracepoints for drm_scheduler
Date: Fri, 23 Sep 2022 11:53:34 -0400 [thread overview]
Message-ID: <9c056277-64f2-43a9-1816-f3556c2a76e6@efficios.com> (raw)
In-Reply-To: <20220908082523.906444-1-r.czerwinski@pengutronix.de>
On 2022-09-08 04:25, Rouven Czerwinski via lttng-dev wrote:
> Allows usage of the drm_gpu_scheduler tracepoints within lttng.
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> .../events/drm_gpu_scheduler.h | 63 +++++++++++++++++++
[...]
> diff --git a/src/probes/Kbuild b/src/probes/Kbuild
> index 7597389b..2846b0c7 100644
> --- a/src/probes/Kbuild
> +++ b/src/probes/Kbuild
> @@ -104,6 +104,13 @@ ifneq ($(CONFIG_DMA_SHARED_BUFFER),)
> echo "lttng-probe-dma-fence.o" ; fi;)
> endif # CONFIG_DMA_SHARED_BUFFER
>
> +ifneq ($(CONFIG_DRM_SCHED),)
> + obj-$(CONFIG_LTTNG) += $(shell \
> + if [ $(VERSION) -ge 5 \
> + -o \( $VERSION -eq 4 -a $(PATCHLEVEL) -ge 16 \) ] ; then \
> + echo "lttng-probe-drm-sched.o" ; fi;)
> +endif # CONFIG_DRM_SCHED
> +
> ifneq ($(CONFIG_BLOCK),)
> # need blk_cmd_buf_len
> ifneq ($(CONFIG_EVENT_TRACING),)
> diff --git a/src/probes/lttng-probe-drm-sched.c b/src/probes/lttng-probe-drm-sched.c
> new file mode 100644
> index 00000000..fe8f9cb2
> --- /dev/null
> +++ b/src/probes/lttng-probe-drm-sched.c
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
> + *
> + * probes/lttng-probe-drm-sched.c
> + *
> + * LTTng drm-sched probes.
> + *
> + * Copyright (C) 2022 Pengutronix, Rouven Czerwinski <entwicklung@pengutronix.de>
> + */
> +#include <drm/gpu_scheduler.h>
> +
This patch is missing an important piece here, see similar situation for regmap:
/*
* Create the tracepoint static inlines from the kernel to validate that our
* trace event macros match the kernel we run on.
*/
#include <../../drivers/base/regmap/trace.h>
and its associated checks in Kbuild:
ifneq ($(CONFIG_REGMAP),)
regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
ifneq ($(wildcard $(regmap_dep_4_1)),)
obj-$(CONFIG_LTTNG) += lttng-probe-regmap.o
else
$(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.)
endif # $(wildcard $(regmap_dep_4_1)),
endif # CONFIG_REGMAP
This is required to validate that the tracepoint signature we build
against indeed matches the types expected by the tracepoint probe
callbacks.
Unfortunately, the drm-sched instrumentation is located in
drivers/gpu/drm/scheduler/gpu_scheduler_trace.h which is not
available with installed kernel headers. So we really need
access to the kernel sources to validate this signature.
If we don't validate this at compile-time, this can generate
kernel modules that will crash the kernel at runtime if the
tracepoint signature changes in future kernels. This is something
that is not acceptable.
Thanks,
Mathieu
> +/*
> + * Create LTTng tracepoint probes.
> + */
> +#define LTTNG_PACKAGE_BUILD
> +#define CREATE_TRACE_POINTS
> +#define TRACE_INCLUDE_PATH instrumentation/events
> +
> +#include <instrumentation/events/drm_gpu_scheduler.h>
> +
> +MODULE_LICENSE("GPL and additional rights");
> +MODULE_AUTHOR("Rouven Czerwinski <r.czerwinski@pengutronix.de>");
> +MODULE_DESCRIPTION("LTTng drm-gpu-scheduler probes");
> +MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
> + __stringify(LTTNG_MODULES_MINOR_VERSION) "."
> + __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
> + LTTNG_MODULES_EXTRAVERSION);
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
prev parent reply other threads:[~2022-09-23 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 8:25 Rouven Czerwinski via lttng-dev
2022-09-23 15:53 ` Mathieu Desnoyers via lttng-dev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c056277-64f2-43a9-1816-f3556c2a76e6@efficios.com \
--to=lttng-dev@lists.lttng.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=r.czerwinski@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox