static char __initdata opt_badpage[100] = "";
string_param("badpage", opt_badpage);
+/*
+ * Heap allocations may need TLB flushes which may require IRQs to be
+ * enabled (except when only 1 PCPU is online).
+ */
+#define ASSERT_ALLOC_CONTEXT() \
+ ASSERT(!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1))
+
/*
* no-bootscrub -> Free pages are not zeroed during boot.
*/
{
struct page_info *pg;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
pg = alloc_heap_pages(MEMZONE_XEN, MEMZONE_XEN,
order, memflags | MEMF_no_scrub, NULL);
void free_xenheap_pages(void *v, unsigned int order)
{
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
if ( v == NULL )
return;
struct page_info *pg;
unsigned int i;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
if ( xenheap_bits && (memflags >> _MEMF_bits) > xenheap_bits )
memflags &= ~MEMF_bits(~0U);
struct page_info *pg;
unsigned int i;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
if ( v == NULL )
return;
{
mfn_t smfn, emfn;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
smfn = maddr_to_mfn(round_pgup(ps));
emfn = maddr_to_mfn(round_pgdown(pe));
unsigned int bits = memflags >> _MEMF_bits, zone_hi = NR_ZONES - 1;
unsigned int dma_zone;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
bits = domain_clamp_alloc_bitsize(memflags & MEMF_no_owner ? NULL : d,
bits ? : (BITS_PER_LONG+PAGE_SHIFT));
unsigned int i;
bool drop_dom_ref;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
if ( unlikely(is_xen_heap_page(pg)) )
{
{
struct page_info *pg;
- ASSERT(!in_irq());
+ ASSERT_ALLOC_CONTEXT();
pg = acquire_staticmem_pages(smfn, nr_mfns, memflags);
if ( !pg )