Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-29 Thread Siddha, Suresh B
On Wed, Nov 29, 2006 at 09:08:34AM +0100, Ingo Molnar wrote:
> 
> * Ingo Molnar <[EMAIL PROTECTED]> wrote:
> 
> > hm - indeed. Then we can indeed do the patch below. Nice simplification!
> 
> forgot to convert a few more places - full patch below.

Acked-by: Suresh Siddha <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-29 Thread Ingo Molnar

* Ingo Molnar <[EMAIL PROTECTED]> wrote:

> hm - indeed. Then we can indeed do the patch below. Nice simplification!

forgot to convert a few more places - full patch below.

Ingo

->
From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels. Furher simplify and
clean up the APIC initialization code.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/i386/kernel/acpi/boot.c  |2 +-
 arch/i386/kernel/mpparse.c|2 +-
 arch/x86_64/kernel/genapic.c  |   20 +++-
 arch/x86_64/kernel/mpparse.c  |2 +-
 include/asm-i386/genapic.h|4 ++--
 include/asm-i386/mach-bigsmp/mach_apic.h  |2 +-
 include/asm-i386/mach-default/mach_apic.h |2 +-
 include/asm-i386/mach-es7000/mach_apic.h  |2 +-
 include/asm-i386/mach-generic/mach_apic.h |2 +-
 include/asm-i386/mach-numaq/mach_apic.h   |2 +-
 include/asm-i386/mach-summit/mach_apic.h  |2 +-
 include/asm-i386/mach-visws/mach_apic.h   |2 +-
 include/asm-x86_64/apic.h |2 +-
 13 files changed, 16 insertions(+), 30 deletions(-)

