Skip to contentSkip to conversation

x86: defer a panic call during dom0 construction

PATCH New Jan Beulich 1 participant 1 message Jun 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: defer a panic call during dom0 construction

We should try to avoid to panic with interrupts disabled, as panic() may imply use of the call-function-IPI (in the case of opt_noreboot being set), which asserts that interrupts are enabled.

xen/arch/x86/domain_build.c +5 -1
Index: 2008-06-12/xen/arch/x86/domain_build.c
===================================================================
@@ -784,7 +784,7 @@ int __init construct_dom0(
     while ( pfn < nr_pages )
     {
         if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL )
-            panic("Not enough RAM for DOM0 reservation.\n");
+            break;
         while ( pfn < d->tot_pages )
         {
             mfn = page_to_mfn(page);
@@ -828,6 +828,10 @@ int __init construct_dom0(
     write_ptbase(current);
     local_irq_enable();
 
+    /* Must call panic() with interrupts enabled. */
+    if ( page == NULL )
+        panic("Not enough RAM for DOM0 reservation.\n");
+
 #if defined(__i386__)
     /* Destroy low mappings - they were only for our convenience. */
     zap_low_mappings(l2start);