On 27/02/2019 20:58, Ulf Hansson wrote: > To be able to predict the sleep duration for a CPU that is entering idle, > knowing when the next timer/tick is going to expire, is extremely useful. > Both the teo and the menu cpuidle governors already makes use of this > information, while selecting an idle state. > > Moving forward, the similar prediction needs to be done, but for a group of > idle CPUs rather than for a single idle CPU. Following changes implements a > new genpd governor, which needs this. > > Support this, by sharing a new function called > tick_nohz_get_next_hrtimer(), which returns the next hrtimer or the next > tick, whatever that expires first. > > Additionally, when cpuidle is about to invoke the ->enter() callback, then > call tick_nohz_get_next_hrtimer() and store its return value in the per CPU > struct cpuidle_device, as to make it available outside cpuidle. > > Do note, at the point when cpuidle calls tick_nohz_get_next_hrtimer(), the > governor's ->select() callback has already made a decision whether to stop > the tick or not. In this way, tick_nohz_get_next_hrtimer() actually returns > the next timer expiration, whatever origin. > > Cc: Lina Iyer <ilina@xxxxxxxxxxxxxx> > Co-developed-by: Lina Iyer <lina.iyer@xxxxxxxxxx> > Co-developed-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> > Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> > --- Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog