make quick reboot work more reliably Reference: /n/atom/patch/applied/rebootrely Date: Thu May 29 01:25:25 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/main.c Thu May 29 01:25:18 2014 +++ /sys/src/nix/k10/main.c Thu May 29 01:25:19 2014 @@ -338,6 +338,7 @@ lapicpri(0xff); m->online = 0; adec(&active.nonline); + adec((int*)&sys->nmach); ndnr(); } @@ -354,10 +355,15 @@ synccons(); procwired(up, 0); - for(i = 1; i < active.nonline; i++) + /* + * assumptions abound that the set of processors is contiguous + * cf. procflushseg + */ + for(i = active.nonline - 1; i > 0; i--){ kproc("apshut", apshut, (void*)i); - while((a=active.nonline)>1) - monmwait(&active.nonline, a); + while((a=active.nonline) == i) + monmwait(&active.nonline, a); + } devtabshutdown(); pcireset(); @@ -376,7 +382,6 @@ f = UINT2PTR(REBOOTADDR); memmove(f, rebootcode, sizeof(rebootcode)); print("warp32...\n"); - coherence(); /* necessary */ f(PTR2UINT(entry), PADDR(code), size); }