cpuidle: psci: Add trace for PSCI domain idle
PATCH RESEND v5 1/1 cpuidle: psci: Add trace for PSCI domain idle
The trace event cpu_idle provides insufficient information for debugging PSCI requests due to lacking access to determined PSCI domain idle states. The cpu_idle usually only shows -1, 0, or 1 regardless how many idle states the power domain has.
Add new trace events namely psci_domain_idle_enter and psci_domain_idle_exit to trace enter and exit events with a determined idle state.
These new trace events will help developers debug CPUidle issues on ARM systems using PSCI by providing more detailed information about the requested idle states.
---v1->v2: Split the ftrace event into two (psci_domain_idle_(enter|exit))
and rephrase the commit message accordingly. Rebased onto the latest.v2->v3: Add "Reviewed-by: Steven Rostedt"v3->v4: Add the Tested-by labelv4->v5: Add "Reviewed-by: Dhruva Gole"
Hopefully this patch gets attention from maintainers of drivers/cpuidle/cpuidle-psci.c too.
drivers/cpuidle/cpuidle-psci.c | 3 +++ include/trace/events/power.h | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
drivers/cpuidle/cpuidle-psci.c +3 -0
@@ -25,6 +25,7 @@#include <linux/syscore_ops.h> #include <asm/cpuidle.h> +#include <trace/events/power.h> #include "cpuidle-psci.h" #include "dt_idle_states.h"
@@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,if (!state) state = states[idx]; +trace_psci_domain_idle_enter (dev->cpu, state, s2idle); ret =psci_cpu_suspend_enter (state) ?-1 : idx; +trace_psci_domain_idle_exit (dev->cpu, state, s2idle);if (s2idle)dev_pm_genpd_resume (pd_dev);
include/trace/events/power.h +37 -0
@@ -62,6 +62,43 @@ TRACE_EVENT(cpu_idle_miss, (unsigned long)__entry->state, (__entry->below)?"below":"above") ); +DECLARE_EVENT_CLASS (psci_domain_idle, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle), + +TP_STRUCT__entry ( + __field(u32, cpu_id) + __field(u32, state) +__field (bool, s2idle) + ), + +TP_fast_assign ( + __entry->cpu_id = cpu_id; + __entry->state = state; + __entry->s2idle = s2idle; + ), + +TP_printk ("cpu_id=%lu state=0x%lx is_s2idle=%s" , + (unsigned long )__entry->cpu_id, (unsigned long )__entry->state, + (__entry->s2idle)?"yes" :"no" ) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_enter, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_exit, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + TRACE_EVENT(powernv_throttle, TP_PROTO(int chip_id, const char *reason, int pmax),
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04 --
2.48.1.362.g079036d154-goog
Rafael J. Wysocki
maintainer+Ulf
Quoted 25 lines · Keita Morisaki
The trace event
cpu_idleprovides insufficient information for debugging PSCI requests due to lacking access to determined PSCI domain idle states. Thecpu_idleusually only shows -1, 0, or 1 regardless how many idle states the power domain has.Add new trace events namely
psci_domain_idle_enterandpsci_domain_idle_exitto trace enter and exit events with a determined idle state.These new trace events will help developers debug CPUidle issues on ARM systems using PSCI by providing more detailed information about the requested idle states.
Signed-off-by Keita Morisaki <[email protected]>Reviewed-by Steven Rostedt (Google) <[email protected]>Reviewed-by Dhruva Gole <[email protected]>Tested-by Kevin Hilman <[email protected]>---
v1->v2: Split the ftrace event into two (psci_domain_idle_(enter|exit))
and rephrase the commit message accordingly. Rebased onto the latest.v2->v3: Add "Reviewed-by: Steven Rostedt"v3->v4: Add the Tested-by labelv4->v5: Add "Reviewed-by: Dhruva Gole"
Quoted 2 lines
Hopefully this patch gets attention from maintainers of
drivers/cpuidle/cpuidle-psci.ctoo.
Lorenzo, Sudeep, Ulf, any comments?
Quoted 78 lines
drivers/cpuidle/cpuidle-psci.c | 3 +++ include/trace/events/power.h | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)drivers/cpuidle/cpuidle-psci.c +3
-0@@ -25,6 +25,7 @@#include <linux/syscore_ops.h> #include <asm/cpuidle.h> +#include <trace/events/power.h> #include "cpuidle-psci.h" #include "dt_idle_states.h" @@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,if (!state) state = states[idx]; +trace_psci_domain_idle_enter (dev->cpu, state, s2idle); ret =psci_cpu_suspend_enter (state) ?-1 : idx; +trace_psci_domain_idle_exit (dev->cpu, state, s2idle);if (s2idle)dev_pm_genpd_resume (pd_dev);include/trace/events/power.h +37
-0@@ -62,6 +62,43 @@ TRACE_EVENT(cpu_idle_miss, (unsigned long)__entry->state, (__entry->below)?"below":"above") ); +DECLARE_EVENT_CLASS (psci_domain_idle, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle), + +TP_STRUCT__entry ( + __field(u32, cpu_id) + __field(u32, state) +__field (bool, s2idle) + ), + +TP_fast_assign ( + __entry->cpu_id = cpu_id; + __entry->state = state; + __entry->s2idle = s2idle; + ), + +TP_printk ("cpu_id=%lu state=0x%lx is_s2idle=%s" , + (unsigned long )__entry->cpu_id, (unsigned long )__entry->state, + (__entry->s2idle)?"yes" :"no" ) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_enter, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_exit, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + TRACE_EVENT(powernv_throttle, TP_PROTO(int chip_id, const char *reason, int pmax),base-commit:
ffd294d346d185b70e28b1a28abe367bbfe53c04--
2.48.1.362.g079036d154-goog
Sudeep Holla
Acked-byQuoted 28 lines · Rafael J. Wysocki
+Ulf
Quoted 25 lines · Keita Morisaki
The trace event
cpu_idleprovides insufficient information for debugging PSCI requests due to lacking access to determined PSCI domain idle states. Thecpu_idleusually only shows -1, 0, or 1 regardless how many idle states the power domain has.Add new trace events namely
psci_domain_idle_enterandpsci_domain_idle_exitto trace enter and exit events with a determined idle state.These new trace events will help developers debug CPUidle issues on ARM systems using PSCI by providing more detailed information about the requested idle states.
Signed-off-by Keita Morisaki <[email protected]>Reviewed-by Steven Rostedt (Google) <[email protected]>Reviewed-by Dhruva Gole <[email protected]>Tested-by Kevin Hilman <[email protected]>---
v1->v2: Split the ftrace event into two (psci_domain_idle_(enter|exit))
and rephrase the commit message accordingly. Rebased onto the latest.v2->v3: Add "Reviewed-by: Steven Rostedt"v3->v4: Add the Tested-by labelv4->v5: Add "Reviewed-by: Dhruva Gole"
Quoted 5 lines
Quoted 2 lines
Hopefully this patch gets attention from maintainers of
drivers/cpuidle/cpuidle-psci.ctoo.Lorenzo, Sudeep, Ulf, any comments?
Looks good to me. I left it to Ulf, FWIW:
Signature · 2 lines
Regards, Sudeep
Quoted 10 lines · Keita Morisaki
The trace event
cpu_idleprovides insufficient information for debugging PSCI requests due to lacking access to determined PSCI domain idle states. Thecpu_idleusually only shows -1, 0, or 1 regardless how many idle states the power domain has.Add new trace events namely
psci_domain_idle_enterandpsci_domain_idle_exitto trace enter and exit events with a determined idle state.
Quoted 8 lines
These new trace events will help developers debug CPUidle issues on ARM systems using PSCI by providing more detailed information about the requested idle states.
Signed-off-by Keita Morisaki <[email protected]>Reviewed-by Steven Rostedt (Google) <[email protected]>Reviewed-by Dhruva Gole <[email protected]>Tested-by Kevin Hilman <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 89 lines
---
v1->v2: Split the ftrace event into two (psci_domain_idle_(enter|exit))
and rephrase the commit message accordingly. Rebased onto the latest.v2->v3: Add "Reviewed-by: Steven Rostedt"v3->v4: Add the Tested-by labelv4->v5: Add "Reviewed-by: Dhruva Gole"Hopefully this patch gets attention from maintainers of
drivers/cpuidle/cpuidle-psci.ctoo.drivers/cpuidle/cpuidle-psci.c | 3 +++ include/trace/events/power.h | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)drivers/cpuidle/cpuidle-psci.c +3
-0@@ -25,6 +25,7 @@#include <linux/syscore_ops.h> #include <asm/cpuidle.h> +#include <trace/events/power.h> #include "cpuidle-psci.h" #include "dt_idle_states.h" @@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,if (!state) state = states[idx]; +trace_psci_domain_idle_enter (dev->cpu, state, s2idle); ret =psci_cpu_suspend_enter (state) ?-1 : idx; +trace_psci_domain_idle_exit (dev->cpu, state, s2idle);if (s2idle)dev_pm_genpd_resume (pd_dev);include/trace/events/power.h +37
-0@@ -62,6 +62,43 @@ TRACE_EVENT(cpu_idle_miss, (unsigned long)__entry->state, (__entry->below)?"below":"above") ); +DECLARE_EVENT_CLASS (psci_domain_idle, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle), + +TP_STRUCT__entry ( + __field(u32, cpu_id) + __field(u32, state) +__field (bool, s2idle) + ), + +TP_fast_assign ( + __entry->cpu_id = cpu_id; + __entry->state = state; + __entry->s2idle = s2idle; + ), + +TP_printk ("cpu_id=%lu state=0x%lx is_s2idle=%s" , + (unsigned long )__entry->cpu_id, (unsigned long )__entry->state, + (__entry->s2idle)?"yes" :"no" ) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_enter, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + +DEFINE_EVENT (psci_domain_idle, psci_domain_idle_exit, + + TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle), + +TP_ARGS (cpu_id, state, s2idle) +); + TRACE_EVENT(powernv_throttle, TP_PROTO(int chip_id, const char *reason, int pmax),base-commit:
ffd294d346d185b70e28b1a28abe367bbfe53c04--
2.48.1.362.g079036d154-goog
Quoted 8 lines
Looks good to me. I left it to Ulf, FWIW:
Acked-by Sudeep Holla <[email protected]>Applied for next, thanks!
Kind regards
Uffe
Thank you for all the review! Excited to see it in the next.
Best regards,
Keita