direct-io.hg

changeset 12792:cf11417d7eb6

Merge
author Alastair Tse <atse@xensource.com>
date Thu Dec 07 16:48:23 2006 +0000 (2006-12-07)
parents 84580e109557 ff5f976191a5
children 6a6748da2039
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Thu Dec 07 16:43:22 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Thu Dec 07 16:48:23 2006 +0000
     1.3 @@ -1047,9 +1047,9 @@ void time_resume(void)
     1.4  #ifdef CONFIG_SMP
     1.5  static char timer_name[NR_CPUS][15];
     1.6  
     1.7 -void local_setup_timer(unsigned int cpu)
     1.8 +int local_setup_timer(unsigned int cpu)
     1.9  {
    1.10 -	int seq;
    1.11 +	int seq, irq;
    1.12  
    1.13  	BUG_ON(cpu == 0);
    1.14  
    1.15 @@ -1062,15 +1062,17 @@ void local_setup_timer(unsigned int cpu)
    1.16  	} while (read_seqretry(&xtime_lock, seq));
    1.17  
    1.18  	sprintf(timer_name[cpu], "timer%d", cpu);
    1.19 -	per_cpu(timer_irq, cpu) =
    1.20 -		bind_virq_to_irqhandler(
    1.21 -			VIRQ_TIMER,
    1.22 -			cpu,
    1.23 -			timer_interrupt,
    1.24 -			SA_INTERRUPT,
    1.25 -			timer_name[cpu],
    1.26 -			NULL);
    1.27 -	BUG_ON(per_cpu(timer_irq, cpu) < 0);
    1.28 +	irq = bind_virq_to_irqhandler(VIRQ_TIMER,
    1.29 +				      cpu,
    1.30 +				      timer_interrupt,
    1.31 +				      SA_INTERRUPT,
    1.32 +				      timer_name[cpu],
    1.33 +				      NULL);
    1.34 +	if (irq < 0)
    1.35 +		return irq;
    1.36 +	per_cpu(timer_irq, cpu) = irq;
    1.37 +
    1.38 +	return 0;
    1.39  }
    1.40  
    1.41  void local_teardown_timer(unsigned int cpu)
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Thu Dec 07 16:43:22 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Thu Dec 07 16:48:23 2006 +0000
     2.3 @@ -251,8 +251,15 @@ static int find_unbound_irq(void)
     2.4  		if (irq_bindcount[irq] == 0)
     2.5  			break;
     2.6  
     2.7 -	if (irq == NR_IRQS)
     2.8 -		panic("No available IRQ to bind to: increase NR_IRQS!\n");
     2.9 +	if (irq == NR_IRQS) {
    2.10 +		static int warned;
    2.11 +		if (!warned) {
    2.12 +			warned = 1;
    2.13 +			printk(KERN_WARNING "No available IRQ to bind to: "
    2.14 +			       "increase NR_IRQS!\n");
    2.15 +		}
    2.16 +		return -ENOSPC;
    2.17 +	}
    2.18  
    2.19  	return irq;
    2.20  }
    2.21 @@ -264,15 +271,17 @@ static int bind_evtchn_to_irq(unsigned i
    2.22  	spin_lock(&irq_mapping_update_lock);
    2.23  
    2.24  	if ((irq = evtchn_to_irq[evtchn]) == -1) {
    2.25 -		irq = find_unbound_irq();
    2.26 +		if ((irq = find_unbound_irq()) < 0)
    2.27 +			goto out;
    2.28 +
    2.29  		evtchn_to_irq[evtchn] = irq;
    2.30  		irq_info[irq] = mk_irq_info(IRQT_EVTCHN, 0, evtchn);
    2.31  	}
    2.32  
    2.33  	irq_bindcount[irq]++;
    2.34  
    2.35 + out:
    2.36  	spin_unlock(&irq_mapping_update_lock);
    2.37 -
    2.38  	return irq;
    2.39  }
    2.40  
    2.41 @@ -284,6 +293,9 @@ static int bind_virq_to_irq(unsigned int
    2.42  	spin_lock(&irq_mapping_update_lock);
    2.43  
    2.44  	if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
    2.45 +		if ((irq = find_unbound_irq()) < 0)
    2.46 +			goto out;
    2.47 +
    2.48  		bind_virq.virq = virq;
    2.49  		bind_virq.vcpu = cpu;
    2.50  		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
    2.51 @@ -291,7 +303,6 @@ static int bind_virq_to_irq(unsigned int
    2.52  			BUG();
    2.53  		evtchn = bind_virq.port;
    2.54  
    2.55 -		irq = find_unbound_irq();
    2.56  		evtchn_to_irq[evtchn] = irq;
    2.57  		irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
    2.58  
    2.59 @@ -302,8 +313,8 @@ static int bind_virq_to_irq(unsigned int
    2.60  
    2.61  	irq_bindcount[irq]++;
    2.62  
    2.63 + out:
    2.64  	spin_unlock(&irq_mapping_update_lock);
    2.65 -
    2.66  	return irq;
    2.67  }
    2.68  
    2.69 @@ -315,13 +326,15 @@ static int bind_ipi_to_irq(unsigned int 
    2.70  	spin_lock(&irq_mapping_update_lock);
    2.71  
    2.72  	if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) {
    2.73 +		if ((irq = find_unbound_irq()) < 0)
    2.74 +			goto out;
    2.75 +
    2.76  		bind_ipi.vcpu = cpu;
    2.77  		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
    2.78  						&bind_ipi) != 0)
    2.79  			BUG();
    2.80  		evtchn = bind_ipi.port;
    2.81  
    2.82 -		irq = find_unbound_irq();
    2.83  		evtchn_to_irq[evtchn] = irq;
    2.84  		irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn);
    2.85  
    2.86 @@ -332,8 +345,8 @@ static int bind_ipi_to_irq(unsigned int 
    2.87  
    2.88  	irq_bindcount[irq]++;
    2.89  
    2.90 + out:
    2.91  	spin_unlock(&irq_mapping_update_lock);
    2.92 -
    2.93  	return irq;
    2.94  }
    2.95  
    2.96 @@ -383,6 +396,9 @@ int bind_evtchn_to_irqhandler(
    2.97  	int retval;
    2.98  
    2.99  	irq = bind_evtchn_to_irq(evtchn);
   2.100 +	if (irq < 0)
   2.101 +		return irq;
   2.102 +
   2.103  	retval = request_irq(irq, handler, irqflags, devname, dev_id);
   2.104  	if (retval != 0) {
   2.105  		unbind_from_irq(irq);
   2.106 @@ -405,6 +421,9 @@ int bind_virq_to_irqhandler(
   2.107  	int retval;
   2.108  
   2.109  	irq = bind_virq_to_irq(virq, cpu);
   2.110 +	if (irq < 0)
   2.111 +		return irq;
   2.112 +
   2.113  	retval = request_irq(irq, handler, irqflags, devname, dev_id);
   2.114  	if (retval != 0) {
   2.115  		unbind_from_irq(irq);
   2.116 @@ -427,6 +446,9 @@ int bind_ipi_to_irqhandler(
   2.117  	int retval;
   2.118  
   2.119  	irq = bind_ipi_to_irq(ipi, cpu);
   2.120 +	if (irq < 0)
   2.121 +		return irq;
   2.122 +
   2.123  	retval = request_irq(irq, handler, irqflags, devname, dev_id);
   2.124  	if (retval != 0) {
   2.125  		unbind_from_irq(irq);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Thu Dec 07 16:43:22 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Thu Dec 07 16:48:23 2006 +0000
     3.3 @@ -33,7 +33,7 @@
     3.4  extern irqreturn_t smp_reschedule_interrupt(int, void *, struct pt_regs *);
     3.5  extern irqreturn_t smp_call_function_interrupt(int, void *, struct pt_regs *);
     3.6  
     3.7 -extern void local_setup_timer(unsigned int cpu);
     3.8 +extern int local_setup_timer(unsigned int cpu);
     3.9  extern void local_teardown_timer(unsigned int cpu);
    3.10  
    3.11  extern void hypervisor_callback(void);
    3.12 @@ -110,32 +110,45 @@ set_cpu_sibling_map(int cpu)
    3.13  	cpu_data[cpu].booted_cores = 1;
    3.14  }
    3.15  
    3.16 -static void xen_smp_intr_init(unsigned int cpu)
    3.17 +static int xen_smp_intr_init(unsigned int cpu)
    3.18  {
    3.19 +	int rc;
    3.20 +
    3.21 +	per_cpu(resched_irq, cpu) = per_cpu(callfunc_irq, cpu) = -1;
    3.22 +
    3.23  	sprintf(resched_name[cpu], "resched%d", cpu);
    3.24 -	per_cpu(resched_irq, cpu) =
    3.25 -		bind_ipi_to_irqhandler(
    3.26 -			RESCHEDULE_VECTOR,
    3.27 -			cpu,
    3.28 -			smp_reschedule_interrupt,
    3.29 -			SA_INTERRUPT,
    3.30 -			resched_name[cpu],
    3.31 -			NULL);
    3.32 -	BUG_ON(per_cpu(resched_irq, cpu) < 0);
    3.33 +	rc = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR,
    3.34 +				    cpu,
    3.35 +				    smp_reschedule_interrupt,
    3.36 +				    SA_INTERRUPT,
    3.37 +				    resched_name[cpu],
    3.38 +				    NULL);
    3.39 +	if (rc < 0)
    3.40 +		goto fail;
    3.41 +	per_cpu(resched_irq, cpu) = rc;
    3.42  
    3.43  	sprintf(callfunc_name[cpu], "callfunc%d", cpu);
    3.44 -	per_cpu(callfunc_irq, cpu) =
    3.45 -		bind_ipi_to_irqhandler(
    3.46 -			CALL_FUNCTION_VECTOR,
    3.47 -			cpu,
    3.48 -			smp_call_function_interrupt,
    3.49 -			SA_INTERRUPT,
    3.50 -			callfunc_name[cpu],
    3.51 -			NULL);
    3.52 -	BUG_ON(per_cpu(callfunc_irq, cpu) < 0);
    3.53 +	rc = bind_ipi_to_irqhandler(CALL_FUNCTION_VECTOR,
    3.54 +				    cpu,
    3.55 +				    smp_call_function_interrupt,
    3.56 +				    SA_INTERRUPT,
    3.57 +				    callfunc_name[cpu],
    3.58 +				    NULL);
    3.59 +	if (rc < 0)
    3.60 +		goto fail;
    3.61 +	per_cpu(callfunc_irq, cpu) = rc;
    3.62  
    3.63 -	if (cpu != 0)
    3.64 -		local_setup_timer(cpu);
    3.65 +	if ((cpu != 0) && ((rc = local_setup_timer(cpu)) != 0))
    3.66 +		goto fail;
    3.67 +
    3.68 +	return 0;
    3.69 +
    3.70 + fail:
    3.71 +	if (per_cpu(resched_irq, cpu) >= 0)
    3.72 +		unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL);
    3.73 +	if (per_cpu(callfunc_irq, cpu) >= 0)
    3.74 +		unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL);
    3.75 +	return rc;
    3.76  }
    3.77  
    3.78  #ifdef CONFIG_HOTPLUG_CPU
    3.79 @@ -253,7 +266,8 @@ void __init smp_prepare_cpus(unsigned in
    3.80  
    3.81  	set_cpu_sibling_map(0);
    3.82  
    3.83 -	xen_smp_intr_init(0);
    3.84 +	if (xen_smp_intr_init(0))
    3.85 +		BUG();
    3.86  
    3.87  	/* Restrict the possible_map according to max_cpus. */
    3.88  	while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
    3.89 @@ -419,7 +433,13 @@ int __devinit __cpu_up(unsigned int cpu)
    3.90  	set_cpu_sibling_map(cpu);
    3.91  	wmb();
    3.92  
    3.93 -	xen_smp_intr_init(cpu);
    3.94 +
    3.95 +	rc = xen_smp_intr_init(cpu);
    3.96 +	if (rc) {
    3.97 +		remove_siblinginfo(cpu);
    3.98 +		return rc;
    3.99 +	}
   3.100 +
   3.101  	cpu_set(cpu, cpu_online_map);
   3.102  
   3.103  	rc = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL);
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Dec 07 16:43:22 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Dec 07 16:48:23 2006 +0000
     4.3 @@ -1506,13 +1506,12 @@ static int __init netback_init(void)
     4.4  	netif_xenbus_init();
     4.5  
     4.6  #ifdef NETBE_DEBUG_INTERRUPT
     4.7 -	(void)bind_virq_to_irqhandler(
     4.8 -		VIRQ_DEBUG,
     4.9 -		0,
    4.10 -		netif_be_dbg,
    4.11 -		SA_SHIRQ, 
    4.12 -		"net-be-dbg",
    4.13 -		&netif_be_dbg);
    4.14 +	(void)bind_virq_to_irqhandler(VIRQ_DEBUG,
    4.15 +				      0,
    4.16 +				      netif_be_dbg,
    4.17 +				      SA_SHIRQ, 
    4.18 +				      "net-be-dbg",
    4.19 +				      &netif_be_dbg);
    4.20  #endif
    4.21  
    4.22  	return 0;