Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2018 08:31:08 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335656 - in stable/11/sys: dev/acpica kern sys
Message-ID:  <201806260831.w5Q8V8jH074251@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Jun 26 08:31:08 2018
New Revision: 335656
URL: https://svnweb.freebsd.org/changeset/base/335656

Log:
  MFC r333994: stop and restart kernel event timers in the suspend / resume cycle

Modified:
  stable/11/sys/dev/acpica/acpi.c
  stable/11/sys/kern/kern_clocksource.c
  stable/11/sys/sys/systm.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi.c
==============================================================================
--- stable/11/sys/dev/acpica/acpi.c	Tue Jun 26 06:18:59 2018	(r335655)
+++ stable/11/sys/dev/acpica/acpi.c	Tue Jun 26 08:31:08 2018	(r335656)
@@ -2909,6 +2909,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
     if (sc->acpi_sleep_delay > 0)
 	DELAY(sc->acpi_sleep_delay * 1000000);
 
+    suspendclock();
     intr = intr_disable();
     if (state != ACPI_STATE_S1) {
 	sleep_result = acpi_sleep_machdep(sc, state);
@@ -2979,6 +2980,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
      * process.  This handles both the error and success cases.
      */
 backout:
+    if (slp_state >= ACPI_SS_SLP_PREP)
+	resumeclock();
     if (slp_state >= ACPI_SS_GPE_SET) {
 	acpi_wake_prep_walk(state);
 	sc->acpi_sstate = ACPI_STATE_S0;

Modified: stable/11/sys/kern/kern_clocksource.c
==============================================================================
--- stable/11/sys/kern/kern_clocksource.c	Tue Jun 26 06:18:59 2018	(r335655)
+++ stable/11/sys/kern/kern_clocksource.c	Tue Jun 26 08:31:08 2018	(r335656)
@@ -692,6 +692,22 @@ cpu_initclocks_ap(void)
 	spinlock_exit();
 }
 
+void
+suspendclock(void)
+{
+	ET_LOCK();
+	configtimer(0);
+	ET_UNLOCK();
+}
+
+void
+resumeclock(void)
+{
+	ET_LOCK();
+	configtimer(1);
+	ET_UNLOCK();
+}
+
 /*
  * Switch to profiling clock rates.
  */

Modified: stable/11/sys/sys/systm.h
==============================================================================
--- stable/11/sys/sys/systm.h	Tue Jun 26 06:18:59 2018	(r335655)
+++ stable/11/sys/sys/systm.h	Tue Jun 26 08:31:08 2018	(r335656)
@@ -318,6 +318,8 @@ void	startprofclock(struct proc *);
 void	stopprofclock(struct proc *);
 void	cpu_startprofclock(void);
 void	cpu_stopprofclock(void);
+void	suspendclock(void);
+void	resumeclock(void);
 sbintime_t 	cpu_idleclock(void);
 void	cpu_activeclock(void);
 void	cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806260831.w5Q8V8jH074251>