Skip to content

Commit 7b76448

Browse files
k1832storulf
authored andcommitted
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. 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]> Acked-by: Sudeep Holla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent c2851be commit 7b76448

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

drivers/cpuidle/cpuidle-psci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/syscore_ops.h>
2626

2727
#include <asm/cpuidle.h>
28+
#include <trace/events/power.h>
2829

2930
#include "cpuidle-psci.h"
3031
#include "dt_idle_states.h"
@@ -74,7 +75,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
7475
if (!state)
7576
state = states[idx];
7677

78+
trace_psci_domain_idle_enter(dev->cpu, state, s2idle);
7779
ret = psci_cpu_suspend_enter(state) ? -1 : idx;
80+
trace_psci_domain_idle_exit(dev->cpu, state, s2idle);
7881

7982
if (s2idle)
8083
dev_pm_genpd_resume(pd_dev);

include/trace/events/power.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,43 @@ TRACE_EVENT(cpu_idle_miss,
6262
(unsigned long)__entry->state, (__entry->below)?"below":"above")
6363
);
6464

65+
DECLARE_EVENT_CLASS(psci_domain_idle,
66+
67+
TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle),
68+
69+
TP_ARGS(cpu_id, state, s2idle),
70+
71+
TP_STRUCT__entry(
72+
__field(u32, cpu_id)
73+
__field(u32, state)
74+
__field(bool, s2idle)
75+
),
76+
77+
TP_fast_assign(
78+
__entry->cpu_id = cpu_id;
79+
__entry->state = state;
80+
__entry->s2idle = s2idle;
81+
),
82+
83+
TP_printk("cpu_id=%lu state=0x%lx is_s2idle=%s",
84+
(unsigned long)__entry->cpu_id, (unsigned long)__entry->state,
85+
(__entry->s2idle)?"yes":"no")
86+
);
87+
88+
DEFINE_EVENT(psci_domain_idle, psci_domain_idle_enter,
89+
90+
TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle),
91+
92+
TP_ARGS(cpu_id, state, s2idle)
93+
);
94+
95+
DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,
96+
97+
TP_PROTO(unsigned int cpu_id, unsigned int state, bool s2idle),
98+
99+
TP_ARGS(cpu_id, state, s2idle)
100+
);
101+
65102
TRACE_EVENT(powernv_throttle,
66103

67104
TP_PROTO(int chip_id, const char *reason, int pmax),

0 commit comments

Comments
 (0)