ref: 5104934135feec1bfb2c1543028fe40bb4a41573
parent: 812383473cea9b53cf3c8ff138489a3d10d65f44
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Mar 11 11:24:56 EST 2017
pc kernel: avoid AP's spinning in syncclock(), don't wait for thunderbirdsargo
--- a/sys/src/9/pc/squidboy.c
+++ b/sys/src/9/pc/squidboy.c
@@ -12,30 +12,17 @@
squidboy(Apic* apic)
{
// iprint("Hello Squidboy\n");
-
machinit();
mmuinit();
-
cpuidentify();
cpuidprint();
-
+ syncclock();
+ active.machs[m->machno] = 1;
apic->online = 1;
- coherence();
-
lapicinit(apic);
lapiconline();
- syncclock();
timersinit();
-
fpoff();
-
- lock(&active);
- active.machs[m->machno] = 1;
- unlock(&active);
-
- while(!active.thunderbirdsarego)
- microdelay(100);
-
schedinit();
}
@@ -107,10 +94,12 @@
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP));
- for(i = 0; i < 1000; i++){
+ for(i = 0; i < 100000; i++){
+ if(arch->fastclock == tscticks)
+ cycles(&m->tscticks); /* for ap's syncclock(); */
if(apic->online)
break;
- delay(10);
+ delay(1);
}
nvramwrite(0x0F, 0x00);
}
--- a/sys/src/9/pc64/squidboy.c
+++ b/sys/src/9/pc64/squidboy.c
@@ -15,21 +15,12 @@
mmuinit();
cpuidentify();
cpuidprint();
+ syncclock();
+ active.machs[m->machno] = 1;
apic->online = 1;
- coherence();
-
lapicinit(apic);
lapiconline();
- syncclock();
timersinit();
-
- lock(&active);
- active.machs[m->machno] = 1;
- unlock(&active);
-
- while(!active.thunderbirdsarego)
- microdelay(100);
-
schedinit();
}
@@ -102,10 +93,12 @@
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP));
- for(i = 0; i < 1000; i++){
+ for(i = 0; i < 100000; i++){
+ if(arch->fastclock == tscticks)
+ cycles(&m->tscticks); /* for ap's syncclock(); */
if(apic->online)
break;
- delay(10);
+ delay(1);
}
nvramwrite(0x0F, 0x00);
}