x86: introduce and use scratch CPU mask
authorJan Beulich <jbeulich@suse.com>
Fri, 16 Dec 2016 13:34:34 +0000 (14:34 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 Dec 2016 13:34:34 +0000 (14:34 +0100)
commit3b6172645880f6324d0394d0d707f5d76b69ae1f
tree5b229e3befbfc6e621af1528164f098693e63dbe
parent7f885a1f49a75c770360b030666a5c1545156e5c
x86: introduce and use scratch CPU mask

__get_page_type(), so far using an on-stack CPU mask variable, is
involved in recursion when e.g. pinning page tables. This means there
may be up to five instances of the function active at a time, implying
five instances of the (up to 512 bytes large) CPU mask variable. An IRQ
happening at the deepest point of the stack has been observed to cause
a stack overflow with a 4095-pCPU build, when the IRQ handling results
in send_guest_pirq() being called (leading to vcpu_kick() -> ... ->
csched_vcpu_wake() -> __runq_tickle() -> cpumask_raise_softirq(), the
last two of which also have CPU mask variables on their stacks).

Introduce a per-CPU variable instead, which can then be used by any
code never running in IRQ context.

The mask can then also be used by other MMU code as well as by
msi_compose_msg() (and quite likely we'll find further uses down the
road).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c
xen/arch/x86/msi.c
xen/arch/x86/smpboot.c
xen/include/asm-x86/smp.h