mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: Ulf Hansson <ulfh@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pmdomain: core: Add tracepoints for domain state changes
Date: Sun, 8 Nov 2026 22:34:53 -0500	[thread overview]
Message-ID: <20261108223453.70b739d3@fedora> (raw)
In-Reply-To: <20261105-add-pmdomain-tracepoints-v2-1-10672995e155@oss.qualcomm.com>

On Thu, 05 Nov 2026 18:18:49 +0200
Abel Vesa <abel.vesa@oss.qualcomm.com> 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


      reply	other threads:[~2026-11-09  3:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 16:18 Abel Vesa
2026-11-09  3:34 ` Steven Rostedt [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=20261108223453.70b739d3@fedora \
    --to=rostedt@goodmis.org \
    --cc=abel.vesa@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=ulfh@kernel.org \
    /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

all inboxes | Powered by JetHome®