aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/include
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>1998-05-17 22:12:14 +0000
committerTor Egge <tegge@FreeBSD.org>1998-05-17 22:12:14 +0000
commit2f1e70693d5139b207a083e6a7255871ef15cdeb (patch)
treea71e78118264ee43bdde494d8c4d3c5b9e979b8b /sys/amd64/include
parent0580d3228828d19d97da7b2761cd9bc8e5f8d47d (diff)
Notes
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/mptable.h58
-rw-r--r--sys/amd64/include/smp.h6
2 files changed, 53 insertions, 11 deletions
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 7b58b87d385b..c5e392a67522 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.74 1998/05/11 01:06:06 dyson Exp $
+ * $Id: mp_machdep.c,v 1.75 1998/05/17 18:53:17 tegge Exp $
*/
#include "opt_smp.h"
@@ -312,6 +312,8 @@ extern pt_entry_t SMP_prvpt[];
/* Private page pointer to curcpu's PTD, used during BSP init */
extern pd_entry_t *my_idlePTD;
+struct pcb stoppcbs[NCPU];
+
static int smp_started; /* has the system started? */
/*
@@ -2009,13 +2011,10 @@ stop_cpus(u_int map)
if (!smp_started)
return 0;
- /* send IPI to all CPUs in map */
- stopped_cpus = 0;
-
/* send the Xcpustop IPI to all CPUs in map */
selected_apic_ipi(map, XCPUSTOP_OFFSET, APIC_DELMODE_FIXED);
-
- while (stopped_cpus != map)
+
+ while ((stopped_cpus & map) != map)
/* spin */ ;
return 1;
@@ -2043,9 +2042,8 @@ restart_cpus(u_int map)
started_cpus = map; /* signal other cpus to restart */
- while (started_cpus) /* wait for each to clear its bit */
+ while ((stopped_cpus & map) != 0) /* wait for each to clear its bit */
/* spin */ ;
- stopped_cpus = 0;
return 1;
}
@@ -2075,6 +2073,11 @@ int forward_signal_enabled = 1;
SYSCTL_INT(_machdep, OID_AUTO, forward_signal_enabled, CTLFLAG_RW,
&forward_signal_enabled, 0, "");
+/* Enable forwarding of roundrobin to all other cpus */
+int forward_roundrobin_enabled = 1;
+SYSCTL_INT(_machdep, OID_AUTO, forward_roundrobin_enabled, CTLFLAG_RW,
+ &forward_roundrobin_enabled, 0, "");
+
/*
* This is called once the rest of the system is up and running and we're
* ready to let the AP's out of the pen.
@@ -2296,9 +2299,11 @@ forward_statclock(int pscnt)
while (checkstate_probed_cpus != map) {
/* spin */
i++;
- if (i == 1000000) {
+ if (i == 100000) {
+#ifdef BETTER_CLOCK_DIAGNOSTIC
printf("forward_statclock: checkstate %x\n",
checkstate_probed_cpus);
+#endif
break;
}
}
@@ -2369,9 +2374,11 @@ forward_hardclock(int pscnt)
while (checkstate_probed_cpus != map) {
/* spin */
i++;
- if (i == 1000000) {
+ if (i == 100000) {
+#ifdef BETTER_CLOCK_DIAGNOSTIC
printf("forward_hardclock: checkstate %x\n",
checkstate_probed_cpus);
+#endif
break;
}
}
@@ -2475,6 +2482,37 @@ forward_signal(struct proc *p)
}
}
+void
+forward_roundrobin(void)
+{
+ u_int map;
+ int i;
+
+ if (!smp_started || !invltlb_ok || cold || panicstr)
+ return;
+ if (!forward_roundrobin_enabled)
+ return;
+ resched_cpus |= other_cpus;
+ map = other_cpus & ~stopped_cpus ;
+#if 1
+ selected_apic_ipi(map, XCPUAST_OFFSET, APIC_DELMODE_FIXED);
+#else
+ (void) all_but_self_ipi(XCPUAST_OFFSET);
+#endif
+ i = 0;
+ while ((checkstate_need_ast & map) != 0) {
+ /* spin */
+ i++;
+ if (i > 100000) {
+#if 0
+ printf("forward_roundrobin: dropped ast 0x%x\n",
+ checkstate_need_ast & map);
+#endif
+ break;
+ }
+ }
+}
+
#ifdef APIC_INTR_REORDER
/*
diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h
index 283c925f2955..f2586304524c 100644
--- a/sys/amd64/include/smp.h
+++ b/sys/amd64/include/smp.h
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: smp.h,v 1.41 1998/04/01 20:38:28 tegge Exp $
+ * $Id: smp.h,v 1.42 1998/04/01 21:07:36 tegge Exp $
*
*/
@@ -80,6 +80,8 @@ extern volatile u_int started_cpus;
extern volatile u_int checkstate_probed_cpus;
extern volatile u_int checkstate_need_ast;
+extern volatile u_int resched_cpus;
+extern void (*cpustop_restartfunc) __P((void));
/* functions in apic_ipl.s */
void apic_eoi __P((void));
@@ -103,6 +105,7 @@ extern int io_num_to_apic_id[];
extern int apic_id_to_logical[];
extern u_int all_cpus;
extern u_char SMP_ioapic[];
+extern struct pcb stoppcbs[];
/* functions in mp_machdep.c */
u_int mp_bootaddress __P((u_int));
@@ -131,6 +134,7 @@ void forward_statclock __P((int pscnt));
void forward_hardclock __P((int pscnt));
#endif /* BETTER_CLOCK */
void forward_signal __P((struct proc *));
+void forward_roundrobin __P((void));
#ifdef APIC_INTR_REORDER
void set_lapic_isrloc __P((int, int));
#endif /* APIC_INTR_REORDER */