This commit is contained in:
cinap_lenrek 2017-03-11 20:42:25 +01:00
commit 5b7a62e5e6
20 changed files with 29 additions and 51 deletions

View file

@ -222,7 +222,6 @@ typedef void KMap;
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active CPUs */ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
}active; }active;

View file

@ -193,7 +193,6 @@ typedef void KMap;
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active CPUs */ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
}active; }active;

View file

@ -180,7 +180,6 @@ struct Mach
struct struct
{ {
Lock;
char machs[MAXMACH]; char machs[MAXMACH];
int exiting; int exiting;
}active; }active;

View file

@ -215,7 +215,6 @@ typedef void KMap;
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active CPUs */ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
}active; }active;

View file

@ -141,7 +141,7 @@ lapiconline(void)
} }
/* /*
* use the i8253 clock to figure out our lapic timer rate. * use the i8253/tsc clock to figure out our lapic timer rate.
*/ */
static void static void
lapictimerinit(void) lapictimerinit(void)
@ -150,6 +150,11 @@ lapictimerinit(void)
Apictimer *a; Apictimer *a;
int s; int s;
if(m->machno != 0){
lapictimer[m->machno] = lapictimer[0];
return;
}
s = splhi(); s = splhi();
a = &lapictimer[m->machno]; a = &lapictimer[m->machno];
a->tdx = 0; a->tdx = 0;

View file

@ -269,10 +269,8 @@ void kunmap(KMap*);
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active CPUs */ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active; }active;
/* /*

View file

@ -130,6 +130,13 @@ guesscpuhz(int aalcycles)
int loops, x, y; int loops, x, y;
uvlong a, b, cpufreq; uvlong a, b, cpufreq;
if(m->machno != 0){
m->cpuhz = MACHP(0)->cpuhz;
m->cpumhz = MACHP(0)->cpumhz;
m->loopconst = MACHP(0)->loopconst;
return;
}
ilock(&i8253); ilock(&i8253);
for(loops = 1000;;loops += 1000) { for(loops = 1000;;loops += 1000) {
/* /*

View file

@ -167,7 +167,6 @@ main(void)
pageinit(); pageinit();
swapinit(); swapinit();
userinit(); userinit();
active.thunderbirdsarego = 1;
schedinit(); schedinit();
} }
@ -426,6 +425,7 @@ confinit(void)
if(userpcnt < 10) if(userpcnt < 10)
userpcnt = 70; userpcnt = 70;
kpages = conf.npage - (conf.npage*userpcnt)/100; kpages = conf.npage - (conf.npage*userpcnt)/100;
conf.nimage = conf.nproc;
/* /*
* Hack for the big boys. Only good while physmem < 4GB. * Hack for the big boys. Only good while physmem < 4GB.
@ -438,7 +438,6 @@ confinit(void)
if(getconf("*imagemaxmb") == 0) if(getconf("*imagemaxmb") == 0)
if(kpages > (64*MB + conf.npage*sizeof(Page))/BY2PG){ if(kpages > (64*MB + conf.npage*sizeof(Page))/BY2PG){
kpages = (64*MB + conf.npage*sizeof(Page))/BY2PG; kpages = (64*MB + conf.npage*sizeof(Page))/BY2PG;
conf.nimage = 2000;
kpages += (conf.nproc*KSTACK)/BY2PG; kpages += (conf.nproc*KSTACK)/BY2PG;
} }
} else { } else {

View file

@ -679,7 +679,7 @@ vunmap(void *v, int size)
* boot. In that case it suffices to flush the MACH(0) TLB * boot. In that case it suffices to flush the MACH(0) TLB
* and return. * and return.
*/ */
if(!active.thunderbirdsarego){ if(up == nil){
putcr3(PADDR(MACHP(0)->pdb)); putcr3(PADDR(MACHP(0)->pdb));
return; return;
} }

View file

@ -12,30 +12,17 @@ static void
squidboy(Apic* apic) squidboy(Apic* apic)
{ {
// iprint("Hello Squidboy\n"); // iprint("Hello Squidboy\n");
machinit(); machinit();
mmuinit(); mmuinit();
cpuidentify(); cpuidentify();
cpuidprint(); cpuidprint();
syncclock();
active.machs[m->machno] = 1;
apic->online = 1; apic->online = 1;
coherence();
lapicinit(apic); lapicinit(apic);
lapiconline(); lapiconline();
syncclock();
timersinit(); timersinit();
fpoff(); fpoff();
lock(&active);
active.machs[m->machno] = 1;
unlock(&active);
while(!active.thunderbirdsarego)
microdelay(100);
schedinit(); schedinit();
} }
@ -107,10 +94,12 @@ mpstartap(Apic* apic)
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */ nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP)); 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) if(apic->online)
break; break;
delay(10); delay(1);
} }
nvramwrite(0x0F, 0x00); nvramwrite(0x0F, 0x00);
} }

