git: 9front

Download patch

ref: d51b40513d1646390f14e4ec4c7e1e663efbda62
parent: 04a93463dd8553aadf876a091d0a8e35294f35ca
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu May 29 14:50:52 EDT 2014

pc, pc64: simplify reboot code

as we do system reset and reboot only from boot processor cpu0 now,
theres no need for active.rebooting conditional variable.
mpshutdown() will unconditionally park application processors and
and cpu0 boots the new kernel or calls mpshutdown() causing system
reset.

--- a/sys/src/9/pc/dat.h
+++ b/sys/src/9/pc/dat.h
@@ -279,7 +279,6 @@
 	int	exiting;		/* shutdown */
 	int	ispanic;		/* shutdown in response to a panic */
 	int	thunderbirdsarego;	/* lets the added processors continue to schedinit */
-	int	rebooting;		/* about to rebooting another kernel */
 }active;
 
 /*
--- a/sys/src/9/pc/main.c
+++ b/sys/src/9/pc/main.c
@@ -188,7 +188,6 @@
 
 	active.machs = 1;
 	active.exiting = 0;
-	active.rebooting = 0;
 }
 
 void
@@ -972,20 +971,7 @@
 		procwired(up, 0);
 		sched();
 	}
-
-	lock(&active);
-	active.rebooting = 1;
-	unlock(&active);
-
 	shutdown(0);
-
-	/*
-	 * should be the only processor running now
-	 */
-	if (m->machno != 0)
-		iprint("on cpu%d (not 0)!\n", m->machno);
-	if (active.machs)
-		iprint("still have active ap processors!\n");
 
 	iprint("shutting down...\n");
 	delay(200);
--- a/sys/src/9/pc/mp.c
+++ b/sys/src/9/pc/mp.c
@@ -623,7 +623,7 @@
 	/*
 	 * Park application processors.
 	 */
-	if(active.rebooting || m->machno != 0){
+	if(m->machno != 0){
 		splhi();
 		arch->introff();
 		idle();
--- a/sys/src/9/pc64/dat.h
+++ b/sys/src/9/pc64/dat.h
@@ -244,7 +244,6 @@
 	int	exiting;		/* shutdown */
 	int	ispanic;		/* shutdown in response to a panic */
 	int	thunderbirdsarego;	/* lets the added processors continue to schedinit */
-	int	rebooting;		/* about to rebooting another kernel */
 }active;
 
 /*
--- a/sys/src/9/pc64/main.c
+++ b/sys/src/9/pc64/main.c
@@ -291,7 +291,6 @@
 
 	active.machs = 1;
 	active.exiting = 0;
-	active.rebooting = 0;
 }
 
 
@@ -568,20 +567,7 @@
 		procwired(up, 0);
 		sched();
 	}
-
-	lock(&active);
-	active.rebooting = 1;
-	unlock(&active);
-
 	shutdown(0);
-
-	/*
-	 * should be the only processor running now
-	 */
-	if (m->machno != 0)
-		iprint("on cpu%d (not 0)!\n", m->machno);
-	if (active.machs)
-		iprint("still have active ap processors!\n");
 
 	iprint("shutting down...\n");
 	delay(200);
--