Re: [PATCH v5 2/2] remoteproc: qcom: Add remoteproc tracing
From: Steven Rostedt
Date: Tue Jun 13 2023 - 11:28:56 EST
On Mon, 12 Jun 2023 15:03:26 -0700
Gokul krishna Krishnakumar <quic_gokukris@xxxxxxxxxxx> wrote:
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index d4dbb8d1d80c..f7cb31b94a60 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -14,6 +14,7 @@
>
> #include <linux/irqreturn.h>
> #include <linux/firmware.h>
> +#include <trace/events/remoteproc_tracepoints.h>
>
> struct rproc;
>
> @@ -171,8 +172,13 @@ u64 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
> static inline
> int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
> {
> - if (rproc->ops->load)
> - return rproc->ops->load(rproc, fw);
> + if (rproc->ops->load) {
> + int ret;
> +
> + ret = rproc->ops->load(rproc, fw);
> + trace_rproc_load_segment_event(rproc, ret);
> + return ret;
> + }
>
> return -EINVAL;
> }
So, tracepoints in header files tend to cause problems due to the way they
are created. See the comment in include/linux/tracepoint-defs.h.
What you need to do is:
#include <linux/tracepoint-defs.h>
DECLARE_TRACEPOINT(rproc_load_segment_event);
extern void call_trace_rproc_load_segment_event(struct rproc *rproc, int ret);
static inline void test_trace_rproc_load_segment_event(struct rproc *rproc, int ret)
{
if (trace_rproc_load_segment_event_enabled())
call_trace_rproc_load_segment_event(rproc, ret);
}
After adding the above in the header. In the C file, add:
void call_trace_rproc_load_segment_event(struct rproc *rproc, int ret)
{
trace_rproc_load_segment_event(rproc, ret);
}
-- Steve