Skip to content

Commit

Permalink
cpuidle: move idle traces to cpuidle_enter_state()
Browse files Browse the repository at this point in the history
idle_exit event is the first event after a core exits
idle state. So this should be traced before local irq
is ebabled. Likewise idle_entry is the last event before
a core enters idle state. This will ease visualising the
cpu idle state from kernel traces.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[rjw: Subject, rebase]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Sandeep Tripathy authored and Rafael J. Wysocki committed Jul 9, 2014
1 parent cd3de83 commit 30fe688
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 2 additions & 0 deletions drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
ktime_t time_start, time_end;
s64 diff;

trace_cpu_idle_rcuidle(index, dev->cpu);
time_start = ktime_get();

entered_state = target_state->enter(dev, drv, index);

time_end = ktime_get();
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);

if (!cpuidle_state_is_coupled(dev, drv, entered_state))
local_irq_enable();
Expand Down
4 changes: 0 additions & 4 deletions kernel/sched/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,13 @@ static void cpuidle_idle_call(void)
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
goto use_default;

trace_cpu_idle_rcuidle(next_state, dev->cpu);

/*
* Enter the idle state previously returned by the governor decision.
* This function will block until an interrupt occurs and will take
* care of re-enabling the local interrupts
*/
entered_state = cpuidle_enter(drv, dev, next_state);

trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);

if (broadcast)
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);

Expand Down

0 comments on commit 30fe688

Please sign in to comment.