]> xenbits.xensource.com Git - people/royger/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)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Apr 2022 08:33:01 +0000 (10:33 +0200)
commit88a037e2cfe11a723fe420d3585837ab1bdc6f8a
tree250a17346f3561a9365acf86a4fcf140d4dff6ab
parentc266f974148d3d1b21d01b8bb243017943786444
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