# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID d7cbcf5d7cd636acd5bdce97b96ab7e534c1ec88
# Parent 58938b561b66db7063634f94f48c201cef02e901
Make maximum number of supported physical CPUs a compile-time
option via the 'max_phys_cpus=<nr>' compilation parameter.
Based on a patch from Aravindh Puthiyaparambil at Unisys.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 58938b561b66 -r d7cbcf5d7cd6 xen/Rules.mk
--- a/xen/Rules.mk Wed Mar 29 13:50:57 2006
+++ b/xen/Rules.mk Wed Mar 29 13:54:43 2006
@@ -51,6 +51,10 @@
CFLAGS-$(perfc) += -DPERF_COUNTERS
CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
+ifneq ($(max_phys_cpus),)
+CFLAGS-y += -DMAX_PHYS_CPUS=$(max_phys_cpus)
+endif
+
ALL_OBJS := $(ALL_OBJS-y)
CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y))
diff -r 58938b561b66 -r d7cbcf5d7cd6 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c Wed Mar 29 13:50:57 2006
+++ b/xen/arch/x86/smpboot.c Wed Mar 29 13:54:43 2006
@@ -880,18 +880,30 @@
* Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu.
*/
{
- struct vcpu *v;
unsigned long boot_error;
int timeout;
unsigned long start_eip;
unsigned short nmi_high = 0, nmi_low = 0;
+ struct domain *d;
+ struct vcpu *v;
+ int vcpu_id;
++cpucount;
- v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
- BUG_ON(v == NULL);
-
- v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
+ if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
+ d = domain_create(IDLE_DOMAIN_ID, cpu);
+ BUG_ON(d == NULL);
+ v = d->vcpu[0];
+ } else {
+ d = idle_vcpu[cpu - vcpu_id]->domain;
+ BUG_ON(d == NULL);
+ v = alloc_vcpu(d, vcpu_id, cpu);
+ }
+
+ idle_vcpu[cpu] = v;
+ BUG_ON(v == NULL);
+
+ v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
/* start_eip had better be page-aligned! */
start_eip = setup_trampoline();
diff -r 58938b561b66 -r d7cbcf5d7cd6 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c Wed Mar 29 13:50:57 2006
+++ b/xen/arch/x86/x86_64/mm.c Wed Mar 29 13:54:43 2006
@@ -148,12 +148,14 @@
if ( ((offsetof(struct page_info, u.inuse._domain) !=
(offsetof(struct page_info, count_info) + sizeof(u32)))) ||
((offsetof(struct page_info, count_info) & 7) != 0) ||
- (sizeof(struct page_info) != 40) )
- {
- printk("Weird page_info layout (%ld,%ld,%ld)\n",
+ (sizeof(struct page_info) !=
+ (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long))) )
+ {
+ printk("Weird page_info layout (%ld,%ld,%ld,%ld)\n",
offsetof(struct page_info, count_info),
offsetof(struct page_info, u.inuse._domain),
- sizeof(struct page_info));
+ sizeof(struct page_info),
+ 32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long));
for ( ; ; ) ;
}
diff -r 58938b561b66 -r d7cbcf5d7cd6 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h Wed Mar 29 13:50:57 2006
+++ b/xen/include/asm-x86/config.h Wed Mar 29 13:54:43 2006
@@ -35,7 +35,15 @@
#define OPT_CONSOLE_STR "com1,vga"
+#ifdef MAX_PHYS_CPUS
+#define NR_CPUS MAX_PHYS_CPUS
+#else
#define NR_CPUS 32
+#endif
+
+#if defined(__i386__) && (NR_CPUS > 32)
+#error "Maximum of 32 physical processors supported by Xen on x86_32"
+#endif
#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
# define supervisor_mode_kernel (1)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|