direct-io.hg

changeset 9464:d7cbcf5d7cd6

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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 29 14:54:43 2006 +0100 (2006-03-29)
parents 58938b561b66
children 5715cf117178
files xen/Rules.mk xen/arch/x86/smpboot.c xen/arch/x86/x86_64/mm.c xen/include/asm-x86/config.h
line diff
     1.1 --- a/xen/Rules.mk	Wed Mar 29 14:50:57 2006 +0100
     1.2 +++ b/xen/Rules.mk	Wed Mar 29 14:54:43 2006 +0100
     1.3 @@ -51,6 +51,10 @@ CFLAGS-$(crash_debug)  += -DCRASH_DEBUG
     1.4  CFLAGS-$(perfc)        += -DPERF_COUNTERS
     1.5  CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
     1.6  
     1.7 +ifneq ($(max_phys_cpus),)
     1.8 +CFLAGS-y               += -DMAX_PHYS_CPUS=$(max_phys_cpus)
     1.9 +endif
    1.10 +
    1.11  ALL_OBJS := $(ALL_OBJS-y)
    1.12  CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))
    1.13  
     2.1 --- a/xen/arch/x86/smpboot.c	Wed Mar 29 14:50:57 2006 +0100
     2.2 +++ b/xen/arch/x86/smpboot.c	Wed Mar 29 14:54:43 2006 +0100
     2.3 @@ -880,18 +880,30 @@ static int __devinit do_boot_cpu(int api
     2.4   * Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu.
     2.5   */
     2.6  {
     2.7 -	struct vcpu *v;
     2.8  	unsigned long boot_error;
     2.9  	int timeout;
    2.10  	unsigned long start_eip;
    2.11  	unsigned short nmi_high = 0, nmi_low = 0;
    2.12 +	struct domain *d;
    2.13 +	struct vcpu *v;
    2.14 +	int vcpu_id;
    2.15  
    2.16  	++cpucount;
    2.17  
    2.18 -	v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
    2.19 -        BUG_ON(v == NULL);
    2.20 +	if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
    2.21 +		d = domain_create(IDLE_DOMAIN_ID, cpu);
    2.22 +		BUG_ON(d == NULL);
    2.23 +		v = d->vcpu[0];
    2.24 +	} else {
    2.25 +		d = idle_vcpu[cpu - vcpu_id]->domain;
    2.26 +		BUG_ON(d == NULL);
    2.27 +		v = alloc_vcpu(d, vcpu_id, cpu);
    2.28 +	}
    2.29  
    2.30 -        v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
    2.31 +	idle_vcpu[cpu] = v;
    2.32 +	BUG_ON(v == NULL);
    2.33 +
    2.34 +	v->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
    2.35  
    2.36  	/* start_eip had better be page-aligned! */
    2.37  	start_eip = setup_trampoline();
     3.1 --- a/xen/arch/x86/x86_64/mm.c	Wed Mar 29 14:50:57 2006 +0100
     3.2 +++ b/xen/arch/x86/x86_64/mm.c	Wed Mar 29 14:54:43 2006 +0100
     3.3 @@ -148,12 +148,14 @@ void subarch_init_memory(void)
     3.4      if ( ((offsetof(struct page_info, u.inuse._domain) != 
     3.5             (offsetof(struct page_info, count_info) + sizeof(u32)))) ||
     3.6           ((offsetof(struct page_info, count_info) & 7) != 0) ||
     3.7 -         (sizeof(struct page_info) != 40) )
     3.8 +         (sizeof(struct page_info) !=
     3.9 +          (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long))) )
    3.10      {
    3.11 -        printk("Weird page_info layout (%ld,%ld,%ld)\n",
    3.12 +        printk("Weird page_info layout (%ld,%ld,%ld,%ld)\n",
    3.13                 offsetof(struct page_info, count_info),
    3.14                 offsetof(struct page_info, u.inuse._domain),
    3.15 -               sizeof(struct page_info));
    3.16 +               sizeof(struct page_info),
    3.17 +               32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long));
    3.18          for ( ; ; ) ;
    3.19      }
    3.20  
     4.1 --- a/xen/include/asm-x86/config.h	Wed Mar 29 14:50:57 2006 +0100
     4.2 +++ b/xen/include/asm-x86/config.h	Wed Mar 29 14:54:43 2006 +0100
     4.3 @@ -35,7 +35,15 @@
     4.4  
     4.5  #define OPT_CONSOLE_STR "com1,vga"
     4.6  
     4.7 +#ifdef MAX_PHYS_CPUS
     4.8 +#define NR_CPUS MAX_PHYS_CPUS
     4.9 +#else
    4.10  #define NR_CPUS 32
    4.11 +#endif
    4.12 +
    4.13 +#if defined(__i386__) && (NR_CPUS > 32)
    4.14 +#error "Maximum of 32 physical processors supported by Xen on x86_32"
    4.15 +#endif
    4.16  
    4.17  #ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
    4.18  # define supervisor_mode_kernel (1)