summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-08-28 23:24:05 +0000
committerpeter <peter@FreeBSD.org>2002-08-28 23:24:05 +0000
commit7b726290f1e66d65654b382a03a1ce5fcc35cb8c (patch)
treedd35fc92d716c5789e0b78d3e557f9abe1a2229a
parent9226b11a98bcaadbaae51feb073683e127e79984 (diff)
downloadFreeBSD-src-7b726290f1e66d65654b382a03a1ce5fcc35cb8c.zip
FreeBSD-src-7b726290f1e66d65654b382a03a1ce5fcc35cb8c.tar.gz
OK, I have had it with losing my console because the AP's print their "I am
alive!" message right as the scsi probe messages happen. This is a bit nasty, but it seems to work. At the point that we unlock the AP's, briefly wait till they are all done while we hold the console on their behalf.
-rw-r--r--sys/amd64/amd64/mp_machdep.c17
-rw-r--r--sys/amd64/amd64/mptable.c17
-rw-r--r--sys/amd64/include/mptable.h17
-rw-r--r--sys/i386/i386/mp_machdep.c17
-rw-r--r--sys/i386/i386/mptable.c17
-rw-r--r--sys/i386/include/mptable.h17
6 files changed, 72 insertions, 30 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 29e9c6e..42651f4 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 29e9c6e..42651f4 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 29e9c6e..42651f4 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 29e9c6e..42651f4 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 29e9c6e..42651f4 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 29e9c6e..42651f4 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -2452,7 +2452,7 @@ ap_init(void)
/* spin until all the AP's are ready */
while (!aps_ready)
- /* spin */ ;
+ ia32_pause();
/* BSP may have changed PTD while we were waiting */
invltlb();
@@ -2500,7 +2500,8 @@ ap_init(void)
printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
if (smp_cpus == mp_ncpus) {
- smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */
+ /* enable IPI's, tlb shootdown, freezes etc */
+ atomic_store_rel_int(&smp_started, 1);
smp_active = 1; /* historic */
}
@@ -2508,13 +2509,14 @@ ap_init(void)
/* wait until all the AP's are up */
while (smp_started == 0)
- ; /* nothing */
+ ia32_pause();
+
+ /* ok, now grab sched_lock and enter the scheduler */
+ mtx_lock_spin(&sched_lock);
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
- /* ok, now grab sched_lock and enter the scheduler */
- mtx_lock_spin(&sched_lock);
cpu_throw(); /* doesn't return */
panic("scheduler returned us to %s", __func__);
@@ -2649,7 +2651,12 @@ ipi_self(u_int ipi)
void
release_aps(void *dummy __unused)
{
+
+ mtx_lock_spin(&sched_lock);
atomic_store_rel_int(&aps_ready, 1);
+ while (smp_started == 0)
+ ia32_pause();
+ mtx_unlock_spin(&sched_lock);
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);
OpenPOWER on IntegriCloud