View file

@ -232,10 +232,8 @@ typedef void KMap;
struct struct
{ {
Lock;
char machs[MAXMACH]; /* bitmap of active CPUs */ char machs[MAXMACH]; /* bitmap of active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active; }active;
/* /*

View file

@ -200,6 +200,7 @@ confinit(void)
if(userpcnt < 10) if(userpcnt < 10)
userpcnt = 70; userpcnt = 70;
kpages = conf.npage - (conf.npage*userpcnt)/100; kpages = conf.npage - (conf.npage*userpcnt)/100;
conf.nimage = conf.nproc;
} else { } else {
if(userpcnt < 10) { if(userpcnt < 10) {
if(conf.npage*BY2PG < 16*MB) if(conf.npage*BY2PG < 16*MB)
@ -517,7 +518,6 @@ main()
pageinit(); pageinit();
swapinit(); swapinit();
userinit(); userinit();
active.thunderbirdsarego = 1;
schedinit(); schedinit();
} }

View file

@ -15,21 +15,12 @@ squidboy(Apic* apic)
mmuinit(); mmuinit();
cpuidentify(); cpuidentify();
cpuidprint(); cpuidprint();
syncclock();
active.machs[m->machno] = 1;
apic->online = 1; apic->online = 1;
coherence();
lapicinit(apic); lapicinit(apic);
lapiconline(); lapiconline();
syncclock();
timersinit(); timersinit();
lock(&active);
active.machs[m->machno] = 1;
unlock(&active);
while(!active.thunderbirdsarego)
microdelay(100);
schedinit(); schedinit();
} }
@ -102,10 +93,12 @@ mpstartap(Apic* apic)
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */ nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP)); 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) if(apic->online)
break; break;
delay(10); delay(1);
} }
nvramwrite(0x0F, 0x00); nvramwrite(0x0F, 0x00);
} }

View file

@ -1008,11 +1008,9 @@ cpushutdown(void)
{ {
int ms, once; int ms, once;
lock(&active);
once = active.machs[m->machno]; once = active.machs[m->machno];
active.machs[m->machno] = 0; active.machs[m->machno] = 0;
active.exiting = 1; active.exiting = 1;
unlock(&active);
if(once) if(once)
iprint("cpu%d: exiting\n", m->machno); iprint("cpu%d: exiting\n", m->machno);

View file

@ -188,7 +188,6 @@ struct Mach
struct struct
{ {
Lock;
char machs[MAXMACH]; char machs[MAXMACH];
int exiting; int exiting;
}active; }active;

View file

@ -203,7 +203,6 @@ struct Softtlb
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active cpus */ char machs[MAXMACH]; /* active cpus */
short exiting; short exiting;
}active; }active;

View file

@ -250,7 +250,6 @@ struct
int wfi; /* bitmap of CPUs in WFI state */ int wfi; /* bitmap of CPUs in WFI state */
int stopped; /* bitmap of CPUs stopped */ int stopped; /* bitmap of CPUs stopped */
int exiting; /* shutdown */ int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active; }active;
extern register Mach* m; /* R10 */ extern register Mach* m; /* R10 */

View file

@ -484,7 +484,7 @@ mmurelease(Proc* proc)
for(page = proc->mmul2cache; page != nil; page = next){ for(page = proc->mmul2cache; page != nil; page = next){
next = page->next; next = page->next;
if(--page->ref) if(--page->ref)
panic("mmurelease: page->ref %d", page->ref); panic("mmurelease: page->ref %ld", page->ref);
pagechainhead(page); pagechainhead(page);
} }
if(proc->mmul2cache != nil) if(proc->mmul2cache != nil)

View file

@ -106,7 +106,6 @@ main(void)
swapinit(); swapinit();
userinit(); userinit();
active.thunderbirdsarego = 1;
schedinit(); schedinit();
} }

View file

@ -174,7 +174,6 @@ struct ISAConf
struct struct
{ {
Lock;
char machs[MAXMACH]; /* active CPUs */ char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */ int exiting; /* shutdown */
}active; }active;