cpuidle sizes (Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES)

2013-02-17 Thread Len Brown
On 02/12/2013 05:43 PM, Daniel Lezcano wrote:
> On 02/12/2013 12:46 AM, Len Brown wrote:
>> On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
>>> On 02/09/2013 02:08 AM, Len Brown wrote:
>>
 The reason to change is that intel_idle will soon be able
 to export more than the 8 "major" states supported by MWAIT.
 When we hit that limit, it is important to know
 where the limit comes from.
>>>
>>> Does it mean CPUIDLE_STATE_MAX may increase in a near future ?
>>
>> Yes, perhaps to 10.
>> Let me know if you anticipate issues with doing that.
> 
> No, I don't see any issue so far. Maybe the array state is increasing
> more and more, so for most architecture it is a waste of memory, but
> anyway ...

aking a quick look at data structure sizes...

struct cpuidle_device{} is allocated per cpu --
so if we have a lot of cpus, that gets multiplied out.
But it doesn't grow much with growing CPUIDLE_STATE_MAX:

cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
we just shrunk to 24 bytes from 32 bytes/entry.
(and 240 < 256, so we're still shrinking:-)

plus it contains cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
which is a set of pointers per cpu - so with 8-byte
pointers, that would be 64->80 bytes/cpu.

The other sizes that vary with CPUIDLE_STATE_MAX
seem to be static allocations per driver --
and so they don't grow much.  Did I miss something?

thanks,
Len Brown, Intel Open Source Technology Center

ps. I can easily offer an arch-specific CPUIDLE_STATE_MAX over-ride
if you want to squeeze bytes per-arch.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


cpuidle sizes (Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES)

2013-02-17 Thread Len Brown
On 02/12/2013 05:43 PM, Daniel Lezcano wrote:
 On 02/12/2013 12:46 AM, Len Brown wrote:
 On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
 On 02/09/2013 02:08 AM, Len Brown wrote:

 The reason to change is that intel_idle will soon be able
 to export more than the 8 major states supported by MWAIT.
 When we hit that limit, it is important to know
 where the limit comes from.

 Does it mean CPUIDLE_STATE_MAX may increase in a near future ?

 Yes, perhaps to 10.
 Let me know if you anticipate issues with doing that.
 
 No, I don't see any issue so far. Maybe the array state is increasing
 more and more, so for most architecture it is a waste of memory, but
 anyway ...

aking a quick look at data structure sizes...

struct cpuidle_device{} is allocated per cpu --
so if we have a lot of cpus, that gets multiplied out.
But it doesn't grow much with growing CPUIDLE_STATE_MAX:

cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
we just shrunk to 24 bytes from 32 bytes/entry.
(and 240  256, so we're still shrinking:-)

plus it contains cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
which is a set of pointers per cpu - so with 8-byte
pointers, that would be 64-80 bytes/cpu.

The other sizes that vary with CPUIDLE_STATE_MAX
seem to be static allocations per driver --
and so they don't grow much.  Did I miss something?

thanks,
Len Brown, Intel Open Source Technology Center

ps. I can easily offer an arch-specific CPUIDLE_STATE_MAX over-ride
if you want to squeeze bytes per-arch.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-12 Thread Daniel Lezcano
On 02/12/2013 12:46 AM, Len Brown wrote:
> On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
>> On 02/09/2013 02:08 AM, Len Brown wrote:
> 
>>> The reason to change is that intel_idle will soon be able
>>> to export more than the 8 "major" states supported by MWAIT.
>>> When we hit that limit, it is important to know
>>> where the limit comes from.
>>
>> Does it mean CPUIDLE_STATE_MAX may increase in a near future ?
> 
> Yes, perhaps to 10.
> Let me know if you anticipate issues with doing that.

No, I don't see any issue so far. Maybe the array state is increasing
more and more, so for most architecture it is a waste of memory, but
anyway ...



-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-12 Thread Daniel Lezcano
On 02/12/2013 12:46 AM, Len Brown wrote:
 On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
 On 02/09/2013 02:08 AM, Len Brown wrote:
 
 The reason to change is that intel_idle will soon be able
 to export more than the 8 major states supported by MWAIT.
 When we hit that limit, it is important to know
 where the limit comes from.

 Does it mean CPUIDLE_STATE_MAX may increase in a near future ?
 
 Yes, perhaps to 10.
 Let me know if you anticipate issues with doing that.

No, I don't see any issue so far. Maybe the array state is increasing
more and more, so for most architecture it is a waste of memory, but
anyway ...



-- 
 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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-11 Thread Len Brown
On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
> On 02/09/2013 02:08 AM, Len Brown wrote:

>> The reason to change is that intel_idle will soon be able
>> to export more than the 8 "major" states supported by MWAIT.
>> When we hit that limit, it is important to know
>> where the limit comes from.
> 
> Does it mean CPUIDLE_STATE_MAX may increase in a near future ?

Yes, perhaps to 10.
Let me know if you anticipate issues with doing that.

thanks,
Len Brown, Intel Open Source Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-11 Thread Daniel Lezcano
On 02/09/2013 02:08 AM, Len Brown wrote:
> From: Len Brown 
> 
> Cosmetic only.
> 
> Replace use of MWAIT_MAX_NUM_CSTATES with CPUIDLE_STATE_MAX.
> They are both 8, so this patch has no functional change.
> 
> The reason to change is that intel_idle will soon be able
> to export more than the 8 "major" states supported by MWAIT.
> When we hit that limit, it is important to know
> where the limit comes from.

Does it mean CPUIDLE_STATE_MAX may increase in a near future ?



> Signed-off-by: Len Brown 
> ---
>  arch/x86/include/asm/mwait.h |  1 -
>  drivers/idle/intel_idle.c| 16 
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
> index bcdff99..3f44732 100644
> --- a/arch/x86/include/asm/mwait.h
> +++ b/arch/x86/include/asm/mwait.h
> @@ -4,7 +4,6 @@
>  #define MWAIT_SUBSTATE_MASK  0xf
>  #define MWAIT_CSTATE_MASK0xf
>  #define MWAIT_SUBSTATE_SIZE  4
> -#define MWAIT_MAX_NUM_CSTATES8
>  
>  #define CPUID_MWAIT_LEAF 5
>  #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index fa71477..c949a6f 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -74,7 +74,7 @@ static struct cpuidle_driver intel_idle_driver = {
>   .en_core_tk_irqen = 1,
>  };
>  /* intel_idle.max_cstate=0 disables driver */
> -static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;
> +static int max_cstate = CPUIDLE_STATE_MAX - 1;
>  
>  static unsigned int mwait_substates;
>  
> @@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
>   * which is also the index into the MWAIT hint array.
>   * Thus C0 is a dummy.
>   */
> -static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
> +static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
>   { /* MWAIT C0 */ },
>   { /* MWAIT C1 */
>   .name = "C1-NHM",
> @@ -148,7 +148,7 @@ static struct cpuidle_state 
> nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
>   .enter = _idle },
>  };
>  
> -static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
> +static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
>   { /* MWAIT C0 */ },
>   { /* MWAIT C1 */
>   .name = "C1-SNB",
> @@ -180,7 +180,7 @@ static struct cpuidle_state 
> snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
>   .enter = _idle },
>  };
>  
> -static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
> +static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
>   { /* MWAIT C0 */ },
>   { /* MWAIT C1 */
>   .name = "C1-IVB",
> @@ -212,7 +212,7 @@ static struct cpuidle_state 
> ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
>   .enter = _idle },
>  };
>  
> -static struct cpuidle_state hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
> +static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
>   { /* MWAIT C0 */ },
>   { /* MWAIT C1 */
>   .name = "C1-HSW",
> @@ -244,7 +244,7 @@ static struct cpuidle_state 
> hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
>   .enter = _idle },
>  };
>  
> -static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
> +static struct cpuidle_state atom_cstates[CPUIDLE_STATE_MAX] = {
>   { /* MWAIT C0 */ },
>   { /* MWAIT C1 */
>   .name = "C1-ATM",
> @@ -503,7 +503,7 @@ static int intel_idle_cpuidle_driver_init(void)
>  
>   drv->state_count = 1;
>  
> - for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
> + for (cstate = 1; cstate < CPUIDLE_STATE_MAX; ++cstate) {
>   int num_substates;
>  
>   if (cstate > max_cstate) {
> @@ -560,7 +560,7 @@ static int intel_idle_cpu_init(int cpu)
>  
>   dev->state_count = 1;
>  
> - for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
> + for (cstate = 1; cstate < CPUIDLE_STATE_MAX; ++cstate) {
>   int num_substates;
>  
>   if (cstate > max_cstate) {
> 


-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-11 Thread Daniel Lezcano
On 02/09/2013 02:08 AM, Len Brown wrote:
 From: Len Brown len.br...@intel.com
 
 Cosmetic only.
 
 Replace use of MWAIT_MAX_NUM_CSTATES with CPUIDLE_STATE_MAX.
 They are both 8, so this patch has no functional change.
 
 The reason to change is that intel_idle will soon be able
 to export more than the 8 major states supported by MWAIT.
 When we hit that limit, it is important to know
 where the limit comes from.

Does it mean CPUIDLE_STATE_MAX may increase in a near future ?



 Signed-off-by: Len Brown len.br...@intel.com
 ---
  arch/x86/include/asm/mwait.h |  1 -
  drivers/idle/intel_idle.c| 16 
  2 files changed, 8 insertions(+), 9 deletions(-)
 
 diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
 index bcdff99..3f44732 100644
 --- a/arch/x86/include/asm/mwait.h
 +++ b/arch/x86/include/asm/mwait.h
 @@ -4,7 +4,6 @@
  #define MWAIT_SUBSTATE_MASK  0xf
  #define MWAIT_CSTATE_MASK0xf
  #define MWAIT_SUBSTATE_SIZE  4
 -#define MWAIT_MAX_NUM_CSTATES8
  
  #define CPUID_MWAIT_LEAF 5
  #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
 diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
 index fa71477..c949a6f 100644
 --- a/drivers/idle/intel_idle.c
 +++ b/drivers/idle/intel_idle.c
 @@ -74,7 +74,7 @@ static struct cpuidle_driver intel_idle_driver = {
   .en_core_tk_irqen = 1,
  };
  /* intel_idle.max_cstate=0 disables driver */
 -static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;
 +static int max_cstate = CPUIDLE_STATE_MAX - 1;
  
  static unsigned int mwait_substates;
  
 @@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
   * which is also the index into the MWAIT hint array.
   * Thus C0 is a dummy.
   */
 -static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
 +static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
   { /* MWAIT C0 */ },
   { /* MWAIT C1 */
   .name = C1-NHM,
 @@ -148,7 +148,7 @@ static struct cpuidle_state 
 nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
   .enter = intel_idle },
  };
  
 -static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
 +static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
   { /* MWAIT C0 */ },
   { /* MWAIT C1 */
   .name = C1-SNB,
 @@ -180,7 +180,7 @@ static struct cpuidle_state 
 snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
   .enter = intel_idle },
  };
  
 -static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
 +static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
   { /* MWAIT C0 */ },
   { /* MWAIT C1 */
   .name = C1-IVB,
 @@ -212,7 +212,7 @@ static struct cpuidle_state 
 ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
   .enter = intel_idle },
  };
  
 -static struct cpuidle_state hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
 +static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
   { /* MWAIT C0 */ },
   { /* MWAIT C1 */
   .name = C1-HSW,
 @@ -244,7 +244,7 @@ static struct cpuidle_state 
 hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
   .enter = intel_idle },
  };
  
 -static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
 +static struct cpuidle_state atom_cstates[CPUIDLE_STATE_MAX] = {
   { /* MWAIT C0 */ },
   { /* MWAIT C1 */
   .name = C1-ATM,
 @@ -503,7 +503,7 @@ static int intel_idle_cpuidle_driver_init(void)
  
   drv-state_count = 1;
  
 - for (cstate = 1; cstate  MWAIT_MAX_NUM_CSTATES; ++cstate) {
 + for (cstate = 1; cstate  CPUIDLE_STATE_MAX; ++cstate) {
   int num_substates;
  
   if (cstate  max_cstate) {
 @@ -560,7 +560,7 @@ static int intel_idle_cpu_init(int cpu)
  
   dev-state_count = 1;
  
 - for (cstate = 1; cstate  MWAIT_MAX_NUM_CSTATES; ++cstate) {
 + for (cstate = 1; cstate  CPUIDLE_STATE_MAX; ++cstate) {
   int num_substates;
  
   if (cstate  max_cstate) {
 


-- 
 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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-11 Thread Len Brown
On 02/11/2013 03:53 AM, Daniel Lezcano wrote:
 On 02/09/2013 02:08 AM, Len Brown wrote:

 The reason to change is that intel_idle will soon be able
 to export more than the 8 major states supported by MWAIT.
 When we hit that limit, it is important to know
 where the limit comes from.
 
 Does it mean CPUIDLE_STATE_MAX may increase in a near future ?

Yes, perhaps to 10.
Let me know if you anticipate issues with doing that.

thanks,
Len Brown, Intel Open Source Technology Center

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-08 Thread Len Brown
From: Len Brown 

Cosmetic only.

Replace use of MWAIT_MAX_NUM_CSTATES with CPUIDLE_STATE_MAX.
They are both 8, so this patch has no functional change.

The reason to change is that intel_idle will soon be able
to export more than the 8 "major" states supported by MWAIT.
When we hit that limit, it is important to know
where the limit comes from.

Signed-off-by: Len Brown 
---
 arch/x86/include/asm/mwait.h |  1 -
 drivers/idle/intel_idle.c| 16 
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
index bcdff99..3f44732 100644
--- a/arch/x86/include/asm/mwait.h
+++ b/arch/x86/include/asm/mwait.h
@@ -4,7 +4,6 @@
 #define MWAIT_SUBSTATE_MASK0xf
 #define MWAIT_CSTATE_MASK  0xf
 #define MWAIT_SUBSTATE_SIZE4
-#define MWAIT_MAX_NUM_CSTATES  8
 
 #define CPUID_MWAIT_LEAF   5
 #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index fa71477..c949a6f 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -74,7 +74,7 @@ static struct cpuidle_driver intel_idle_driver = {
.en_core_tk_irqen = 1,
 };
 /* intel_idle.max_cstate=0 disables driver */
-static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;
+static int max_cstate = CPUIDLE_STATE_MAX - 1;
 
 static unsigned int mwait_substates;
 
@@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
  * which is also the index into the MWAIT hint array.
  * Thus C0 is a dummy.
  */
-static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = "C1-NHM",
@@ -148,7 +148,7 @@ static struct cpuidle_state 
nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = _idle },
 };
 
-static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = "C1-SNB",
@@ -180,7 +180,7 @@ static struct cpuidle_state 
snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = _idle },
 };
 
-static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = "C1-IVB",
@@ -212,7 +212,7 @@ static struct cpuidle_state 
ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = _idle },
 };
 
-static struct cpuidle_state hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = "C1-HSW",
@@ -244,7 +244,7 @@ static struct cpuidle_state 
hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = _idle },
 };
 
-static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state atom_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = "C1-ATM",
@@ -503,7 +503,7 @@ static int intel_idle_cpuidle_driver_init(void)
 
drv->state_count = 1;
 
-   for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
+   for (cstate = 1; cstate < CPUIDLE_STATE_MAX; ++cstate) {
int num_substates;
 
if (cstate > max_cstate) {
@@ -560,7 +560,7 @@ static int intel_idle_cpu_init(int cpu)
 
dev->state_count = 1;
 
-   for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
+   for (cstate = 1; cstate < CPUIDLE_STATE_MAX; ++cstate) {
int num_substates;
 
if (cstate > max_cstate) {
-- 
1.8.1.3.535.ga923c31

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/16] intel_idle: remove use and definition of MWAIT_MAX_NUM_CSTATES

2013-02-08 Thread Len Brown
From: Len Brown len.br...@intel.com

Cosmetic only.

Replace use of MWAIT_MAX_NUM_CSTATES with CPUIDLE_STATE_MAX.
They are both 8, so this patch has no functional change.

The reason to change is that intel_idle will soon be able
to export more than the 8 major states supported by MWAIT.
When we hit that limit, it is important to know
where the limit comes from.

Signed-off-by: Len Brown len.br...@intel.com
---
 arch/x86/include/asm/mwait.h |  1 -
 drivers/idle/intel_idle.c| 16 
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
index bcdff99..3f44732 100644
--- a/arch/x86/include/asm/mwait.h
+++ b/arch/x86/include/asm/mwait.h
@@ -4,7 +4,6 @@
 #define MWAIT_SUBSTATE_MASK0xf
 #define MWAIT_CSTATE_MASK  0xf
 #define MWAIT_SUBSTATE_SIZE4
-#define MWAIT_MAX_NUM_CSTATES  8
 
 #define CPUID_MWAIT_LEAF   5
 #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index fa71477..c949a6f 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -74,7 +74,7 @@ static struct cpuidle_driver intel_idle_driver = {
.en_core_tk_irqen = 1,
 };
 /* intel_idle.max_cstate=0 disables driver */
-static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;
+static int max_cstate = CPUIDLE_STATE_MAX - 1;
 
 static unsigned int mwait_substates;
 
@@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table;
  * which is also the index into the MWAIT hint array.
  * Thus C0 is a dummy.
  */
-static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state nehalem_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = C1-NHM,
@@ -148,7 +148,7 @@ static struct cpuidle_state 
nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = intel_idle },
 };
 
-static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state snb_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = C1-SNB,
@@ -180,7 +180,7 @@ static struct cpuidle_state 
snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = intel_idle },
 };
 
