ia64/xen-unstable

changeset 15017:63263d715d43

[IA64] Fix vcpu hotplug

When domain is saved and restored, the following message is printed out.
bind_ipi_to_irqhandler()/bind_virq_to_irqhandler() should be called
in process context. Move the call from cpu_init() to __cpu_init() like x86.

BUG: sleeping function called from invalid context at /src1/yamahata/hg/xen/ia64
/my150/compile/test-0/xen-ia64-unstable.hg/linux-2.6.18-xen/mm/slab.c:2901
in_atomic():0, irqs_disabled():1

Call Trace:
[<a00000010001b190>] show_stack+0x50/0xa0
sp=e0000000004ff8b0 bsp=e0000000004f9358
[<a00000010001b210>] dump_stack+0x30/0x60
sp=e0000000004ffa80 bsp=e0000000004f9340
[<a000000100070f40>] __might_sleep+0x2c0/0x2e0
sp=e0000000004ffa80 bsp=e0000000004f9318
[<a00000010012c230>] __kmalloc+0xb0/0x320
sp=e0000000004ffa90 bsp=e0000000004f92e0
[<a0000001001a98d0>] proc_create+0x110/0x1c0
sp=e0000000004ffa90 bsp=e0000000004f9298
[<a0000001001a9ca0>] proc_mkdir_mode+0x40/0xe0
sp=e0000000004ffaa0 bsp=e0000000004f9268
[<a0000001001a9d70>] proc_mkdir+0x30/0x60
sp=e0000000004ffab0 bsp=e0000000004f9240
[<a0000001000e97e0>] register_handler_proc+0x1a0/0x1e0
sp=e0000000004ffab0 bsp=e0000000004f91f0
[<a0000001000e6420>] setup_irq+0x440/0x4e0
sp=e0000000004ffb30 bsp=e0000000004f9198
[<a0000001000e68c0>] request_irq+0x140/0x1a0
sp=e0000000004ffb30 bsp=e0000000004f9150
[<a0000001003e7a20>] bind_ipi_to_irqhandler+0x260/0x2c0
sp=e0000000004ffb30 bsp=e0000000004f90e8
[<a000000100019780>] xen_register_percpu_irq+0x2c0/0x880
sp=e0000000004ffb40 bsp=e0000000004f9098
[<a00000010001a1f0>] xen_smp_intr_init+0x170/0x1c0
sp=e0000000004ffb40 bsp=e0000000004f9070
[<a00000010003d350>] cpu_init+0x1090/0x10e0
sp=e0000000004ffb50 bsp=e0000000004f8fe0
[<a0000001000607a0>] start_secondary+0xc0/0x520
sp=e0000000004ffe30 bsp=e0000000004f8f90
[<a0000001000105f0>] __end_ivt_text+0x6d0/0x700
sp=e0000000004ffe30 bsp=e0000000004f8f90

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu May 03 14:38:26 2007 -0600 (2007-05-03)
parents f8aede89c706
children e60051ca408f
files linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Thu May 03 14:27:26 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Thu May 03 14:38:26 2007 -0600
     1.3 @@ -319,9 +319,9 @@ static struct irqaction resched_irqactio
     1.4   * required.
     1.5   */
     1.6  static void
     1.7 -xen_register_percpu_irq (unsigned int vec, struct irqaction *action, int save)
     1.8 +xen_register_percpu_irq(unsigned int cpu, unsigned int vec,
     1.9 +			 struct irqaction *action, int save)
    1.10  {
    1.11 -	unsigned int cpu = smp_processor_id();
    1.12  	irq_desc_t *desc;
    1.13  	int irq = 0;
    1.14  
    1.15 @@ -423,7 +423,8 @@ xen_bind_early_percpu_irq (void)
    1.16  	 * BSP will face with such step shortly
    1.17  	 */
    1.18  	for (i = 0; i < late_irq_cnt; i++)
    1.19 -		xen_register_percpu_irq(saved_percpu_irqs[i].irq,
    1.20 +		xen_register_percpu_irq(smp_processor_id(),
    1.21 +					saved_percpu_irqs[i].irq,
    1.22  		                        saved_percpu_irqs[i].action, 0);
    1.23  }
    1.24  
    1.25 @@ -479,11 +480,21 @@ static struct notifier_block unbind_evtc
    1.26  #endif
    1.27  
    1.28  DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
    1.29 +void xen_smp_intr_init_early(unsigned int cpu)
    1.30 +{
    1.31 +#ifdef CONFIG_SMP
    1.32 +	unsigned int i;
    1.33 +
    1.34 +	for (i = 0; i < saved_irq_cnt; i++)
    1.35 +		xen_register_percpu_irq(cpu, saved_percpu_irqs[i].irq,
    1.36 +		                        saved_percpu_irqs[i].action, 0);
    1.37 +#endif
    1.38 +}
    1.39 +
    1.40  void xen_smp_intr_init(void)
    1.41  {
    1.42  #ifdef CONFIG_SMP
    1.43  	unsigned int cpu = smp_processor_id();
    1.44 -	unsigned int i = 0;
    1.45  	struct callback_register event = {
    1.46  		.type = CALLBACKTYPE_event,
    1.47  		.address = (unsigned long)&xen_event_callback,
    1.48 @@ -500,12 +511,9 @@ void xen_smp_intr_init(void)
    1.49  
    1.50  	/* This should be piggyback when setup vcpu guest context */
    1.51  	BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
    1.52 -
    1.53 -	for (i = 0; i < saved_irq_cnt; i++)
    1.54 -		xen_register_percpu_irq(saved_percpu_irqs[i].irq,
    1.55 -		                        saved_percpu_irqs[i].action, 0);
    1.56  #endif /* CONFIG_SMP */
    1.57  }
    1.58 +
    1.59  #endif /* CONFIG_XEN */
    1.60  
    1.61  void
    1.62 @@ -516,7 +524,8 @@ register_percpu_irq (ia64_vector vec, st
    1.63  
    1.64  #ifdef CONFIG_XEN
    1.65  	if (is_running_on_xen())
    1.66 -		return xen_register_percpu_irq(vec, action, 1);
    1.67 +		return xen_register_percpu_irq(smp_processor_id(), 
    1.68 +					       vec, action, 1);
    1.69  #endif
    1.70  
    1.71  	for (irq = 0; irq < NR_IRQS; ++irq)
    1.72 @@ -572,6 +581,14 @@ ia64_send_ipi (int cpu, int vector, int 
    1.73  		/* TODO: we need to call vcpu_up here */
    1.74  		if (unlikely(vector == ap_wakeup_vector)) {
    1.75  			extern void xen_send_ipi (int cpu, int vec);
    1.76 +
    1.77 +			/* XXX
    1.78 +			 * This should be in __cpu_up(cpu) in ia64 smpboot.c
    1.79 +			 * like x86. But don't want to modify it,
    1.80 +			 * keep it untouched.
    1.81 +			 */
    1.82 +			xen_smp_intr_init_early(cpu);
    1.83 +
    1.84  			xen_send_ipi (cpu, vector);
    1.85  			//vcpu_prepare_and_up(cpu);
    1.86  			return;