Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Call cpufreq_suspend(9) and cpufreq_resume(9) durin...
details: https://anonhg.NetBSD.org/src/rev/e0282c7119e8
branches: trunk
changeset: 769976:e0282c7119e8
user: jruoho <jruoho%NetBSD.org@localhost>
date: Wed Sep 28 15:38:21 2011 +0000
description:
Call cpufreq_suspend(9) and cpufreq_resume(9) during suspend/resume.
diffstat:
sys/arch/x86/x86/cpu.c | 35 ++++++++++++++++++++++++-----------
sys/arch/xen/x86/cpu.c | 35 ++++++++++++++++++++++++-----------
2 files changed, 48 insertions(+), 22 deletions(-)
diffs (178 lines):
diff -r dbfbac79ea3a -r e0282c7119e8 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c Wed Sep 28 15:11:42 2011 +0000
+++ b/sys/arch/x86/x86/cpu.c Wed Sep 28 15:38:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.92 2011/08/11 20:33:20 cherry Exp $ */
+/* $NetBSD: cpu.c,v 1.93 2011/09/28 15:38:21 jruoho Exp $ */
/*-
* Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.92 2011/08/11 20:33:20 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.93 2011/09/28 15:38:21 jruoho Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -81,6 +81,7 @@
#include <sys/device.h>
#include <sys/kmem.h>
#include <sys/cpu.h>
+#include <sys/cpufreq.h>
#include <sys/atomic.h>
#include <sys/reboot.h>
@@ -1090,12 +1091,16 @@
struct cpu_info *ci = sc->sc_info;
int err;
- if (ci->ci_flags & CPUF_PRIMARY)
+ if ((ci->ci_flags & CPUF_PRESENT) == 0)
return true;
+
+ cpufreq_suspend(ci);
+
+ if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+ return true;
+
if (ci->ci_data.cpu_idlelwp == NULL)
return true;
- if ((ci->ci_flags & CPUF_PRESENT) == 0)
- return true;
sc->sc_wasonline = !(ci->ci_schedstate.spc_flags & SPCF_OFFLINE);
@@ -1104,7 +1109,7 @@
err = cpu_setstate(ci, false);
mutex_exit(&cpu_lock);
- if (err)
+ if (err != 0)
return false;
}
@@ -1118,20 +1123,28 @@
struct cpu_info *ci = sc->sc_info;
int err = 0;
- if (ci->ci_flags & CPUF_PRIMARY)
- return true;
- if (ci->ci_data.cpu_idlelwp == NULL)
- return true;
if ((ci->ci_flags & CPUF_PRESENT) == 0)
return true;
+ if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+ goto out;
+
+ if (ci->ci_data.cpu_idlelwp == NULL)
+ goto out;
+
if (sc->sc_wasonline) {
mutex_enter(&cpu_lock);
err = cpu_setstate(ci, true);
mutex_exit(&cpu_lock);
}
- return err == 0;
+out:
+ if (err != 0)
+ return false;
+
+ cpufreq_resume(ci);
+
+ return true;
}
static bool
diff -r dbfbac79ea3a -r e0282c7119e8 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c Wed Sep 28 15:11:42 2011 +0000
+++ b/sys/arch/xen/x86/cpu.c Wed Sep 28 15:38:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.65 2011/09/20 00:12:24 jym Exp $ */
+/* $NetBSD: cpu.c,v 1.66 2011/09/28 15:38:22 jruoho Exp $ */
/* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */
/*-
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.65 2011/09/20 00:12:24 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.66 2011/09/28 15:38:22 jruoho Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -83,6 +83,7 @@
#include <sys/device.h>
#include <sys/kmem.h>
#include <sys/cpu.h>
+#include <sys/cpufreq.h>
#include <sys/atomic.h>
#include <sys/reboot.h>
#include <sys/idle.h>
@@ -1142,12 +1143,16 @@
struct cpu_info *ci = sc->sc_info;
int err;
- if (ci->ci_flags & CPUF_PRIMARY)
+ if ((ci->ci_flags & CPUF_PRESENT) == 0)
return true;
+
+ cpufreq_suspend(ci);
+
+ if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+ return true;
+
if (ci->ci_data.cpu_idlelwp == NULL)
return true;
- if ((ci->ci_flags & CPUF_PRESENT) == 0)
- return true;
sc->sc_wasonline = !(ci->ci_schedstate.spc_flags & SPCF_OFFLINE);
@@ -1156,7 +1161,7 @@
err = cpu_setstate(ci, false);
mutex_exit(&cpu_lock);
- if (err)
+ if (err != 0)
return false;
}
@@ -1170,20 +1175,28 @@
struct cpu_info *ci = sc->sc_info;
int err = 0;
- if (ci->ci_flags & CPUF_PRIMARY)
- return true;
- if (ci->ci_data.cpu_idlelwp == NULL)
- return true;
if ((ci->ci_flags & CPUF_PRESENT) == 0)
return true;
+ if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+ goto out;
+
+ if (ci->ci_data.cpu_idlelwp == NULL)
+ goto out;
+
if (sc->sc_wasonline) {
mutex_enter(&cpu_lock);
err = cpu_setstate(ci, true);
mutex_exit(&cpu_lock);
}
- return err == 0;
+out:
+ if (err != 0)
+ return false;
+
+ cpufreq_resume(ci);
+
+ return true;
}
#endif
Home |
Main Index |
Thread Index |
Old Index