-static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state ivb_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = C1-IVB,
@@ -212,7 +212,7 @@ static struct cpuidle_state 
ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = intel_idle },
 };
 
-static struct cpuidle_state hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state hsw_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = C1-HSW,
@@ -244,7 +244,7 @@ static struct cpuidle_state 
hsw_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = intel_idle },
 };
 
-static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
+static struct cpuidle_state atom_cstates[CPUIDLE_STATE_MAX] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
.name = C1-ATM,
@@ -503,7 +503,7 @@ static int intel_idle_cpuidle_driver_init(void)
 
drv-state_count = 1;
 
-   for (cstate = 1; cstate  MWAIT_MAX_NUM_CSTATES; ++cstate) {
+   for (cstate = 1; cstate  CPUIDLE_STATE_MAX; ++cstate) {
int num_substates;
 
if (cstate  max_cstate) {
@@ -560,7 +560,7 @@ static int intel_idle_cpu_init(int cpu)
 
dev-state_count = 1;
 
-   for (cstate = 1; cstate  MWAIT_MAX_NUM_CSTATES; ++cstate) {
+   for (cstate = 1; cstate  CPUIDLE_STATE_MAX; ++cstate) {
int num_substates;
 
if (cstate  max_cstate) {
-- 
1.8.1.3.535.ga923c31

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/