From 81e1d3375fd59536b37e3552f67387148ba855bc Mon Sep 17 00:00:00 2001 From: kettenis Date: Thu, 8 Aug 2024 07:02:38 +0000 Subject: [PATCH] Print suspend-to-idle debug info in a more concise matter. ok mlarkin@, deraadt@ --- sys/arch/amd64/amd64/cpu.c | 9 +++------ sys/arch/i386/i386/cpu.c | 3 ++- sys/dev/acpi/acpi_x86.c | 8 +++++++- sys/dev/acpi/acpivar.h | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index 898c23010f3..26f96841188 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.191 2024/07/21 19:41:31 bluhm Exp $ */ +/* $OpenBSD: cpu.c,v 1.192 2024/08/08 07:02:38 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -1464,6 +1464,7 @@ wbinvd_on_all_cpus(void) #endif int cpu_suspended; +int cpu_wakeups; #ifdef SUSPEND @@ -1480,9 +1481,6 @@ int cpu_suspend_primary(void) { struct cpu_info *ci = curcpu(); - int count = 0; - - printf("suspend\n"); /* Mask clock interrupts. */ local_pic.pic_hwmask(&local_pic, 0); @@ -1500,7 +1498,7 @@ cpu_suspend_primary(void) while (cpu_suspended) { cpu_suspend_cycle(); - count++; + cpu_wakeups++; } intr_disable(); @@ -1509,7 +1507,6 @@ cpu_suspend_primary(void) /* Unmask clock interrupts. */ local_pic.pic_hwunmask(&local_pic, 0); - printf("resume %d\n", count); return 0; } diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 9e891cb43d5..d6ee841aeda 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.115 2024/05/29 12:21:33 kettenis Exp $ */ +/* $OpenBSD: cpu.c,v 1.116 2024/08/08 07:02:38 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -927,3 +927,4 @@ wbinvd_on_all_cpus(void) #endif int cpu_suspended; +int cpu_wakeups; diff --git a/sys/dev/acpi/acpi_x86.c b/sys/dev/acpi/acpi_x86.c index b0927ca7de0..e08435d25c8 100644 --- a/sys/dev/acpi/acpi_x86.c +++ b/sys/dev/acpi/acpi_x86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_x86.c,v 1.24 2024/08/06 17:38:56 kettenis Exp $ */ +/* $OpenBSD: acpi_x86.c,v 1.25 2024/08/08 07:02:38 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -87,6 +87,7 @@ sleep_setstate(void *v) int gosleep(void *v) { + extern int cpu_wakeups; struct acpi_softc *sc = v; int ret; @@ -107,10 +108,13 @@ gosleep(void *v) if (sc->sc_pmc_suspend) sc->sc_pmc_suspend(sc->sc_pmc_cookie); + cpu_wakeups = 0; sc->sc_wakeup = 0; + sc->sc_wakeups = 0; while (!sc->sc_wakeup) { ret = acpi_sleep_cpu(sc, sc->sc_state); acpi_resume_cpu(sc, sc->sc_state); + sc->sc_wakeups++; if (sc->sc_ec && sc->sc_wakegpe == sc->sc_ec->sc_gpe) { sc->sc_wakeup = 0; @@ -160,8 +164,10 @@ checklids(struct acpi_softc *sc) int suspend_finish(void *v) { + extern int cpu_wakeups; struct acpi_softc *sc = v; + printf("wakeups: %d %d\n", cpu_wakeups, sc->sc_wakeups); printf("wakeup event: "); switch (sc->sc_wakegpe) { case 0: diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 4ec231772ef..c7e17c4bdc0 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.133 2024/08/06 17:38:56 kettenis Exp $ */ +/* $OpenBSD: acpivar.h,v 1.134 2024/08/08 07:02:38 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -265,6 +265,7 @@ struct acpi_softc { struct aml_node *sc_wak; int sc_state; int sc_wakeup; + int sc_wakeups; time_t sc_resume_time; struct acpiec_softc *sc_ec; /* XXX assume single EC */ -- 2.20.1