summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/hibernate_machdep.c19
-rw-r--r--sys/arch/amd64/include/hibernate.h3
-rw-r--r--sys/arch/i386/i386/hibernate_machdep.c19
-rw-r--r--sys/arch/i386/include/hibernate.h3
-rw-r--r--sys/kern/subr_hibernate.c6
5 files changed, 49 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c
index 4e789ba7522..47e2ed0516a 100644
--- a/sys/arch/amd64/amd64/hibernate_machdep.c
+++ b/sys/arch/amd64/amd64/hibernate_machdep.c
@@ -384,3 +384,22 @@ hibernate_disable_intr_machdep(void)
{
disable_intr();
}
+
+#ifdef MULTIPROCESSOR
+/*
+ * Quiesce CPUs in a multiprocessor machine before resuming. We need to do
+ * this since the APs will be hatched (but waiting for CPUF_GO), and we don't
+ * want the APs to be executing code and causing side effects during the
+ * unpack operation.
+ */
+void
+hibernate_quiesce_cpus(void)
+{
+ /* Start the hatched (but idling) APs */
+ cpu_boot_secondary_processors();
+ sched_start_secondary_cpus();
+
+ /* Now shut them down */
+ acpi_sleep_mp();
+}
+#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/amd64/include/hibernate.h b/sys/arch/amd64/include/hibernate.h
index 674ba9d6703..4a49a28e9c1 100644
--- a/sys/arch/amd64/include/hibernate.h
+++ b/sys/arch/amd64/include/hibernate.h
@@ -29,3 +29,6 @@ void hibernate_resume_machdep(void);
void hibernate_activate_resume_pt_machdep(void);
void hibernate_enable_intr_machdep(void);
void hibernate_disable_intr_machdep(void);
+#ifdef MULTIPROCESSOR
+void hibernate_quiesce_cpus(void);
+#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c
index db31e28cec0..be897930693 100644
--- a/sys/arch/i386/i386/hibernate_machdep.c
+++ b/sys/arch/i386/i386/hibernate_machdep.c
@@ -328,3 +328,22 @@ hibernate_disable_intr_machdep(void)
{
disable_intr();
}
+
+#ifdef MULTIPROCESSOR
+/*
+ * Quiesce CPUs in a multiprocessor machine before resuming. We need to do
+ * this since the APs will be hatched (but waiting for CPUF_GO), and we don't
+ * want the APs to be executing code and causing side effects during the
+ * unpack operation.
+ */
+void
+hibernate_quiesce_cpus(void)
+{
+ /* Start the hatched (but idling) APs */
+ cpu_boot_secondary_processors();
+ sched_start_secondary_cpus();
+
+ /* Now shut them down */
+ acpi_sleep_mp();
+}
+#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/i386/include/hibernate.h b/sys/arch/i386/include/hibernate.h
index d4ac3707d35..fd18476862c 100644
--- a/sys/arch/i386/include/hibernate.h
+++ b/sys/arch/i386/include/hibernate.h
@@ -29,3 +29,6 @@ void hibernate_resume_machdep(void);
void hibernate_activate_resume_pt_machdep(void);
void hibernate_enable_intr_machdep(void);
void hibernate_disable_intr_machdep(void);
+#ifdef MULTIPROCESSOR
+void hibernate_quiesce_cpus(void);
+#endif /* MULTIPROCESSOR */
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index c195ed81c95..d4e23b4a507 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.56 2013/05/30 19:00:59 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.57 2013/05/31 20:00:00 mlarkin Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -1187,6 +1187,10 @@ hibernate_resume(void)
return;
}
+#ifdef MULTIPROCESSOR
+ hibernate_quiesce_cpus();
+#endif /* MULTIPROCESSOR */
+
printf("Unhibernating...\n");
/* Read the image from disk into the image (pig) area */