[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240221121420.2e32fd00@gandalf.local.home>
Date: Wed, 21 Feb 2024 12:14:20 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vilas Bhat <vilasbhat@...gle.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@....cz>,
Len Brown <len.brown@...el.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Saravana Kannan
<saravanak@...gle.com>, kernel-team@...roid.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v1] PM: runtime: add tracepoint for runtime_status
changes
On Wed, 21 Feb 2024 16:41:10 +0000
Vilas Bhat <vilasbhat@...gle.com> wrote:
> diff --git a/include/trace/events/rpm.h b/include/trace/events/rpm.h
> index 3c716214dab1..f1dc4e95dbce 100644
> --- a/include/trace/events/rpm.h
> +++ b/include/trace/events/rpm.h
> @@ -101,6 +101,42 @@ TRACE_EVENT(rpm_return_int,
> __entry->ret)
> );
>
> +#define RPM_STATUS_STRINGS \
> + { RPM_INVALID, "RPM_INVALID" }, \
> + { RPM_ACTIVE, "RPM_ACTIVE" }, \
> + { RPM_RESUMING, "RPM_RESUMING" }, \
> + { RPM_SUSPENDED, "RPM_SUSPENDED" }, \
> + { RPM_SUSPENDING, "RPM_SUSPENDING" }
> +
> +/*
> + * ftrace's __print_symbolic requires that all enum values be wrapped in the
> + * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
> + * ring buffer.
> + */
> +TRACE_DEFINE_ENUM(RPM_INVALID);
> +TRACE_DEFINE_ENUM(RPM_ACTIVE);
> +TRACE_DEFINE_ENUM(RPM_RESUMING);
> +TRACE_DEFINE_ENUM(RPM_SUSPENDED);
> +TRACE_DEFINE_ENUM(RPM_SUSPENDING);
You could do what everyone else does:
#define RPM_STATUS_STRINGS \
EM( RPM_INVALID, "RPM_INVALID" ) \
EM( RPM_ACTIVE, "RPM_ACTIVE" ) \
EM( RPM_RESUMING, "RPM_RESUMING" ) \
EM( RPM_SUSPENDED, "RPM_SUSPENDED" ) \
EMe( RPM_SUSPENDING, "RPM_SUSPENDING" )
#undef EM
#undef EMe
#define EM(a, b) TRACE_DEFINE_ENUM(a);
#define EMe(a, b) TRACE_DEFINE_ENUM(a);
RPM_STATUS_STRINGS
#undef EM
#undef EMe
#define EM(a, b) { a, b },
#define EMe(a, b) { a, b }
> +
> +TRACE_EVENT(rpm_status,
> + TP_PROTO(struct device *dev, enum rpm_status status),
> + TP_ARGS(dev, status),
> +
> + TP_STRUCT__entry(
> + __string(name, dev_name(dev))
> + __field(int, status)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name, dev_name(dev));
> + __entry->status = status;
> + ),
> +
> + TP_printk("%s status=%s", __get_str(name),
> + __print_symbolic(__entry->status, RPM_STATUS_STRINGS))
This will be what you want with that last redefine of EM*()
-- Steve
> +);
> +
> #endif /* _TRACE_RUNTIME_POWER_H */
>
> /* This part must be outside protection */
Powered by blists - more mailing lists