[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/3] xen: cpupools: avoid crashing if shutting down with free CPUs

On 05/06/2015 05:10 PM, Dario Faggioli wrote:
in fact, before this change, shutting down or suspending the
system with some CPUs not assigned to any cpupool, would
crash as follows:

   (XEN) Xen call trace:
   (XEN)    [<ffff82d080101757>] disable_nonboot_cpus+0xb5/0x138
   (XEN)    [<ffff82d0801a8824>] enter_state_helper+0xbd/0x369
   (XEN)    [<ffff82d08010614a>] continue_hypercall_tasklet_handler+0x4a/0xb1
   (XEN)    [<ffff82d0801320bd>] do_tasklet_work+0x78/0xab
   (XEN)    [<ffff82d0801323f3>] do_tasklet+0x5e/0x8a
   (XEN)    [<ffff82d080163cb6>] idle_loop+0x56/0x6b
   (XEN) ****************************************
   (XEN) Panic on CPU 0:
   (XEN) Xen BUG at cpu.c:191
   (XEN) ****************************************

This is because, for free CPUs, -EBUSY were being returned
when trying to tear them down, making cpu_down() unhappy.

It is certainly unpractical to forbid shutting down or
suspenging if there are unassigned CPUs, so this change
fixes the above by just avoiding returning -EBUSY for those
CPUs. If shutting off, that does not matter much anyway. If
suspending, we make sure that the CPUs remain unassigned
when resuming.

While there, take the chance to:
  - fix the doc comment of cpupool_cpu_remove() (it was
  - improve comments in general around and in cpupool_cpu_remove()
    and cpupool_cpu_add();
  - add a couple of ASSERT()-s for checking consistency.

I did a test with the patches applied.

# xl cpupool-cpu-remove Pool-0 2
# echo mem >/sys/power/state

When resuming this resulted in:

(XEN) mce_intel.c:735: MCA Capability: BCAST 1 SER 0 CMCI 1 firstbank 0 extended MCE MSR 0
(XEN) CPU0 CMCI LVT vector (0xf2) already installed
(XEN) Finishing wakeup from ACPI S3 state.
(XEN) Enabling non-boot CPUs  ...
(XEN) Xen BUG at cpu.c:149
(XEN) ----[ Xen-4.6-unstable  x86_64  debug=y  Tainted:    C ]----
(XEN) CPU:    0
(XEN) RIP:    e008:[<ffff82d080101531>] cpu_up+0xaf/0xfe
(XEN) RFLAGS: 0000000000010202   CONTEXT: hypervisor
(XEN) rax: 0000000000008016   rbx: 0000000000000000   rcx: 0000000000000000
(XEN) rdx: ffff82d0802e0000   rsi: 0000000000000004   rdi: ffff82d080296488
(XEN) rbp: ffff82d0802e7e00   rsp: ffff82d0802e7de0   r8:  0000000000081000
(XEN) r9:  ffff82d15ba99600   r10: 00000000dba99600   r11: ffff82d080299600
(XEN) r12: 0000000000000002   r13: ffff82d08025cf6c   r14: 0000000000000002
(XEN) r15: ffff82d0802e0000   cr0: 000000008005003b   cr4: 00000000001526f0
(XEN) cr3: 00000000dba94000   cr2: 0000000000000000
(XEN) ds: 0018   es: 0010   fs: 8100   gs: 0010   ss: e010   cs: e008
(XEN) Xen stack trace from rsp=ffff82d0802e7de0:
(XEN)    ffff82d0802e0000 ffff82d080297360 0000000000000002 0000000000000004
(XEN)    ffff82d0802e7e30 ffff82d080101733 0000000000000003 0000000000000000
(XEN)    ffff82d080329130 00000000001526f0 ffff82d0802e7e80 ffff82d0801a6a8d
(XEN)    ffff82d0802e7e60 0000000000000282 ffff82d080328de8 ffff8301351c4fd0
(XEN)    ffff8300d8758000 ffff82d080328ec0 ffff82d080328de8 ffffffffffffffff
(XEN)    ffff82d0802e7ea0 ffff82d08010615f ffff8300d87581c8 0000000000000000
(XEN)    ffff82d0802e7ec0 ffff82d08013101d ffff82d08012ebc4 ffff82d080328ed0
(XEN)    ffff82d0802e7ef0 ffff82d08013134c 00000021dc728d2c ffff82d0802e0000
(XEN)    00000021dc728d2c ffff8300dbcf0000 ffff82d0802e7f10 ffff82d080161bcb
(XEN)    ffff82d08012e37a ffff8300dbcf0000 ffff82d0802e7e10 ffff8801fa5e8000
(XEN)    ffff8801fa5e8000 ffff8801fa5e8000 0000000000000000 0000000000000000
(XEN)    ffffffff818cb700 0000000000000246 0000000000000017 0000000000000007
(XEN)    000000000000e3b8 0000000000000000 ffffffff8100130a 00000000deadbeef
(XEN)    00000000deadbeef 00000000deadbeef 0000010000000000 ffffffff8100130a
(XEN)    000000000000e033 0000000000000246 ffff8801fa5ebed8 000000000000e02b
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 ffff8300dbcf0000 0000000000000000 0000000000000000
(XEN) Xen call trace:
(XEN)    [<ffff82d080101531>] cpu_up+0xaf/0xfe
(XEN)    [<ffff82d080101733>] enable_nonboot_cpus+0x4f/0xfc
(XEN)    [<ffff82d0801a6a8d>] enter_state_helper+0x2cb/0x370
(XEN)    [<ffff82d08010615f>] continue_hypercall_tasklet_handler+0x4a/0xb1
(XEN)    [<ffff82d08013101d>] do_tasklet_work+0x78/0xab
(XEN)    [<ffff82d08013134c>] do_tasklet+0x5e/0x8a
(XEN)    [<ffff82d080161bcb>] idle_loop+0x56/0x70
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at cpu.c:149
(XEN) ****************************************


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.