shithub: riscv

Download patch

ref: 52464166216095a5747f7541eff179ecf8d94e1f
parent: 215f6cc64a65efbe0a71b8fdba72311201aca4fc
author: cinap_lenrek <[email protected]>
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);