Deleted Added
full compact
mp_machdep.c (152531) mp_machdep.c (153241)
1/*-
2 * Copyright (c) 1996, by Steve Passe
3 * Copyright (c) 2003, by Peter Wemm
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1996, by Steve Passe
3 * Copyright (c) 2003, by Peter Wemm
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 152531 2005-11-16 20:58:40Z jhb $");
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 153241 2005-12-08 18:33:30Z jhb $");
29
30#include "opt_cpu.h"
31#include "opt_kstack_pages.h"
32#include "opt_mp_watchdog.h"
33#include "opt_sched.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 1026 unchanged lines hidden (view full) ---

1063 if (!lapic_ipi_wait(BEFORE_SPIN))
1064 panic("ipi_nmi_selected: previous IPI has not cleared");
1065
1066 lapic_ipi_raw(icrlo, cpu_apic_ids[cpu]);
1067 }
1068}
1069
1070int
29
30#include "opt_cpu.h"
31#include "opt_kstack_pages.h"
32#include "opt_mp_watchdog.h"
33#include "opt_sched.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 1026 unchanged lines hidden (view full) ---

1063 if (!lapic_ipi_wait(BEFORE_SPIN))
1064 panic("ipi_nmi_selected: previous IPI has not cleared");
1065
1066 lapic_ipi_raw(icrlo, cpu_apic_ids[cpu]);
1067 }
1068}
1069
1070int
1071ipi_nmi_handler()
1071ipi_nmi_handler(void)
1072{
1072{
1073 int cpu = PCPU_GET(cpuid);
1074 int cpumask = PCPU_GET(cpumask);
1075
1076 if (!(ipi_nmi_pending & cpumask))
1077 return 1;
1078
1079 atomic_clear_int(&ipi_nmi_pending, cpumask);
1073 int cpumask = PCPU_GET(cpumask);
1074
1075 if (!(ipi_nmi_pending & cpumask))
1076 return 1;
1077
1078 atomic_clear_int(&ipi_nmi_pending, cpumask);
1079 cpustop_handler();
1080 return 0;
1081}
1082
1083#endif /* STOP_NMI */
1080
1084
1085/*
1086 * Handle an IPI_STOP by saving our current context and spinning until we
1087 * are resumed.
1088 */
1089void
1090cpustop_handler(void)
1091{
1092 int cpu = PCPU_GET(cpuid);
1093 int cpumask = PCPU_GET(cpumask);
1094
1081 savectx(&stoppcbs[cpu]);
1082
1083 /* Indicate that we are stopped */
1084 atomic_set_int(&stopped_cpus, cpumask);
1085
1086 /* Wait for restart */
1087 while (!(started_cpus & cpumask))
1088 ia32_pause();
1089
1090 atomic_clear_int(&started_cpus, cpumask);
1091 atomic_clear_int(&stopped_cpus, cpumask);
1092
1093 if (cpu == 0 && cpustop_restartfunc != NULL) {
1094 cpustop_restartfunc();
1095 cpustop_restartfunc = NULL;
1096 }
1095 savectx(&stoppcbs[cpu]);
1096
1097 /* Indicate that we are stopped */
1098 atomic_set_int(&stopped_cpus, cpumask);
1099
1100 /* Wait for restart */
1101 while (!(started_cpus & cpumask))
1102 ia32_pause();
1103
1104 atomic_clear_int(&started_cpus, cpumask);
1105 atomic_clear_int(&stopped_cpus, cpumask);
1106
1107 if (cpu == 0 && cpustop_restartfunc != NULL) {
1108 cpustop_restartfunc();
1109 cpustop_restartfunc = NULL;
1110 }
1097
1098 return 0;
1099}
1111}
1100
1101#endif /* STOP_NMI */
1102
1103/*
1104 * This is called once the rest of the system is up and running and we're
1105 * ready to let the AP's out of the pen.
1106 */
1107static void
1108release_aps(void *dummy __unused)
1109{

--- 150 unchanged lines hidden ---
1112
1113/*
1114 * This is called once the rest of the system is up and running and we're
1115 * ready to let the AP's out of the pen.
1116 */
1117static void
1118release_aps(void *dummy __unused)
1119{

--- 150 unchanged lines hidden ---