From 0a23802a8ab6adc2281eb28835a66e732e7bb950 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 13 Feb 2022 15:56:55 +0000 Subject: [PATCH] Move some MI pieces out of suspend_mp/resume_mp ok kettenis --- sys/arch/amd64/amd64/acpi_machdep.c | 7 +------ sys/arch/i386/i386/acpi_machdep.c | 7 +------ sys/kern/subr_suspend.c | 5 ++++- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index e1c02476114..e119de143f1 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.99 2022/02/12 16:25:42 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.100 2022/02/13 15:56:55 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -499,9 +499,6 @@ sleep_mp(void) { int i; - sched_stop_secondary_cpus(); - KASSERT(CPU_IS_PRIMARY(curcpu())); - /* * Wait for cpus to halt so we know their FPU state has been * saved and their caches have been written back. @@ -557,9 +554,7 @@ resume_mp(void) ci->ci_flags &= ~CPUF_PRESENT; cpu_start_secondary(ci); } - cpu_boot_secondary_processors(); - sched_start_secondary_cpus(); } #endif /* MULTIPROCESSOR */ diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index 36aa5412a90..436a0d0321c 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.81 2022/02/12 16:26:57 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.82 2022/02/13 15:56:55 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -459,9 +459,6 @@ sleep_mp(void) { int i; - sched_stop_secondary_cpus(); - KASSERT(CPU_IS_PRIMARY(curcpu())); - /* * Wait for cpus to halt so we know their FPU state has been * saved and their caches have been written back. @@ -511,9 +508,7 @@ resume_mp(void) ci->ci_idepth = 0; } - cpu_boot_secondary_processors(); - sched_start_secondary_cpus(); } #endif /* MULTIPROCESSOR */ diff --git a/sys/kern/subr_suspend.c b/sys/kern/subr_suspend.c index 2ff35524698..03754b6e1c8 100644 --- a/sys/kern/subr_suspend.c +++ b/sys/kern/subr_suspend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_suspend.c,v 1.3 2022/02/11 01:55:12 deraadt Exp $ */ +/* $OpenBSD: subr_suspend.c,v 1.4 2022/02/13 15:56:55 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -80,6 +80,8 @@ sleep_state(void *v, int sleepmode) #ifdef MULTIPROCESSOR + sched_stop_secondary_cpus(); + KASSERT(CPU_IS_PRIMARY(curcpu())); sleep_mp(); #endif @@ -148,6 +150,7 @@ fail_suspend: #ifdef MULTIPROCESSOR resume_mp(); + sched_start_secondary_cpus(); #endif vfs_stall(curproc, 0); -- 2.20.1