All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits
@ 2011-08-19 15:04 Jan Beulich
  2011-08-24 18:13 ` Konrad Rzeszutek Wilk
  2011-08-24 20:00 ` Steven
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2011-08-19 15:04 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]

This is just another adjustment to allow systems with very many CPUs
(or unusual ACPI IDs) to be properly power-managed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/arch/ia64/linux-xen/acpi.c
+++ b/xen/arch/ia64/linux-xen/acpi.c
@@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
 		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
 
 /* acpi id to cpu id */
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
 	int i;
 	u16 apic_id;
 
+	if ( acpi_id >= MAX_LOCAL_SAPIC )
+		return -EINVAL;
+
 	apic_id = ia64_acpiid_to_sapicid[acpi_id];
 	if ( apic_id == 0xffff )
 		return -EINVAL;
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -895,11 +895,14 @@ static void set_cx(
         acpi_power->safe_state = cx;
 }
 
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
     int i;
     u32 apic_id;
 
+    if ( acpi_id >= MAX_MADT_ENTRIES )
+        return -1;
+
     apic_id = x86_acpiid_to_apicid[acpi_id];
     if ( apic_id == BAD_APICID )
         return -1;
@@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct 
     print_cx_pminfo(cpu, power);
 
     /* map from acpi_id to cpu_id */
-    cpu_id = get_cpu_id((u8)cpu);
+    cpu_id = get_cpu_id(cpu);
     if ( cpu_id == -1 )
     {
         printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
--- a/xen/include/acpi/cpufreq/processor_perf.h
+++ b/xen/include/acpi/cpufreq/processor_perf.h
@@ -6,7 +6,7 @@
 
 #define XEN_PX_INIT 0x80000000
 
-int get_cpu_id(u8);
+int get_cpu_id(u32);
 int powernow_cpufreq_init(void);
 unsigned int powernow_register_driver(void);
 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);