Index: linux/arch/i386/kernel/acpi/boot.c
===
--- linux.orig/arch/i386/kernel/acpi/boot.c
+++ linux/arch/i386/kernel/acpi/boot.c
@@ -921,7 +921,7 @@ static void __init acpi_process_madt(voi
acpi_ioapic = 1;
 
smp_found_config = 1;
-   clustered_apic_check();
+   setup_apic_routing();
}
}
if (error == -EINVAL) {
Index: linux/arch/i386/kernel/mpparse.c
===
--- linux.orig/arch/i386/kernel/mpparse.c
+++ linux/arch/i386/kernel/mpparse.c
@@ -479,7 +479,7 @@ static int __init smp_read_mpc(struct mp
}
++mpc_record;
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR "SMP mptable: no processors registered!\n");
return num_processors;
Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -33,25 +33,11 @@ u8 x86_cpu_to_log_apicid[NR_CPUS]   = { [0
 struct genapic __read_mostly *genapic = _flat;
 
 /*
- * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
+ * Choose the APIC routing mode:
  */
-void __init clustered_apic_check(void)
+void __init setup_apic_routing(void)
 {
-   unsigned int i, max_apic = 0;
-   u8 id;
-
-   /*
-* Determine the maximum APIC ID in use:
-*/
-   for (i = 0; i < NR_CPUS; i++) {
-   id = bios_cpu_apicid[i];
-   if (id == BAD_APICID)
-   continue;
-   if (id > max_apic)
-   max_apic = id;
-   }
-
-   if (max_apic < 8)
+   if (cpus_weight(cpu_possible_map) <= 8)
genapic = _flat;
else
genapic = _physflat;
Index: linux/arch/x86_64/kernel/mpparse.c
===
--- linux.orig/arch/x86_64/kernel/mpparse.c
+++ linux/arch/x86_64/kernel/mpparse.c
@@ -302,7 +302,7 @@ static int __init smp_read_mpc(struct mp
}
}
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR "MPTABLE: no processors registered!\n");
return num_processors;
Index: linux/include/asm-i386/genapic.h
===
--- linux.orig/include/asm-i386/genapic.h
+++ linux/include/asm-i386/genapic.h
@@ -36,7 +36,7 @@ struct genapic { 
void (*init_apic_ldr)(void);
physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
 
-   void (*clustered_apic_check)(void);
+   void (*setup_apic_routing)(void);
int (*multi_timer_check)(int apic, int irq);
int (*apicid_to_node)(int logical_apicid); 
int (*cpu_to_logical_apicid)(int cpu);
@@ -99,7 +99,7 @@ struct genapic { 
APICFUNC(check_apicid_present) \
APICFUNC(init_apic_ldr) \
APICFUNC(ioapic_phys_id_map) \
-   APICFUNC(clustered_apic_check) \
+   APICFUNC(setup_apic_routing) \
APICFUNC(multi_timer_check) \
APICFUNC(apicid_to_node) \
APICFUNC(cpu_to_logical_apicid) \
Index: linux/include/asm-i386/mach-bigsmp/mach_apic.h
===
--- linux.orig/include/asm-i386/mach-bigsmp/mach_apic.h
+++ linux/include/asm-i386

Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-29 Thread Ingo Molnar

* Ingo Molnar [EMAIL PROTECTED] wrote:

 hm - indeed. Then we can indeed do the patch below. Nice simplification!

forgot to convert a few more places - full patch below.

Ingo

-
From: Ingo Molnar [EMAIL PROTECTED]
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels. Furher simplify and
clean up the APIC initialization code.

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/i386/kernel/acpi/boot.c  |2 +-
 arch/i386/kernel/mpparse.c|2 +-
 arch/x86_64/kernel/genapic.c  |   20 +++-
 arch/x86_64/kernel/mpparse.c  |2 +-
 include/asm-i386/genapic.h|4 ++--
 include/asm-i386/mach-bigsmp/mach_apic.h  |2 +-
 include/asm-i386/mach-default/mach_apic.h |2 +-
 include/asm-i386/mach-es7000/mach_apic.h  |2 +-
 include/asm-i386/mach-generic/mach_apic.h |2 +-
 include/asm-i386/mach-numaq/mach_apic.h   |2 +-
 include/asm-i386/mach-summit/mach_apic.h  |2 +-
 include/asm-i386/mach-visws/mach_apic.h   |2 +-
 include/asm-x86_64/apic.h |2 +-
 13 files changed, 16 insertions(+), 30 deletions(-)

Index: linux/arch/i386/kernel/acpi/boot.c
===
--- linux.orig/arch/i386/kernel/acpi/boot.c
+++ linux/arch/i386/kernel/acpi/boot.c
@@ -921,7 +921,7 @@ static void __init acpi_process_madt(voi
acpi_ioapic = 1;
 
smp_found_config = 1;
-   clustered_apic_check();
+   setup_apic_routing();
}
}
if (error == -EINVAL) {
Index: linux/arch/i386/kernel/mpparse.c
===
--- linux.orig/arch/i386/kernel/mpparse.c
+++ linux/arch/i386/kernel/mpparse.c
@@ -479,7 +479,7 @@ static int __init smp_read_mpc(struct mp
}
++mpc_record;
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR SMP mptable: no processors registered!\n);
return num_processors;
Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -33,25 +33,11 @@ u8 x86_cpu_to_log_apicid[NR_CPUS]   = { [0
 struct genapic __read_mostly *genapic = apic_flat;
 
 /*
- * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
+ * Choose the APIC routing mode:
  */
-void __init clustered_apic_check(void)
+void __init setup_apic_routing(void)
 {
-   unsigned int i, max_apic = 0;
-   u8 id;
-
-   /*
-* Determine the maximum APIC ID in use:
-*/
-   for (i = 0; i  NR_CPUS; i++) {
-   id = bios_cpu_apicid[i];
-   if (id == BAD_APICID)
-   continue;
-   if (id  max_apic)
-   max_apic = id;
-   }
-
-   if (max_apic  8)
+   if (cpus_weight(cpu_possible_map) = 8)
genapic = apic_flat;
else
genapic = apic_physflat;
Index: linux/arch/x86_64/kernel/mpparse.c
===
--- linux.orig/arch/x86_64/kernel/mpparse.c
+++ linux/arch/x86_64/kernel/mpparse.c
@@ -302,7 +302,7 @@ static int __init smp_read_mpc(struct mp
}
}
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR MPTABLE: no processors registered!\n);
return num_processors;
Index: linux/include/asm-i386/genapic.h
===
--- linux.orig/include/asm-i386/genapic.h
+++ linux/include/asm-i386/genapic.h
@@ -36,7 +36,7 @@ struct genapic { 
void (*init_apic_ldr)(void);
physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
 
-   void (*clustered_apic_check)(void);
+   void (*setup_apic_routing)(void);
int (*multi_timer_check)(int apic, int irq);
int (*apicid_to_node)(int logical_apicid); 
int (*cpu_to_logical_apicid)(int cpu);
@@ -99,7 +99,7 @@ struct genapic { 
APICFUNC(check_apicid_present) \
APICFUNC(init_apic_ldr) \
APICFUNC(ioapic_phys_id_map) \
-   APICFUNC(clustered_apic_check) \
+   APICFUNC(setup_apic_routing) \
APICFUNC(multi_timer_check) \
APICFUNC(apicid_to_node) \
APICFUNC(cpu_to_logical_apicid) \
Index: linux/include/asm-i386/mach-bigsmp/mach_apic.h
===
--- linux.orig/include/asm-i386/mach-bigsmp/mach_apic.h
+++ linux/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -71,7 +71,7 @@ static inline void

Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-29 Thread Siddha, Suresh B
On Wed, Nov 29, 2006 at 09:08:34AM +0100, Ingo Molnar wrote:
 
 * Ingo Molnar [EMAIL PROTECTED] wrote:
 
  hm - indeed. Then we can indeed do the patch below. Nice simplification!
 
 forgot to convert a few more places - full patch below.

Acked-by: Suresh Siddha [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Ingo Molnar

* Siddha, Suresh B <[EMAIL PROTECTED]> wrote:

> On Tue, Nov 28, 2006 at 09:23:22PM +0100, Ingo Molnar wrote:
> > 
> > * Siddha, Suresh B <[EMAIL PROTECTED]> wrote:
> > 
> > > On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
> > > > -   if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == 
> > > > max_cluster)
> > > > +   if (max_apic < 8)
> > > 
> > > Patch mostly looks good.  Instead of checking for max_apic, can we use
> > >   cpus_weight(cpu_possible_map) <= 8
> > 
> > ok - but i think it's still possible the BIOS tells us APIC IDs that are 
> > larger than 7, even if there are fewer CPUs. So i think the patch below 
> > should cover it. Agreed?
> > 
> 
> I think it is ok to use flat mode even when APIC IDs are larger than 
> 7, as we rely on LDR's which are programmed using smp_processor_id().
> 
> IMO, cpus_weight check should be fine.

hm - indeed. Then we can indeed do the patch below. Nice simplification!

Ingo

>
From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels. Furher simplify and
clean up the APIC initialization code.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/x86_64/kernel/genapic.c |   20 +++-
 arch/x86_64/kernel/mpparse.c |2 +-
 include/asm-x86_64/apic.h|2 +-
 3 files changed, 5 insertions(+), 19 deletions(-)

Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -33,25 +33,11 @@ u8 x86_cpu_to_log_apicid[NR_CPUS]   = { [0
 struct genapic __read_mostly *genapic = _flat;
 
 /*
- * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
+ * Choose the APIC routing mode:
  */
-void __init clustered_apic_check(void)
+void __init setup_apic_routing(void)
 {
-   unsigned int i, max_apic = 0;
-   u8 id;
-
-   /*
-* Determine the maximum APIC ID in use:
-*/
-   for (i = 0; i < NR_CPUS; i++) {
-   id = bios_cpu_apicid[i];
-   if (id == BAD_APICID)
-   continue;
-   if (id > max_apic)
-   max_apic = id;
-   }
-
-   if (max_apic < 8)
+   if (cpus_weight(cpu_possible_map) <= 8)
genapic = _flat;
else
genapic = _physflat;
Index: linux/arch/x86_64/kernel/mpparse.c
===
--- linux.orig/arch/x86_64/kernel/mpparse.c
+++ linux/arch/x86_64/kernel/mpparse.c
@@ -302,7 +302,7 @@ static int __init smp_read_mpc(struct mp
}
}
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR "MPTABLE: no processors registered!\n");
return num_processors;
Index: linux/include/asm-x86_64/apic.h
===
--- linux.orig/include/asm-x86_64/apic.h
+++ linux/include/asm-x86_64/apic.h
@@ -82,7 +82,7 @@ extern void setup_secondary_APIC_clock (
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
-extern void clustered_apic_check(void);
+extern void setup_apic_routing(void);
 static inline void lapic_timer_idle_broadcast(int broadcast) { }
 
 extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Siddha, Suresh B
On Tue, Nov 28, 2006 at 09:23:22PM +0100, Ingo Molnar wrote:
> 
> * Siddha, Suresh B <[EMAIL PROTECTED]> wrote:
> 
> > On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
> > > - if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster)
> > > + if (max_apic < 8)
> > 
> > Patch mostly looks good.  Instead of checking for max_apic, can we use
> > cpus_weight(cpu_possible_map) <= 8
> 
> ok - but i think it's still possible the BIOS tells us APIC IDs that are 
> larger than 7, even if there are fewer CPUs. So i think the patch below 
> should cover it. Agreed?
> 

I think it is ok to use flat mode even when APIC IDs are larger than 7, as
we rely on LDR's which are programmed using smp_processor_id().

IMO, cpus_weight check should be fine.

thanks,
suresh

>       Ingo
> 
> -------->
> From: Ingo Molnar <[EMAIL PROTECTED]>
> Subject: [patch] genapic: default to physical mode on hotplug CPU kernels
> 
> default to physical mode on hotplug CPU kernels.
> 
> Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
> 
> Index: linux/arch/x86_64/kernel/genapic.c
> ===
> --- linux.orig/arch/x86_64/kernel/genapic.c
> +++ linux/arch/x86_64/kernel/genapic.c
> @@ -51,7 +51,7 @@ void __init clustered_apic_check(void)
>   max_apic = id;
>   }
>  
> - if (max_apic < 8)
> + if (max_apic < 8 && cpus_weight(cpu_possible_map) <= 8)
>   genapic = _flat;
>   else
>   genapic = _physflat;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Ingo Molnar

* Siddha, Suresh B <[EMAIL PROTECTED]> wrote:

> On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
> > -   if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster)
> > +   if (max_apic < 8)
> 
> Patch mostly looks good.  Instead of checking for max_apic, can we use
>   cpus_weight(cpu_possible_map) <= 8

ok - but i think it's still possible the BIOS tells us APIC IDs that are 
larger than 7, even if there are fewer CPUs. So i think the patch below 
should cover it. Agreed?

Ingo

---->
From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>

Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -51,7 +51,7 @@ void __init clustered_apic_check(void)
max_apic = id;
}
 
-   if (max_apic < 8)
+   if (max_apic < 8 && cpus_weight(cpu_possible_map) <= 8)
genapic = _flat;
else
genapic = _physflat;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Ingo Molnar

* Siddha, Suresh B [EMAIL PROTECTED] wrote:

 On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
  -   if (clusters = 1  max_cluster = 8  cluster_cnt[0] == max_cluster)
  +   if (max_apic  8)
 
 Patch mostly looks good.  Instead of checking for max_apic, can we use
   cpus_weight(cpu_possible_map) = 8

ok - but i think it's still possible the BIOS tells us APIC IDs that are 
larger than 7, even if there are fewer CPUs. So i think the patch below 
should cover it. Agreed?

Ingo


From: Ingo Molnar [EMAIL PROTECTED]
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels.

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]

Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -51,7 +51,7 @@ void __init clustered_apic_check(void)
max_apic = id;
}
 
-   if (max_apic  8)
+   if (max_apic  8  cpus_weight(cpu_possible_map) = 8)
genapic = apic_flat;
else
genapic = apic_physflat;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Siddha, Suresh B
On Tue, Nov 28, 2006 at 09:23:22PM +0100, Ingo Molnar wrote:
 
 * Siddha, Suresh B [EMAIL PROTECTED] wrote:
 
  On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
   - if (clusters = 1  max_cluster = 8  cluster_cnt[0] == max_cluster)
   + if (max_apic  8)
  
  Patch mostly looks good.  Instead of checking for max_apic, can we use
  cpus_weight(cpu_possible_map) = 8
 
 ok - but i think it's still possible the BIOS tells us APIC IDs that are 
 larger than 7, even if there are fewer CPUs. So i think the patch below 
 should cover it. Agreed?
 

I think it is ok to use flat mode even when APIC IDs are larger than 7, as
we rely on LDR's which are programmed using smp_processor_id().

IMO, cpus_weight check should be fine.

thanks,
suresh

   Ingo
 
 
 From: Ingo Molnar [EMAIL PROTECTED]
 Subject: [patch] genapic: default to physical mode on hotplug CPU kernels
 
 default to physical mode on hotplug CPU kernels.
 
 Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
 
 Index: linux/arch/x86_64/kernel/genapic.c
 ===
 --- linux.orig/arch/x86_64/kernel/genapic.c
 +++ linux/arch/x86_64/kernel/genapic.c
 @@ -51,7 +51,7 @@ void __init clustered_apic_check(void)
   max_apic = id;
   }
  
 - if (max_apic  8)
 + if (max_apic  8  cpus_weight(cpu_possible_map) = 8)
   genapic = apic_flat;
   else
   genapic = apic_physflat;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] genapic: default to physical mode on hotplug CPU kernels

