Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-12 Thread Nicolas Pitre
On Wed, 12 Feb 2014, Lorenzo Pieralisi wrote: > On Wed, Feb 12, 2014 at 04:14:38PM +, Arjan van de Ven wrote: > > > > >> sched_cpu_cache_wiped(int llc) > > >> > > >> that would be very nice for this; the menuidle side knows this > > >> for some cases and thus can just call it. This would be a

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-12 Thread Lorenzo Pieralisi
On Wed, Feb 12, 2014 at 04:14:38PM +, Arjan van de Ven wrote: > > >> sched_cpu_cache_wiped(int llc) > >> > >> that would be very nice for this; the menuidle side knows this > >> for some cases and thus can just call it. This would be a very > >> small and minimal change > > > > What do you mea

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-12 Thread Arjan van de Ven
sched_cpu_cache_wiped(int llc) that would be very nice for this; the menuidle side knows this for some cases and thus can just call it. This would be a very small and minimal change What do you mean by "menuidle side knows this for some cases" ? You mean you know that some C-state entries imp

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-12 Thread Lorenzo Pieralisi
On Mon, Feb 03, 2014 at 04:17:47PM +, Arjan van de Ven wrote: [...] > >> 1) A latency driven one > >> 2) A performance impact on > >> > >> first one is pretty much the exit latency related time, sort of a > >> "expected time to first instruction" (currently menuidle has the > >> 99.999% worst

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-11 Thread Peter Zijlstra
On Tue, Feb 11, 2014 at 09:12:02AM -0800, Arjan van de Ven wrote: > On 2/11/2014 8:41 AM, Peter Zijlstra wrote: > >On Mon, Feb 03, 2014 at 08:17:47AM -0800, Arjan van de Ven wrote: > >>On 2/3/2014 6:56 AM, Peter Zijlstra wrote: > >>if there's a simple api like > >> > >>sched_cpu_cache_wiped(int llc

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-11 Thread Arjan van de Ven
On 2/11/2014 8:41 AM, Peter Zijlstra wrote: On Mon, Feb 03, 2014 at 08:17:47AM -0800, Arjan van de Ven wrote: On 2/3/2014 6:56 AM, Peter Zijlstra wrote: if there's a simple api like sched_cpu_cache_wiped(int llc) that would be very nice for this; the menuidle side knows this for some cases and

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-11 Thread Peter Zijlstra
On Mon, Feb 03, 2014 at 08:17:47AM -0800, Arjan van de Ven wrote: > On 2/3/2014 6:56 AM, Peter Zijlstra wrote: > if there's a simple api like > > sched_cpu_cache_wiped(int llc) > > that would be very nice for this; the menuidle side knows this > for some cases and thus can just call it. This woul

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-04 Thread Arjan van de Ven
Yeah, so we could put the parameters back by measuring it in user-space via a nice utility in tools/, and by matching it to relevant hardware signatures (CPU type and cache sizes), plus doing some defaults for when we don't have any signature... possibly based on a fuzzy search to find the 'close

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-04 Thread Arjan van de Ven
Yeah, so we could put the parameters back by measuring it in user-space via a nice utility in tools/, and by matching it to relevant hardware signatures (CPU type and cache sizes), plus doing some defaults for when we don't have any signature... possibly based on a fuzzy search to find the 'closes

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-04 Thread Ingo Molnar
* Peter Zijlstra wrote: > [...] > > The reason Ingo took it out was that these measured numbers would > slightly vary from boot to boot making it hard to compare > performance numbers across boots. > > There's something to be said for either case I suppose. Yeah, so we could put the paramete

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-03 Thread Arjan van de Ven
On 2/3/2014 6:56 AM, Peter Zijlstra wrote: Arjan, could you have a look at teaching your Thunderpants to wrap lines at ~80 chars please? I'll try but it suffers from Apple-disease 1) A latency driven one 2) A performance impact on first one is pretty much the exit latency related time, sor

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-03 Thread Nicolas Pitre
On Mon, 3 Feb 2014, Morten Rasmussen wrote: > On Fri, Jan 31, 2014 at 06:19:26PM +, Nicolas Pitre wrote: > > A cluster should map naturally to a scheduling domain. If we need to > > wake up a CPU, it is quite obvious that we should prefer an idle CPU > > from a scheduling domain which load

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-03 Thread Peter Zijlstra
Arjan, could you have a look at teaching your Thunderpants to wrap lines at ~80 chars please? On Mon, Feb 03, 2014 at 06:38:11AM -0800, Arjan van de Ven wrote: > On 2/3/2014 4:54 AM, Morten Rasmussen wrote: > > > > >I'm therefore not convinced that idle state index is the right thing to > >give

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-03 Thread Arjan van de Ven
On 2/3/2014 4:54 AM, Morten Rasmussen wrote: I'm therefore not convinced that idle state index is the right thing to give the scheduler. Using a cost metric would be better in my opinion. I totally agree with this, and we may need two separate cost metrics 1) A latency driven one 2) A perfo

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-03 Thread Morten Rasmussen
On Fri, Jan 31, 2014 at 06:19:26PM +, Nicolas Pitre wrote: > Right now (on ARM at least but I imagine this is pretty universal), the > biggest impact on information accuracy for a CPU depends on what the > other CPUs are doing. The most obvious example is cluster power down. > For a cluste

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-02 Thread Preeti U Murthy
Hi Daniel, On 01/31/2014 03:45 PM, Daniel Lezcano wrote: > On 01/31/2014 09:45 AM, Preeti Murthy wrote: >> Hi, >> >> On Thu, Jan 30, 2014 at 10:55 PM, Daniel Lezcano >> wrote: >>> On 01/30/2014 05:35 PM, Peter Zijlstra wrote: On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrot

RE: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-01 Thread Nicolas Pitre
On Sat, 1 Feb 2014, Brown, Len wrote: > > And your point is? > > It is a bad idea for an individual CPU to track the C-state > of another CPU, which can change the cycle after it was checked. Absolutely. And I'm far from advocating we do this either. > We know it is a bad idea because we used

RE: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-01 Thread Brown, Len
> And your point is? It is a bad idea for an individual CPU to track the C-state of another CPU, which can change the cycle after it was checked. We know it is a bad idea because we used to do it, until we realized code here can easily impact the performance critical path. In general, it is the O

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-01 Thread Lorenzo Pieralisi
On Sat, Feb 01, 2014 at 06:00:40AM +, Brown, Len wrote: > > Right now (on ARM at least but I imagine this is pretty universal), the > > biggest impact on information accuracy for a CPU depends on what the > > other CPUs are doing. The most obvious example is cluster power down. > > For a clust

RE: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-02-01 Thread Nicolas Pitre
On Sat, 1 Feb 2014, Brown, Len wrote: > > Right now (on ARM at least but I imagine this is pretty universal), the > > biggest impact on information accuracy for a CPU depends on what the > > other CPUs are doing. The most obvious example is cluster power down. > > For a cluster to be powered down

RE: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Brown, Len
> Right now (on ARM at least but I imagine this is pretty universal), the > biggest impact on information accuracy for a CPU depends on what the > other CPUs are doing. The most obvious example is cluster power down. > For a cluster to be powered down, all the CPUs sharing this cluster must > also

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Nicolas Pitre
On Fri, 31 Jan 2014, Arjan van de Ven wrote: > On 1/31/2014 7:37 AM, Daniel Lezcano wrote: > > On 01/31/2014 04:07 PM, Arjan van de Ven wrote: > > > > > > > > > > > > Hence I think this patch would make sense only with additional > > > > > > information > > > > > > like exit_latency or target_resi

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Arjan van de Ven
on x86 I don't care; we don't actually change these dynamically much[1]. But if you have 1 or 2 things in mind to use, I would suggest copying those 2 integers instead as we go, rather than the index. Saves refcounting/locking etc etc nightmare as well on the other subsystems' datastructures.. ..

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Daniel Lezcano
On 01/31/2014 04:50 PM, Arjan van de Ven wrote: On 1/31/2014 7:37 AM, Daniel Lezcano wrote: On 01/31/2014 04:07 PM, Arjan van de Ven wrote: Hence I think this patch would make sense only with additional information like exit_latency or target_residency is present for the scheduler. The idle st

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Arjan van de Ven
On 1/31/2014 7:37 AM, Daniel Lezcano wrote: On 01/31/2014 04:07 PM, Arjan van de Ven wrote: Hence I think this patch would make sense only with additional information like exit_latency or target_residency is present for the scheduler. The idle state index alone will not be sufficient. Alterna

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Daniel Lezcano
On 01/31/2014 04:07 PM, Arjan van de Ven wrote: Hence I think this patch would make sense only with additional information like exit_latency or target_residency is present for the scheduler. The idle state index alone will not be sufficient. Alternatively, can we enforce sanity on the cpuidle

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Arjan van de Ven
Hence I think this patch would make sense only with additional information like exit_latency or target_residency is present for the scheduler. The idle state index alone will not be sufficient. Alternatively, can we enforce sanity on the cpuidle infrastructure to make the index naturally ordere

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Dietmar Eggemann
On 31/01/14 14:04, Daniel Lezcano wrote: > On 01/31/2014 10:39 AM, Preeti U Murthy wrote: >> Hi Peter, >> >> On 01/31/2014 02:32 PM, Peter Zijlstra wrote: >>> On Fri, Jan 31, 2014 at 02:15:47PM +0530, Preeti Murthy wrote: > > If the driver does its own random mapping that will break the gov

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Daniel Lezcano
On 01/31/2014 10:39 AM, Preeti U Murthy wrote: Hi Peter, On 01/31/2014 02:32 PM, Peter Zijlstra wrote: On Fri, Jan 31, 2014 at 02:15:47PM +0530, Preeti Murthy wrote: If the driver does its own random mapping that will break the governor logic. So yes, the states are ordered, the higher the in

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Daniel Lezcano
On 01/30/2014 10:02 PM, Nicolas Pitre wrote: On Thu, 30 Jan 2014, Lorenzo Pieralisi wrote: On Thu, Jan 30, 2014 at 05:25:27PM +, Daniel Lezcano wrote: On 01/30/2014 05:35 PM, Peter Zijlstra wrote: On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: IIRC, Alex Shi sent a patch

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Peter Zijlstra
On Fri, Jan 31, 2014 at 03:09:49PM +0530, Preeti U Murthy wrote: > > Alternatively, can we enforce sanity on the cpuidle infrastructure to > > make the index naturally ordered? If not, please explain why :-) > > The commit id 71abbbf856a0e70 says that there are SOCs which could have > their target

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Daniel Lezcano
On 01/31/2014 09:45 AM, Preeti Murthy wrote: Hi, On Thu, Jan 30, 2014 at 10:55 PM, Daniel Lezcano wrote: On 01/30/2014 05:35 PM, Peter Zijlstra wrote: On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: struct cpuidle_state *state = &drv->states[rq->index]; And from the state,

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Lorenzo Pieralisi
On Thu, Jan 30, 2014 at 09:02:15PM +, Nicolas Pitre wrote: > On Thu, 30 Jan 2014, Lorenzo Pieralisi wrote: > > > On Thu, Jan 30, 2014 at 05:25:27PM +, Daniel Lezcano wrote: > > > On 01/30/2014 05:35 PM, Peter Zijlstra wrote: > > > > On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Vincent Guittot
On 30 January 2014 22:02, Nicolas Pitre wrote: > On Thu, 30 Jan 2014, Lorenzo Pieralisi wrote: > >> On Thu, Jan 30, 2014 at 05:25:27PM +, Daniel Lezcano wrote: >> > On 01/30/2014 05:35 PM, Peter Zijlstra wrote: >> > > On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: >> > >> IIRC

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Preeti U Murthy
Hi Peter, On 01/31/2014 02:32 PM, Peter Zijlstra wrote: > On Fri, Jan 31, 2014 at 02:15:47PM +0530, Preeti Murthy wrote: >>> >>> If the driver does its own random mapping that will break the governor >>> logic. So yes, the states are ordered, the higher the index is, the more you >>> save power an

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Peter Zijlstra
On Fri, Jan 31, 2014 at 02:15:47PM +0530, Preeti Murthy wrote: > > > > If the driver does its own random mapping that will break the governor > > logic. So yes, the states are ordered, the higher the index is, the more you > > save power and the higher the exit latency is. > > The above point hold

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-31 Thread Preeti Murthy
Hi, On Thu, Jan 30, 2014 at 10:55 PM, Daniel Lezcano wrote: > On 01/30/2014 05:35 PM, Peter Zijlstra wrote: >> >> On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: >>> >>> struct cpuidle_state *state = &drv->states[rq->index]; >>> >>> And from the state, we have the following inform

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Nicolas Pitre
On Thu, 30 Jan 2014, Lorenzo Pieralisi wrote: > On Thu, Jan 30, 2014 at 05:25:27PM +, Daniel Lezcano wrote: > > On 01/30/2014 05:35 PM, Peter Zijlstra wrote: > > > On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: > > >> IIRC, Alex Shi sent a patchset to improve the choosing of t

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Lorenzo Pieralisi
On Thu, Jan 30, 2014 at 05:25:27PM +, Daniel Lezcano wrote: > On 01/30/2014 05:35 PM, Peter Zijlstra wrote: > > On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: > >> struct cpuidle_state *state = &drv->states[rq->index]; > >> > >> And from the state, we have the following informa

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Daniel Lezcano
On 01/30/2014 05:35 PM, Peter Zijlstra wrote: On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: struct cpuidle_state *state = &drv->states[rq->index]; And from the state, we have the following informations: struct cpuidle_state { [ ... ] unsigned intexit_la

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Peter Zijlstra
On Thu, Jan 30, 2014 at 05:27:54PM +0100, Daniel Lezcano wrote: > struct cpuidle_state *state = &drv->states[rq->index]; > > And from the state, we have the following informations: > > struct cpuidle_state { > > [ ... ] > > unsigned intexit_latency; /* in US */ > int

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Daniel Lezcano
On 01/30/2014 04:31 PM, Peter Zijlstra wrote: On Thu, Jan 30, 2014 at 03:09:22PM +0100, Daniel Lezcano wrote: diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 90aef084..130debf 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -654,6 +654,9 @@ struct rq { #endif

Re: [RFC PATCH 3/3] idle: store the idle state index in the struct rq

2014-01-30 Thread Peter Zijlstra
On Thu, Jan 30, 2014 at 03:09:22PM +0100, Daniel Lezcano wrote: > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 90aef084..130debf 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -654,6 +654,9 @@ struct rq { > #endif > > struct sched_avg avg; > +#ifd