On Wed, Jun 11, 2025 at 5:23 AM qiwu.chen <[email protected]> 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 <[email protected]>
> ---
>  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
>

Reply via email to