Skip to contentSkip to conversation

get_current() called before set_current()

PATCH In review Charles Coffing 2 participants 2 messages Aug 31, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get_current() called before set_current()

The recent change that added debugging to spinlocks (cset 1.1278.1.1) caused get_current() to be called earlier in the boot process. In fact, it is now called before set_current().

If assertions are compiled in, this ultimately causes a triple fault when Xen tries to print the banner. If assertions aren't compiled in, memory corruption results (although currently this corruption appears to be benign.)

The attached patch moves the first set_current() call a bit earlier in the boot process.

Thanks,
Charles

xen/common/kernel.c +3 -2
@@ -183,6 +183,9 @@
         }
     }
 
+    /* Must do this early -- e.g., spinlocks rely on get_current(). */
+    set_current(&idle0_task);
+
     /* We initialise the serial devices very early so we can get debugging. */
     serial_init_stage1();
 
@@ -218,8 +221,6 @@
         for ( ; ; ) ;
     }
 
-    set_current(&idle0_task);
-
     xenheap_phys_end = opt_xenheap_megabytes << 20;
 
     max_mem = max_page = (mbi->mem_upper+1024) >> (PAGE_SHIFT - 10);
#1 lore raw

Thanks, I've checked it in.

It's interesting that noone in Cambridge saw the problem when using a debug build. My guess is that we only ever momentarily cycle the power on our test boxes, and the stack happens to live in an area of memory untouched by our boot process. :-)

-- Keir

Quoted 11 lines

The recent change that added debugging to spinlocks (cset 1.1278.1.1) caused get_current() to be called earlier in the boot process. In fact, it is now called before set_current().

If assertions are compiled in, this ultimately causes a triple fault when Xen tries to print the banner. If assertions aren't compiled in, memory corruption results (although currently this corruption appears to be benign.)

The attached patch moves the first set_current() call a bit earlier in the boot process.

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click