# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1178076393 -32400 # Node ID 56b8749f76d6a9ff5c6bb27f1e5650154b8ec441 # Parent a05b5a01b88ad708a32ffed6119b7a21a17ca97b 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: [] show_stack+0x50/0xa0 sp=e0000000004ff8b0 bsp=e0000000004f9358 [] dump_stack+0x30/0x60 sp=e0000000004ffa80 bsp=e0000000004f9340 [] __might_sleep+0x2c0/0x2e0 sp=e0000000004ffa80 bsp=e0000000004f9318 [] __kmalloc+0xb0/0x320 sp=e0000000004ffa90 bsp=e0000000004f92e0 [] proc_create+0x110/0x1c0 sp=e0000000004ffa90 bsp=e0000000004f9298 [] proc_mkdir_mode+0x40/0xe0 sp=e0000000004ffaa0 bsp=e0000000004f9268 [] proc_mkdir+0x30/0x60 sp=e0000000004ffab0 bsp=e0000000004f9240 [] register_handler_proc+0x1a0/0x1e0 sp=e0000000004ffab0 bsp=e0000000004f91f0 [] setup_irq+0x440/0x4e0 sp=e0000000004ffb30 bsp=e0000000004f9198 [] request_irq+0x140/0x1a0 sp=e0000000004ffb30 bsp=e0000000004f9150 [] bind_ipi_to_irqhandler+0x260/0x2c0 sp=e0000000004ffb30 bsp=e0000000004f90e8 [] xen_register_percpu_irq+0x2c0/0x880 sp=e0000000004ffb40 bsp=e0000000004f9098 [] xen_smp_intr_init+0x170/0x1c0 sp=e0000000004ffb40 bsp=e0000000004f9070 [] cpu_init+0x1090/0x10e0 sp=e0000000004ffb50 bsp=e0000000004f8fe0 [] start_secondary+0xc0/0x520 sp=e0000000004ffe30 bsp=e0000000004f8f90 [] __end_ivt_text+0x6d0/0x700 sp=e0000000004ffe30 bsp=e0000000004f8f90 PATCHNAME: fix_vcpu_hot_plug Signed-off-by: Isaku Yamahata diff -r a05b5a01b88a -r 56b8749f76d6 linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Tue May 01 15:12:00 2007 +0900 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c Wed May 02 12:26:33 2007 +0900 @@ -319,9 +319,9 @@ static struct irqaction resched_irqactio * required. */ static void -xen_register_percpu_irq (unsigned int vec, struct irqaction *action, int save) -{ - unsigned int cpu = smp_processor_id(); +xen_register_percpu_irq(unsigned int cpu, unsigned int vec, + struct irqaction *action, int save) +{ irq_desc_t *desc; int irq = 0; @@ -423,7 +423,8 @@ xen_bind_early_percpu_irq (void) * BSP will face with such step shortly */ for (i = 0; i < late_irq_cnt; i++) - xen_register_percpu_irq(saved_percpu_irqs[i].irq, + xen_register_percpu_irq(smp_processor_id(), + saved_percpu_irqs[i].irq, saved_percpu_irqs[i].action, 0); } @@ -479,11 +480,22 @@ static struct notifier_block unbind_evtc #endif DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]); +void xen_smp_intr_init_early(unsigned int cpu) +{ +#ifdef CONFIG_SMP + unsigned int i; + + for (i = 0; i < saved_irq_cnt; i++) + xen_register_percpu_irq(cpu, + saved_percpu_irqs[i].irq, + saved_percpu_irqs[i].action, 0); +#endif /* CONFIG_SMP */ +} + void xen_smp_intr_init(void) { #ifdef CONFIG_SMP unsigned int cpu = smp_processor_id(); - unsigned int i = 0; struct callback_register event = { .type = CALLBACKTYPE_event, .address = (unsigned long)&xen_event_callback, @@ -500,12 +512,9 @@ void xen_smp_intr_init(void) /* This should be piggyback when setup vcpu guest context */ BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event)); - - for (i = 0; i < saved_irq_cnt; i++) - xen_register_percpu_irq(saved_percpu_irqs[i].irq, - saved_percpu_irqs[i].action, 0); #endif /* CONFIG_SMP */ } + #endif /* CONFIG_XEN */ void @@ -516,7 +525,8 @@ register_percpu_irq (ia64_vector vec, st #ifdef CONFIG_XEN if (is_running_on_xen()) - return xen_register_percpu_irq(vec, action, 1); + return xen_register_percpu_irq(smp_processor_id(), + vec, action, 1); #endif for (irq = 0; irq < NR_IRQS; ++irq) @@ -572,6 +582,14 @@ ia64_send_ipi (int cpu, int vector, int /* TODO: we need to call vcpu_up here */ if (unlikely(vector == ap_wakeup_vector)) { extern void xen_send_ipi (int cpu, int vec); + + /* XXX + * This should be in __cpu_up(cpu) in ia64 smpboot.c + * like x86. But don't want to modify it, + * keep it untouched. + */ + xen_smp_intr_init_early(cpu); + xen_send_ipi (cpu, vector); //vcpu_prepare_and_up(cpu); return;