* [RESEND PATCH] cpuidle: Add find_deepest_state trace event
@ 2025-06-11 3:23 qiwu.chen
2025-07-03 13:34 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: qiwu.chen @ 2025-06-11 3:23 UTC (permalink / raw)
To: rafael, daniel.lezcano, rostedt, mhiramat
Cc: linux-pm, linux-trace-kernel, qiwu.chen
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] cpuidle: Add find_deepest_state trace event
2025-06-11 3:23 [RESEND PATCH] cpuidle: Add find_deepest_state trace event qiwu.chen
@ 2025-07-03 13:34 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2025-07-03 13:34 UTC (permalink / raw)
To: qiwu.chen
Cc: rafael, daniel.lezcano, rostedt, mhiramat, linux-pm,
linux-trace-kernel, qiwu.chen
On Wed, Jun 11, 2025 at 5:23 AM qiwu.chen <qiwuchen55@gmail.com> wrote:
>
> 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.
I wonder what exactly this is needed for.
The function being traced is used mostly during suspend-to-idle, so is
this what you have in mind or something else?
In any case, the changelog needs to be more specific about the reason
why the new trace event is needed.
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-03 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 3:23 [RESEND PATCH] cpuidle: Add find_deepest_state trace event qiwu.chen
2025-07-03 13:34 ` Rafael J. Wysocki
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).