1 From 66ff0fe9e7bda8aec99985b24daad03652f7304e Mon Sep 17 00:00:00 2001
2 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
3 Date: Tue, 16 Apr 2013 14:08:50 -0400
4 Subject: xen/smp/spinlock: Fix leakage of the spinlock interrupt line for every CPU online/offline
6 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
8 commit 66ff0fe9e7bda8aec99985b24daad03652f7304e upstream.
10 While we don't use the spinlock interrupt line (see for details
11 commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23 -
12 xen: disable PV spinlocks on HVM) - we should still do the proper
13 init / deinit sequence. We did not do that correctly and for the
14 CPU init for PVHVM guest we would allocate an interrupt line - but
15 failed to deallocate the old interrupt line.
17 This resulted in leakage of an irq_desc but more importantly this splat
18 as we online an offlined CPU:
20 genirq: Flags mismatch irq 71. 0002cc20 (spinlock1) vs. 0002cc20 (spinlock1)
21 Pid: 2542, comm: init.late Not tainted 3.9.0-rc6upstream #1
23 [<ffffffff811156de>] __setup_irq+0x23e/0x4a0
24 [<ffffffff81194191>] ? kmem_cache_alloc_trace+0x221/0x250
25 [<ffffffff811161bb>] request_threaded_irq+0xfb/0x160
26 [<ffffffff8104c6f0>] ? xen_spin_trylock+0x20/0x20
27 [<ffffffff813a8423>] bind_ipi_to_irqhandler+0xa3/0x160
28 [<ffffffff81303758>] ? kasprintf+0x38/0x40
29 [<ffffffff8104c6f0>] ? xen_spin_trylock+0x20/0x20
30 [<ffffffff810cad35>] ? update_max_interval+0x15/0x40
31 [<ffffffff816605db>] xen_init_lock_cpu+0x3c/0x78
32 [<ffffffff81660029>] xen_hvm_cpu_notify+0x29/0x33
33 [<ffffffff81676bdd>] notifier_call_chain+0x4d/0x70
34 [<ffffffff810bb2a9>] __raw_notifier_call_chain+0x9/0x10
35 [<ffffffff8109402b>] __cpu_notify+0x1b/0x30
36 [<ffffffff8166834a>] _cpu_up+0xa0/0x14b
37 [<ffffffff816684ce>] cpu_up+0xd9/0xec
38 [<ffffffff8165f754>] store_online+0x94/0xd0
39 [<ffffffff8141d15b>] dev_attr_store+0x1b/0x20
40 [<ffffffff81218f44>] sysfs_write_file+0xf4/0x170
41 [<ffffffff811a2864>] vfs_write+0xb4/0x130
42 [<ffffffff811a302a>] sys_write+0x5a/0xa0
43 [<ffffffff8167ada9>] system_call_fastpath+0x16/0x1b
44 cpu 1 spinlock event irq -16
45 smpboot: Booting Node 0 Processor 1 APIC 0x2
47 And if one looks at the /proc/interrupts right after
50 70: 0 0 xen-percpu-ipi spinlock0
51 71: 0 0 xen-percpu-ipi spinlock1
52 77: 0 0 xen-percpu-ipi spinlock2
54 There is the oddity of the 'spinlock1' still being present.
56 Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
57 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
60 arch/x86/xen/smp.c | 1 +
61 1 file changed, 1 insertion(+)
63 --- a/arch/x86/xen/smp.c
64 +++ b/arch/x86/xen/smp.c
65 @@ -662,6 +662,7 @@ static void xen_hvm_cpu_die(unsigned int
66 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
67 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
68 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
69 + xen_uninit_lock_cpu(cpu);
70 xen_teardown_timer(cpu);