Re: [PATCH v2] pmdomain: core: Add tracepoints for domain state changes
From: Steven Rostedt
Date: Sun Nov 08 2026 - 22:35:15 EST
On Thu, 05 Nov 2026 18:18:49 +0200
Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx> wrote:
> diff --git a/include/trace/events/genpd.h b/include/trace/events/genpd.h
> new file mode 100644
> index 000000000000..e2970be0796a
> --- /dev/null
> +++ b/include/trace/events/genpd.h
> @@ -0,0 +1,94 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM genpd
> +
> +#if !defined(_TRACE_GENPD_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_GENPD_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(genpd_init,
> +
> + TP_PROTO(const char *name, bool on, unsigned int performance_state),
> +
> + TP_ARGS(name, on, performance_state),
> +
> + TP_STRUCT__entry(
> + __string(name, name)
> + __field(bool, on)
> + __field(unsigned int, performance_state)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name);
> + __entry->on = on;
> + __entry->performance_state = performance_state;
> + ),
> +
> + TP_printk("%s on=%d performance_state=%u", __get_str(name),
> + __entry->on, __entry->performance_state)
> +);
> +
> +/* state_idx identifies the idle state entered or exited. */
> +DECLARE_EVENT_CLASS(genpd_power,
> +
> + TP_PROTO(const char *name, unsigned int state_idx, int ret),
> +
> + TP_ARGS(name, state_idx, ret),
> +
> + TP_STRUCT__entry(
> + __string(name, name)
> + __field(unsigned int, state_idx)
> + __field(int, ret)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name);
> + __entry->state_idx = state_idx;
> + __entry->ret = ret;
> + ),
> +
> + TP_printk("%s state_idx=%u ret=%d", __get_str(name),
> + __entry->state_idx, __entry->ret)
> +);
> +
> +DEFINE_EVENT(genpd_power, genpd_power_on,
> +
> + TP_PROTO(const char *name, unsigned int state_idx, int ret),
> +
> + TP_ARGS(name, state_idx, ret)
> +);
> +
> +DEFINE_EVENT(genpd_power, genpd_power_off,
> +
> + TP_PROTO(const char *name, unsigned int state_idx, int ret),
> +
> + TP_ARGS(name, state_idx, ret)
> +);
> +
> +TRACE_EVENT(genpd_set_performance_state,
> +
> + TP_PROTO(const char *name, unsigned int state, int ret),
> +
> + TP_ARGS(name, state, ret),
> +
> + TP_STRUCT__entry(
> + __string(name, name)
> + __field(unsigned int, state)
> + __field(int, ret)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name);
> + __entry->state = state;
> + __entry->ret = ret;
> + ),
> +
> + TP_printk("%s state=%u ret=%d", __get_str(name),
> + __entry->state, __entry->ret)
This is pretty much the same as the above trace events except that it
has state instead of state_idx. If you really need this to say "state"
instead of "state_idx", you can use:
DEFINE_EVENT_PRINT(genpd_power, genpd_set_performance_state,
TP_PROTO(const char *name, unsigned int state_idx, int ret),
TP_ARGS(name, state_idx, ret),
TP_printk("%s state=%u ret=%d", __get_str(name),
__entry->state, __entry->ret)
);
Which will make that trace event the same as the above except that it
will print "state" instead of "state_idx", and save some memory.
-- Steve
> +);
> +
> +#endif /* _TRACE_GENPD_H */
> +
> +/* This part must be outside protection. */
> +#include <trace/define_trace.h>
>
> ---
> base-commit: 3d7783543c2646af69ad65825e810060494bea21
> change-id: 20260924-add-pmdomain-tracepoints-15254f2cd40f
>
> Best regards,
> --
>
> Abel