2006-11-28 Thread Ingo Molnar

* Siddha, Suresh B [EMAIL PROTECTED] wrote:

 On Tue, Nov 28, 2006 at 09:23:22PM +0100, Ingo Molnar wrote:
  
  * Siddha, Suresh B [EMAIL PROTECTED] wrote:
  
   On Tue, Nov 28, 2006 at 07:33:46AM +0100, Ingo Molnar wrote:
-   if (clusters = 1  max_cluster = 8  cluster_cnt[0] == 
max_cluster)
+   if (max_apic  8)
   
   Patch mostly looks good.  Instead of checking for max_apic, can we use
 cpus_weight(cpu_possible_map) = 8
  
  ok - but i think it's still possible the BIOS tells us APIC IDs that are 
  larger than 7, even if there are fewer CPUs. So i think the patch below 
  should cover it. Agreed?
  
 
 I think it is ok to use flat mode even when APIC IDs are larger than 
 7, as we rely on LDR's which are programmed using smp_processor_id().
 
 IMO, cpus_weight check should be fine.

hm - indeed. Then we can indeed do the patch below. Nice simplification!

Ingo


From: Ingo Molnar [EMAIL PROTECTED]
Subject: [patch] genapic: default to physical mode on hotplug CPU kernels

default to physical mode on hotplug CPU kernels. Furher simplify and
clean up the APIC initialization code.

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 arch/x86_64/kernel/genapic.c |   20 +++-
 arch/x86_64/kernel/mpparse.c |2 +-
 include/asm-x86_64/apic.h|2 +-
 3 files changed, 5 insertions(+), 19 deletions(-)

