]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Revert "page_alloc: assert IRQs are enabled in heap alloc/free"
authorJulien Grall <jgrall@amazon.com>
Fri, 29 Apr 2022 09:04:40 +0000 (10:04 +0100)
committerJulien Grall <jgrall@amazon.com>
Fri, 29 Apr 2022 09:04:40 +0000 (10:04 +0100)
This reverts commit fa6dc0879ffd3dffffaea2837953c7a8761a9ba0 as there
are more fallout on Arm.g

xen/common/page_alloc.c

index e866e0d864698eb9e07387177f3abf07ef5ccb66..319029140f3040a4a4f5c425122bb80852d626e6 100644 (file)
 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.
  */
@@ -2167,7 +2160,7 @@ void *alloc_xenheap_pages(unsigned int order, unsigned int memflags)
 {
     struct page_info *pg;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     pg = alloc_heap_pages(MEMZONE_XEN, MEMZONE_XEN,
                           order, memflags | MEMF_no_scrub, NULL);
@@ -2180,7 +2173,7 @@ void *alloc_xenheap_pages(unsigned int order, unsigned int memflags)
 
 void free_xenheap_pages(void *v, unsigned int order)
 {
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     if ( v == NULL )
         return;
@@ -2209,7 +2202,7 @@ void *alloc_xenheap_pages(unsigned int order, unsigned int memflags)
     struct page_info *pg;
     unsigned int i;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     if ( xenheap_bits && (memflags >> _MEMF_bits) > xenheap_bits )
         memflags &= ~MEMF_bits(~0U);
@@ -2231,7 +2224,7 @@ void free_xenheap_pages(void *v, unsigned int order)
     struct page_info *pg;
     unsigned int i;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     if ( v == NULL )
         return;
@@ -2256,7 +2249,7 @@ void init_domheap_pages(paddr_t ps, paddr_t pe)
 {
     mfn_t smfn, emfn;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     smfn = maddr_to_mfn(round_pgup(ps));
     emfn = maddr_to_mfn(round_pgdown(pe));
@@ -2376,7 +2369,7 @@ struct page_info *alloc_domheap_pages(
     unsigned int bits = memflags >> _MEMF_bits, zone_hi = NR_ZONES - 1;
     unsigned int dma_zone;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     bits = domain_clamp_alloc_bitsize(memflags & MEMF_no_owner ? NULL : d,
                                       bits ? : (BITS_PER_LONG+PAGE_SHIFT));
@@ -2426,7 +2419,7 @@ void free_domheap_pages(struct page_info *pg, unsigned int order)
     unsigned int i;
     bool drop_dom_ref;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     if ( unlikely(is_xen_heap_page(pg)) )
     {
@@ -2745,7 +2738,7 @@ int __init acquire_domstatic_pages(struct domain *d, mfn_t smfn,
 {
     struct page_info *pg;
 
-    ASSERT_ALLOC_CONTEXT();
+    ASSERT(!in_irq());
 
     pg = acquire_staticmem_pages(smfn, nr_mfns, memflags);
     if ( !pg )