/* * cpuidle.h - a generic framework for CPU idle power management * * (C) 2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> * Shaohua Li <shaohua.li@intel.com> * Adam Belay <abelay@novell.com> * * This code is licenced under the GPL.
*/
struct cpuidle_state_usage { unsignedlonglong disable; unsignedlonglong usage;
u64 time_ns; unsignedlonglong above; /* Number of times it's been too deep */ unsignedlonglong below; /* Number of times it's been too shallow */ unsignedlonglong rejected; /* Number of times idle entry was rejected */ #ifdef CONFIG_SUSPEND unsignedlonglong s2idle_usage; unsignedlonglong s2idle_time; /* in US */ #endif
};
s64 exit_latency_ns;
s64 target_residency_ns; unsignedint flags; unsignedint exit_latency; /* in US */ int power_usage; /* in mW */ unsignedint target_residency; /* in US */
int (*enter) (struct cpuidle_device *dev, struct cpuidle_driver *drv, int index);
void (*enter_dead) (struct cpuidle_device *dev, int index);
/* * CPUs execute ->enter_s2idle with the local tick or entire timekeeping * suspended, so it must not re-enable interrupts at any point (even * temporarily) or attempt to change states of clock event devices. * * This callback may point to the same function as ->enter if all of * the above requirements are met by it.
*/ int (*enter_s2idle)(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index);
};
/* Idle State Flags */ #define CPUIDLE_FLAG_NONE (0x00) #define CPUIDLE_FLAG_POLLING BIT(0) /* polling state */ #define CPUIDLE_FLAG_COUPLED BIT(1) /* state applies to multiple cpus */ #define CPUIDLE_FLAG_TIMER_STOP BIT(2) /* timer is stopped on this state */ #define CPUIDLE_FLAG_UNUSABLE BIT(3) /* avoid using this state */ #define CPUIDLE_FLAG_OFF BIT(4) /* disable this state by default */ #define CPUIDLE_FLAG_TLB_FLUSHED BIT(5) /* idle-state flushes TLBs */ #define CPUIDLE_FLAG_RCU_IDLE BIT(6) /* idle-state takes care of RCU */
static __always_inline void ct_cpuidle_enter(void)
{
lockdep_assert_irqs_disabled(); /* * Idle is allowed to (temporary) enable IRQs. It * will return with IRQs disabled. * * Trace IRQs enable here, then switch off RCU, and have * arch_cpu_idle() use raw_local_irq_enable(). Note that * ct_idle_enter() relies on lockdep IRQ state, so switch that * last -- this is very similar to the entry code.
*/
trace_hardirqs_on_prepare();
lockdep_hardirqs_on_prepare();
instrumentation_end();
ct_idle_enter();
lockdep_hardirqs_on(_RET_IP_);
}
/* used by the cpuidle framework to setup the broadcast timer */ unsignedint bctimer:1; /* states array must be ordered in decreasing power consumption */ struct cpuidle_state states[CPUIDLE_STATE_MAX]; int state_count; int safe_state_index;
/* the driver handles the cpus in cpumask */ struct cpumask *cpumask;
/* preferred governor to switch at register time */ constchar *governor;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.