Index: linux/arch/x86_64/kernel/genapic.c
===
--- linux.orig/arch/x86_64/kernel/genapic.c
+++ linux/arch/x86_64/kernel/genapic.c
@@ -33,25 +33,11 @@ u8 x86_cpu_to_log_apicid[NR_CPUS]   = { [0
 struct genapic __read_mostly *genapic = apic_flat;
 
 /*
- * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
+ * Choose the APIC routing mode:
  */
-void __init clustered_apic_check(void)
+void __init setup_apic_routing(void)
 {
-   unsigned int i, max_apic = 0;
-   u8 id;
-
-   /*
-* Determine the maximum APIC ID in use:
-*/
-   for (i = 0; i  NR_CPUS; i++) {
-   id = bios_cpu_apicid[i];
-   if (id == BAD_APICID)
-   continue;
-   if (id  max_apic)
-   max_apic = id;
-   }
-
-   if (max_apic  8)
+   if (cpus_weight(cpu_possible_map) = 8)
genapic = apic_flat;
else
genapic = apic_physflat;
Index: linux/arch/x86_64/kernel/mpparse.c
===
--- linux.orig/arch/x86_64/kernel/mpparse.c
+++ linux/arch/x86_64/kernel/mpparse.c
@@ -302,7 +302,7 @@ static int __init smp_read_mpc(struct mp
}
}
}
-   clustered_apic_check();
+   setup_apic_routing();
if (!num_processors)
printk(KERN_ERR MPTABLE: no processors registered!\n);
return num_processors;
Index: linux/include/asm-x86_64/apic.h
===
--- linux.orig/include/asm-x86_64/apic.h
+++ linux/include/asm-x86_64/apic.h
@@ -82,7 +82,7 @@ extern void setup_secondary_APIC_clock (
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
-extern void clustered_apic_check(void);
+extern void setup_apic_routing(void);
 static inline void lapic_timer_idle_broadcast(int broadcast) { }
 
 extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/