]> xenbits.xensource.com Git - xen.git/commit
page_alloc: assert IRQs are enabled in heap alloc/free
authorDavid Vrabel <dvrabel@amazon.co.uk>
Tue, 26 Apr 2022 08:33:01 +0000 (10:33 +0200)
committerJulien Grall <jgrall@amazon.com>
Wed, 27 Apr 2022 08:52:12 +0000 (09:52 +0100)
commitfa6dc0879ffd3dffffaea2837953c7a8761a9ba0
treeb5165f258382e006a2de2550265e2df61d7795c5
parentfbd2445558beff90eb9607308f0845b18a7a2b5a
page_alloc: assert IRQs are enabled in heap alloc/free

Heap pages can only be safely allocated and freed with interrupts
enabled as they may require a TLB flush which may send IPIs (on x86).

Normally spinlock debugging would catch calls from the incorrect
context, but not from stop_machine_run() action functions as these are
called with spin lock debugging disabled.

Enhance the assertions in alloc_xenheap_pages() and
alloc_domheap_pages() to check interrupts are enabled. For consistency
the same asserts are used when freeing heap pages.

As an exception, when only 1 PCPU is online, allocations are permitted
with interrupts disabled as any TLB flushes would be local only. This
is necessary during early boot.

Signed-off-by: David Vrabel <dvrabel@amazon.co.uk>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/page_alloc.c