[-- Attachment #2: cpuidle-get-cpu-id.patch --]
[-- Type: text/plain, Size: 1721 bytes --]

This is just another adjustment to allow systems with very many CPUs
(or unusual ACPI IDs) to be properly power-managed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/arch/ia64/linux-xen/acpi.c
+++ b/xen/arch/ia64/linux-xen/acpi.c
@@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
 		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
 
 /* acpi id to cpu id */
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
 	int i;
 	u16 apic_id;
 
+	if ( acpi_id >= MAX_LOCAL_SAPIC )
+		return -EINVAL;
+
 	apic_id = ia64_acpiid_to_sapicid[acpi_id];
 	if ( apic_id == 0xffff )
 		return -EINVAL;
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -895,11 +895,14 @@ static void set_cx(
         acpi_power->safe_state = cx;
 }
 
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
 {
     int i;
     u32 apic_id;
 
+    if ( acpi_id >= MAX_MADT_ENTRIES )
+        return -1;
+
     apic_id = x86_acpiid_to_apicid[acpi_id];
     if ( apic_id == BAD_APICID )
         return -1;
@@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct 
     print_cx_pminfo(cpu, power);
 
     /* map from acpi_id to cpu_id */
-    cpu_id = get_cpu_id((u8)cpu);
+    cpu_id = get_cpu_id(cpu);
     if ( cpu_id == -1 )
     {
         printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
--- a/xen/include/acpi/cpufreq/processor_perf.h
+++ b/xen/include/acpi/cpufreq/processor_perf.h
@@ -6,7 +6,7 @@
 
 #define XEN_PX_INIT 0x80000000
 
-int get_cpu_id(u8);
+int get_cpu_id(u32);
 int powernow_cpufreq_init(void);
 unsigned int powernow_register_driver(void);
 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits
  2011-08-19 15:04 [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits Jan Beulich
@ 2011-08-24 18:13 ` Konrad Rzeszutek Wilk
  2011-08-25  6:56   ` Jan Beulich
  2011-08-24 20:00 ` Steven
  1 sibling, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-08-24 18:13 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel@lists.xensource.com

On Fri, Aug 19, 2011 at 04:04:49PM +0100, Jan Beulich wrote:
> This is just another adjustment to allow systems with very many CPUs
> (or unusual ACPI IDs) to be properly power-managed.

Out of curiosity - which boxes is this? Is it one of the IBM x3850
(or x3950)?

> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> --- a/xen/arch/ia64/linux-xen/acpi.c
> +++ b/xen/arch/ia64/linux-xen/acpi.c
> @@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
>  		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
>  
>  /* acpi id to cpu id */
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>  	int i;
>  	u16 apic_id;
>  
> +	if ( acpi_id >= MAX_LOCAL_SAPIC )
> +		return -EINVAL;
> +
>  	apic_id = ia64_acpiid_to_sapicid[acpi_id];
>  	if ( apic_id == 0xffff )
>  		return -EINVAL;
> --- a/xen/arch/x86/acpi/cpu_idle.c
> +++ b/xen/arch/x86/acpi/cpu_idle.c
> @@ -895,11 +895,14 @@ static void set_cx(
>          acpi_power->safe_state = cx;
>  }
>  
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>      int i;
>      u32 apic_id;
>  
> +    if ( acpi_id >= MAX_MADT_ENTRIES )
> +        return -1;
> +
>      apic_id = x86_acpiid_to_apicid[acpi_id];
>      if ( apic_id == BAD_APICID )
>          return -1;
> @@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct 
>      print_cx_pminfo(cpu, power);
>  
>      /* map from acpi_id to cpu_id */
> -    cpu_id = get_cpu_id((u8)cpu);
> +    cpu_id = get_cpu_id(cpu);
>      if ( cpu_id == -1 )
>      {
>          printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
> --- a/xen/include/acpi/cpufreq/processor_perf.h
> +++ b/xen/include/acpi/cpufreq/processor_perf.h
> @@ -6,7 +6,7 @@
>  
>  #define XEN_PX_INIT 0x80000000
>  
> -int get_cpu_id(u8);
> +int get_cpu_id(u32);
>  int powernow_cpufreq_init(void);
>  unsigned int powernow_register_driver(void);
>  unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
> 
> 
> 

> This is just another adjustment to allow systems with very many CPUs
> (or unusual ACPI IDs) to be properly power-managed.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> --- a/xen/arch/ia64/linux-xen/acpi.c
> +++ b/xen/arch/ia64/linux-xen/acpi.c
> @@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
>  		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
>  
>  /* acpi id to cpu id */
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>  	int i;
>  	u16 apic_id;
>  
> +	if ( acpi_id >= MAX_LOCAL_SAPIC )
> +		return -EINVAL;
> +
>  	apic_id = ia64_acpiid_to_sapicid[acpi_id];
>  	if ( apic_id == 0xffff )
>  		return -EINVAL;
> --- a/xen/arch/x86/acpi/cpu_idle.c
> +++ b/xen/arch/x86/acpi/cpu_idle.c
> @@ -895,11 +895,14 @@ static void set_cx(
>          acpi_power->safe_state = cx;
>  }
>  
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>      int i;
>      u32 apic_id;
>  
> +    if ( acpi_id >= MAX_MADT_ENTRIES )
> +        return -1;
> +
>      apic_id = x86_acpiid_to_apicid[acpi_id];
>      if ( apic_id == BAD_APICID )
>          return -1;
> @@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct 
>      print_cx_pminfo(cpu, power);
>  
>      /* map from acpi_id to cpu_id */
> -    cpu_id = get_cpu_id((u8)cpu);
> +    cpu_id = get_cpu_id(cpu);
>      if ( cpu_id == -1 )
>      {
>          printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
> --- a/xen/include/acpi/cpufreq/processor_perf.h
> +++ b/xen/include/acpi/cpufreq/processor_perf.h
> @@ -6,7 +6,7 @@
>  
>  #define XEN_PX_INIT 0x80000000
>  
> -int get_cpu_id(u8);
> +int get_cpu_id(u32);
>  int powernow_cpufreq_init(void);
>  unsigned int powernow_register_driver(void);
>  unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits
  2011-08-19 15:04 [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits Jan Beulich
  2011-08-24 18:13 ` Konrad Rzeszutek Wilk
@ 2011-08-24 20:00 ` Steven
  2011-08-25  7:48   ` Jan Beulich
  1 sibling, 1 reply; 5+ messages in thread
From: Steven @ 2011-08-24 20:00 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

Why do you use "u32"? Is it because u32 can support more CPU id than u8?


On Fri, Aug 19, 2011 at 11:04 AM, Jan Beulich <JBeulich@novell.com> wrote:
> This is just another adjustment to allow systems with very many CPUs
> (or unusual ACPI IDs) to be properly power-managed.
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>
> --- a/xen/arch/ia64/linux-xen/acpi.c
> +++ b/xen/arch/ia64/linux-xen/acpi.c
> @@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
>                {[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
>
>  /* acpi id to cpu id */
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>        int i;
>        u16 apic_id;
>
> +       if ( acpi_id >= MAX_LOCAL_SAPIC )
> +               return -EINVAL;
> +
>        apic_id = ia64_acpiid_to_sapicid[acpi_id];
>        if ( apic_id == 0xffff )
>                return -EINVAL;
> --- a/xen/arch/x86/acpi/cpu_idle.c
> +++ b/xen/arch/x86/acpi/cpu_idle.c
> @@ -895,11 +895,14 @@ static void set_cx(
>         acpi_power->safe_state = cx;
>  }
>
> -int get_cpu_id(u8 acpi_id)
> +int get_cpu_id(u32 acpi_id)
>  {
>     int i;
>     u32 apic_id;
>
> +    if ( acpi_id >= MAX_MADT_ENTRIES )
> +        return -1;
> +
>     apic_id = x86_acpiid_to_apicid[acpi_id];
>     if ( apic_id == BAD_APICID )
>         return -1;
> @@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct
>     print_cx_pminfo(cpu, power);
>
>     /* map from acpi_id to cpu_id */
> -    cpu_id = get_cpu_id((u8)cpu);
> +    cpu_id = get_cpu_id(cpu);
>     if ( cpu_id == -1 )
>     {
>         printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
> --- a/xen/include/acpi/cpufreq/processor_perf.h
> +++ b/xen/include/acpi/cpufreq/processor_perf.h
> @@ -6,7 +6,7 @@
>
>  #define XEN_PX_INIT 0x80000000
>
> -int get_cpu_id(u8);
> +int get_cpu_id(u32);
>  int powernow_cpufreq_init(void);
>  unsigned int powernow_register_driver(void);
>  unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits
  2011-08-24 18:13 ` Konrad Rzeszutek Wilk
@ 2011-08-25  6:56   ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2011-08-25  6:56 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel@lists.xensource.com

>>> On 24.08.11 at 20:13, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> On Fri, Aug 19, 2011 at 04:04:49PM +0100, Jan Beulich wrote:
>> This is just another adjustment to allow systems with very many CPUs
>> (or unusual ACPI IDs) to be properly power-managed.
> 
> Out of curiosity - which boxes is this? Is it one of the IBM x3850
> (or x3950)?

No actual box - I just spotted this while looking at the _PDC stuff.

Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits
  2011-08-24 20:00 ` Steven
@ 2011-08-25  7:48   ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2011-08-25  7:48 UTC (permalink / raw)
  To: Steven; +Cc: xen-devel

>>> On 24.08.11 at 22:00, Steven <wangwangkang@gmail.com> wrote:
> Why do you use "u32"? Is it because u32 can support more CPU id than u8?

Yes, of course. ACPI specifies them to be 32 bits wide.

Jan

> On Fri, Aug 19, 2011 at 11:04 AM, Jan Beulich <JBeulich@novell.com> wrote:
>> This is just another adjustment to allow systems with very many CPUs
>> (or unusual ACPI IDs) to be properly power-managed.
>>
>> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>>
>> --- a/xen/arch/ia64/linux-xen/acpi.c
>> +++ b/xen/arch/ia64/linux-xen/acpi.c
>> @@ -221,11 +221,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
>>                {[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
>>
>>  /* acpi id to cpu id */
>> -int get_cpu_id(u8 acpi_id)
>> +int get_cpu_id(u32 acpi_id)
>>  {
>>        int i;
>>        u16 apic_id;
>>
>> +       if ( acpi_id >= MAX_LOCAL_SAPIC )
>> +               return -EINVAL;
>> +
>>        apic_id = ia64_acpiid_to_sapicid[acpi_id];
>>        if ( apic_id == 0xffff )
>>                return -EINVAL;
>> --- a/xen/arch/x86/acpi/cpu_idle.c
>> +++ b/xen/arch/x86/acpi/cpu_idle.c
>> @@ -895,11 +895,14 @@ static void set_cx(
>>         acpi_power->safe_state = cx;
>>  }
>>
>> -int get_cpu_id(u8 acpi_id)
>> +int get_cpu_id(u32 acpi_id)
>>  {
>>     int i;
>>     u32 apic_id;
>>
>> +    if ( acpi_id >= MAX_MADT_ENTRIES )
>> +        return -1;
>> +
>>     apic_id = x86_acpiid_to_apicid[acpi_id];
>>     if ( apic_id == BAD_APICID )
>>         return -1;
>> @@ -976,7 +979,7 @@ long set_cx_pminfo(uint32_t cpu, struct
>>     print_cx_pminfo(cpu, power);
>>
>>     /* map from acpi_id to cpu_id */
>> -    cpu_id = get_cpu_id((u8)cpu);
>> +    cpu_id = get_cpu_id(cpu);
>>     if ( cpu_id == -1 )
>>     {
>>         printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
>> --- a/xen/include/acpi/cpufreq/processor_perf.h
>> +++ b/xen/include/acpi/cpufreq/processor_perf.h
>> @@ -6,7 +6,7 @@
>>
>>  #define XEN_PX_INIT 0x80000000
>>
>> -int get_cpu_id(u8);
>> +int get_cpu_id(u32);
>>  int powernow_cpufreq_init(void);
>>  unsigned int powernow_register_driver(void);
>>  unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
>>
>>
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com 
>> http://lists.xensource.com/xen-devel 
>>
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-25  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-19 15:04 [PATCH] pm: don't truncate processors' ACPI IDs to 8 bits Jan Beulich
2011-08-24 18:13 ` Konrad Rzeszutek Wilk
2011-08-25  6:56   ` Jan Beulich
2011-08-24 20:00 ` Steven
2011-08-25  7:48   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.