From: "qiwu.chen" <qiwuchen55@gmail.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org,
rostedt@goodmis.org, mhiramat@kernel.org
Cc: linux-pm@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
"qiwu.chen" <qiwu.chen@transsion.com>
Subject: [RESEND PATCH] cpuidle: Add find_deepest_state trace event
Date: Wed, 11 Jun 2025 11:23:10 +0800 [thread overview]
Message-ID: <20250611032310.10610-1-qiwu.chen@transsion.com> (raw)
Add a new trace event namely cpuidle_find_deepest_state to trace
the found deepest idle state during CPUidle flow.
The new trace event will help developers debug CPUidle issues by
providing more detailed information about the CPUidle states.
Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
---
drivers/cpuidle/cpuidle.c | 2 ++
include/trace/events/power.h | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 0835da449db8..9065aa396892 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -103,6 +103,8 @@ static int find_deepest_state(struct cpuidle_driver *drv,
latency_req = s->exit_latency_ns;
ret = i;
}
+ trace_cpuidle_find_deepest_state(dev->cpu, s2idle, ret);
+
return ret;
}
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 9253e83b9bb4..82b5ac8c46e6 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -62,6 +62,30 @@ TRACE_EVENT(cpu_idle_miss,
(unsigned long)__entry->state, (__entry->below)?"below":"above")
);
+TRACE_EVENT(cpuidle_find_deepest_state,
+
+ TP_PROTO(unsigned int cpu_id, bool s2idle, unsigned int deepest_state),
+
+ TP_ARGS(cpu_id, s2idle, deepest_state),
+
+ TP_STRUCT__entry(
+ __field(u32, cpu_id)
+ __field(bool, s2idle)
+ __field(u32, deepest_state)
+ ),
+
+ TP_fast_assign(
+ __entry->cpu_id = cpu_id;
+ __entry->s2idle = s2idle;
+ __entry->deepest_state = deepest_state;
+ ),
+
+ TP_printk("cpu_id=%lu is_s2idle=%s deepest_state=%lu",
+ (unsigned long)__entry->cpu_id,
+ (__entry->s2idle)?"yes":"no",
+ (unsigned long)__entry->deepest_state)
+);
+
DECLARE_EVENT_CLASS(psci_domain_idle,
TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle),
--
2.25.1
next reply other threads:[~2025-06-11 3:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 3:23 qiwu.chen [this message]
2025-07-03 13:34 ` [RESEND PATCH] cpuidle: Add find_deepest_state trace event Rafael J. Wysocki
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=20250611032310.10610-1-qiwu.chen@transsion.com \
--to=qiwuchen55@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=qiwu.chen@transsion.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).