cpuidle: move idle traces to cpuidle_enter_state()
authorSandeep Tripathy <sandeep.tripathy@linaro.org>
Wed, 2 Jul 2014 09:30:58 +0000 (15:00 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Jul 2014 13:45:23 +0000 (15:45 +0200)
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>
drivers/cpuidle/cpuidle.c
kernel/sched/idle.c

index cb7019977c50febbcd21b9ad49f4a9bfe1ca6271..ee9df5e3f5eba2a5bb705e8be1898c2a370ccd21 100644 (file)
@@ -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();
index cf009fb0bc25b1427683d614a3a40ad98ad0c958..658a58dc30f47de758687ec69159d03edfe481f9 100644 (file)
@@ -147,8 +147,6 @@ use_default:
            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
@@ -156,8 +154,6 @@ use_default:
         */
        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);