From e673a4ec4c89d223455d8d5de719ac333ef3827d Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Tue, 24 Apr 2018 09:42:58 +0000 Subject: [PATCH] add a new ACPI suspend debugging knob, debug.acpi.suspend_deep_bounce This sysctl allows a deeper dive into the sleep abyss comparing to debug.acpi.suspend_bounce. When the new sysctl is set the system will execute the suspend sequence up to the call to AcpiEnterSleepState(). That includes saving processor contexts and parking APs. Then, instead of actually entering the sleep state, the BSP will call resumectx() to emulate the wakeup. The APs should get restarted by the sequence of Init and Startup IPIs that BSP sends to them. MFC after: 8 days --- sys/dev/acpica/acpi.c | 5 +++++ sys/x86/acpica/acpi_wakeup.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 402aa92dbd4f..2e57400f2350 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -291,6 +291,11 @@ static int acpi_susp_bounce; SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); +int acpi_susp_deep_bounce; +SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_deep_bounce, CTLFLAG_RW, + &acpi_susp_deep_bounce, 0, "Don't actually suspend, " + "bail out just before entering the sleep state."); + /* * ACPI can only be loaded as a module by the loader; activating it after * system bootstrap time is not useful, and can be fatal to the system. diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index 360d488126e0..53189c63be22 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -79,6 +79,7 @@ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); extern int acpi_resume_beep; extern int acpi_reset_video; +extern int acpi_susp_deep_bounce; #ifdef SMP extern struct susppcb **susppcbs; @@ -264,6 +265,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) PTD[KPTDI] = PTD[LOWPTDI]; #endif + if (acpi_susp_deep_bounce) + resumectx(pcb); + /* Call ACPICA to enter the desired sleep state */ if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios();