diff mbox series

[v2] cpuidle: add tracepoint for s2idle flow

Message ID 20250523072239.181371-1-qiwu.chen@transsion.com
State New
Headers show
Series [v2] cpuidle: add tracepoint for s2idle flow | expand

Commit Message

qiwu.chen May 23, 2025, 7:22 a.m. UTC
Add the tracepoint cpu_idle in enter_s2idle_proper() for tracing
the s2idle enter and exit events with a determined idle state.

Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>

Changes in v2:
- fix the build warning reported by kernel test robot in v1:
https://lore.kernel.org/all/20250520030922.9505-1-qiwu.chen@transsion.com/
---
 drivers/cpuidle/cpuidle.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafael J. Wysocki May 23, 2025, 3:12 p.m. UTC | #1
On Fri, May 23, 2025 at 9:22 AM qiwu.chen <qiwuchen55@gmail.com> wrote:
>
> Add the tracepoint cpu_idle in enter_s2idle_proper() for tracing
> the s2idle enter and exit events with a determined idle state.
>
> Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
>
> Changes in v2:
> - fix the build warning reported by kernel test robot in v1:
> https://lore.kernel.org/all/20250520030922.9505-1-qiwu.chen@transsion.com/
> ---
>  drivers/cpuidle/cpuidle.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 0835da449db8..9dca6a63e4ad 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -149,6 +149,7 @@ static noinstr void enter_s2idle_proper(struct cpuidle_driver *drv,
>
>         instrumentation_begin();
>
> +       trace_cpu_idle(index, dev->cpu);
>         time_start = ns_to_ktime(local_clock_noinstr());
>
>         tick_freeze();
> @@ -174,6 +175,7 @@ static noinstr void enter_s2idle_proper(struct cpuidle_driver *drv,
>         start_critical_timings();
>
>         time_end = ns_to_ktime(local_clock_noinstr());
> +       trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
>
>         dev->states_usage[index].s2idle_time += ktime_us_delta(time_end, time_start);
>         dev->states_usage[index].s2idle_usage++;
> --

This is a bit too late for 6.16, please resubmit when 6.16-rc1 is released.

Thanks!
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 0835da449db8..9dca6a63e4ad 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -149,6 +149,7 @@  static noinstr void enter_s2idle_proper(struct cpuidle_driver *drv,
 
 	instrumentation_begin();
 
+	trace_cpu_idle(index, dev->cpu);
 	time_start = ns_to_ktime(local_clock_noinstr());
 
 	tick_freeze();
@@ -174,6 +175,7 @@  static noinstr void enter_s2idle_proper(struct cpuidle_driver *drv,
 	start_critical_timings();
 
 	time_end = ns_to_ktime(local_clock_noinstr());
+	trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
 
 	dev->states_usage[index].s2idle_time += ktime_us_delta(time_end, time_start);
 	dev->states_usage[index].s2idle_usage++;