direct-io.hg

changeset 6835:44316ce83277

Baby step toward host SMP support
author djm@kirby.fc.hp.com
date Tue Aug 30 17:51:51 2005 -0600 (2005-08-30)
parents f5c4042212b0
children b7276814008c
files xen/arch/ia64/linux-xen/mm_contig.c xen/arch/ia64/linux-xen/smp.c xen/arch/ia64/linux-xen/smpboot.c xen/arch/ia64/vcpu.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/mm_contig.c	Tue Aug 30 12:41:54 2005 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/mm_contig.c	Tue Aug 30 17:51:51 2005 -0600
     1.3 @@ -192,8 +192,8 @@ per_cpu_init (void)
     1.4  	 */
     1.5  	if (smp_processor_id() == 0) {
     1.6  #ifdef XEN
     1.7 -		cpu_data = alloc_xenheap_pages(PERCPU_PAGE_SIZE -
     1.8 -			PAGE_SIZE + get_order(NR_CPUS));
     1.9 +		cpu_data = alloc_xenheap_pages(PERCPU_PAGE_SHIFT -
    1.10 +			PAGE_SHIFT + get_order(NR_CPUS));
    1.11  #else
    1.12  		cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS,
    1.13  					   PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
     2.1 --- a/xen/arch/ia64/linux-xen/smp.c	Tue Aug 30 12:41:54 2005 -0600
     2.2 +++ b/xen/arch/ia64/linux-xen/smp.c	Tue Aug 30 17:51:51 2005 -0600
     2.3 @@ -63,7 +63,8 @@ void flush_tlb_mask(cpumask_t mask)
     2.4  //Huh? This seems to be used on ia64 even if !CONFIG_SMP
     2.5  void smp_send_event_check_mask(cpumask_t mask)
     2.6  {
     2.7 -	dummy();
     2.8 +	printf("smp_send_event_check_mask called\n");
     2.9 +	//dummy();
    2.10  	//send_IPI_mask(cpu_mask, EVENT_CHECK_VECTOR);
    2.11  }
    2.12  
    2.13 @@ -378,7 +379,11 @@ smp_call_function (void (*func) (void *i
    2.14  
    2.15  	/* Can deadlock when called with interrupts disabled */
    2.16  #ifdef XEN
    2.17 -	if (irqs_disabled()) panic("smp_call_function called with interrupts disabled\n");
    2.18 +	if (irqs_disabled()) {
    2.19 +		printk("smp_call_function called with interrupts disabled...");
    2.20 +		printk("enabling interrupts\n");
    2.21 +		local_irq_enable();
    2.22 +	}
    2.23  #else
    2.24  	WARN_ON(irqs_disabled());
    2.25  #endif
    2.26 @@ -390,11 +395,15 @@ smp_call_function (void (*func) (void *i
    2.27  	if (wait)
    2.28  		atomic_set(&data.finished, 0);
    2.29  
    2.30 +	printk("smp_call_function: about to spin_lock \n");
    2.31  	spin_lock(&call_lock);
    2.32 +	printk("smp_call_function: done with spin_lock \n");
    2.33  
    2.34  	call_data = &data;
    2.35  	mb();	/* ensure store to call_data precedes setting of IPI_CALL_FUNC */
    2.36 +	printk("smp_call_function: about to send_IPI \n");
    2.37  	send_IPI_allbutself(IPI_CALL_FUNC);
    2.38 +	printk("smp_call_function: done with send_IPI \n");
    2.39  
    2.40  	/* Wait for response */
    2.41  	while (atomic_read(&data.started) != cpus)
    2.42 @@ -405,7 +414,9 @@ smp_call_function (void (*func) (void *i
    2.43  			cpu_relax();
    2.44  	call_data = NULL;
    2.45  
    2.46 +	printk("smp_call_function: about to spin_unlock \n");
    2.47  	spin_unlock(&call_lock);
    2.48 +	printk("smp_call_function: DONE WITH spin_unlock, returning \n");
    2.49  	return 0;
    2.50  }
    2.51  EXPORT_SYMBOL(smp_call_function);
     3.1 --- a/xen/arch/ia64/linux-xen/smpboot.c	Tue Aug 30 12:41:54 2005 -0600
     3.2 +++ b/xen/arch/ia64/linux-xen/smpboot.c	Tue Aug 30 17:51:51 2005 -0600
     3.3 @@ -68,7 +68,8 @@ int ht_per_core = 1;
     3.4  
     3.5  #ifdef CONFIG_SMP /* ifdef XEN */
     3.6  
     3.7 -#define SMP_DEBUG 0
     3.8 +//#define SMP_DEBUG 0
     3.9 +#define SMP_DEBUG 1
    3.10  
    3.11  #if SMP_DEBUG
    3.12  #define Dprintk(x...)  printk(x)
     4.1 --- a/xen/arch/ia64/vcpu.c	Tue Aug 30 12:41:54 2005 -0600
     4.2 +++ b/xen/arch/ia64/vcpu.c	Tue Aug 30 17:51:51 2005 -0600
     4.3 @@ -586,6 +586,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UIN
     4.4  	PSCB(vcpu,pending_interruption) = 1;
     4.5      }
     4.6  
     4.7 +#if 0
     4.8      /* Keir: I think you should unblock when an interrupt is pending. */
     4.9      {
    4.10          int running = test_bit(_VCPUF_running, &vcpu->vcpu_flags);
    4.11 @@ -593,6 +594,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UIN
    4.12          if ( running )
    4.13              smp_send_event_check_cpu(vcpu->processor);
    4.14      }
    4.15 +#endif
    4.16  }
    4.17  
    4.18  void early_tick(VCPU *vcpu)
     5.1 --- a/xen/arch/ia64/xenmisc.c	Tue Aug 30 12:41:54 2005 -0600
     5.2 +++ b/xen/arch/ia64/xenmisc.c	Tue Aug 30 17:51:51 2005 -0600
     5.3 @@ -28,7 +28,12 @@ void ia64_mca_init(void) { printf("ia64_
     5.4  void ia64_mca_cpu_init(void *x) { }
     5.5  void ia64_patch_mckinley_e9(unsigned long a, unsigned long b) { }
     5.6  void ia64_patch_vtop(unsigned long a, unsigned long b) { }
     5.7 -void hpsim_setup(char **x) { }
     5.8 +void hpsim_setup(char **x)
     5.9 +{
    5.10 +#ifdef CONFIG_SMP
    5.11 +	init_smp_config();
    5.12 +#endif
    5.13 +}
    5.14  
    5.15  // called from mem_init... don't think s/w I/O tlb is needed in Xen
    5.16  //void swiotlb_init(void) { }  ...looks like it IS needed
     6.1 --- a/xen/arch/ia64/xensetup.c	Tue Aug 30 12:41:54 2005 -0600
     6.2 +++ b/xen/arch/ia64/xensetup.c	Tue Aug 30 17:51:51 2005 -0600
     6.3 @@ -260,6 +260,41 @@ printk("About to call xen_time_init()\n"
     6.4  printk("About to call ac_timer_init()\n");
     6.5      ac_timer_init();
     6.6  // init_xen_time(); ???
     6.7 +
     6.8 +#ifdef CONFIG_SMP
     6.9 +    if ( opt_nosmp )
    6.10 +    {
    6.11 +        max_cpus = 0;
    6.12 +        smp_num_siblings = 1;
    6.13 +        //boot_cpu_data.x86_num_cores = 1;
    6.14 +    }
    6.15 +
    6.16 +    smp_prepare_cpus(max_cpus);
    6.17 +
    6.18 +    /* We aren't hotplug-capable yet. */
    6.19 +    //BUG_ON(!cpus_empty(cpu_present_map));
    6.20 +    for_each_cpu ( i )
    6.21 +        cpu_set(i, cpu_present_map);
    6.22 +
    6.23 +    //BUG_ON(!local_irq_is_enabled());
    6.24 +
    6.25 +printk("num_online_cpus=%d, max_cpus=%d\n",num_online_cpus(),max_cpus);
    6.26 +    for_each_present_cpu ( i )
    6.27 +    {
    6.28 +        if ( num_online_cpus() >= max_cpus )
    6.29 +            break;
    6.30 +        if ( !cpu_online(i) ) {
    6.31 +printk("About to call __cpu_up(%d)\n",i);
    6.32 +            __cpu_up(i);
    6.33 +	}
    6.34 +    }
    6.35 +
    6.36 +    printk("Brought up %ld CPUs\n", (long)num_online_cpus());
    6.37 +    smp_cpus_done(max_cpus);
    6.38 +#endif
    6.39 +
    6.40 +
    6.41 +	// FIXME: Should the following be swapped and moved later?
    6.42      schedulers_start();
    6.43      do_initcalls();
    6.44  printk("About to call sort_main_extable()\n");