Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 14:52:45 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Nicholas McKenzie <nicholassmckenzie@gmail.com>,  freebsd-drivers@freebsd.org, freebsd-amd64@freebsd.org
Subject:   Re: Problems with amd FX 8 core and freq scaling
Message-ID:  <5281358D.1010406@FreeBSD.org>
In-Reply-To: <CACZJ7toKu34Vz4Ejxa0URoytry-xTT24y6jeoe3DY=QvDPoXKg@mail.gmail.com>
References:  <1384119989.1540.9.camel@freebsd.local> <5280A76B.20307@freebsd.org> <CACZJ7toKu34Vz4Ejxa0URoytry-xTT24y6jeoe3DY=QvDPoXKg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060701040904010101070308
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-11-11 13:16:47 -0500, Nicholas McKenzie wrote:
> But wouldn't this just disable frequency scaling and the whole
> point of powerd?

No.  acpi_throttle (and p4tcc) controls T-state.  "Frequency scaling"
should be done by changing P-state.

> On Mon, Nov 11, 2013 at 1:46 AM, Stefan Esser <se@freebsd.org>
> wrote:
>> 
>> Am 10.11.2013 22:46, schrieb Nicholas Stewart McKenzie:
>>> My computer crashes if I enable powerd. I can't get cpu freq
>>> scaling to work with my cpu:(P.S. I sent this to both drivers
>>> and amd64 mailing list...
>> 
>> Hi,
>> 
>> you may want to try booting with the following line added to 
>> /boot/loader.conf (or entered at the boot menu prompt after 
>> breaking out of automatic boot):
>> 
>> hint.acpi_throttle.0.disabled="1"
>> 
>> There have been a number of reports of throttling causing 
>> crashes. This setting does not prevent powerd from adjusting your
>> CPU's clock, it just disables some arcane feature which pre-dates
>> the modern power management methods.

I rewrote acpi_throttle.c at some point to fix the problem but never
committed it because nobody was really interested in testing the
patch.  Also, it is really an arcane and archaic feature:

http://software.intel.com/en-us/blogs/2013/10/15/c-states-p-states-where-the-heck-are-those-t-states

Now I think we should disable the feature by default because it is
causing too much hassle for us (attached).  Any objection?

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQEcBAEBAgAGBQJSgTWNAAoJEHyflib82/FGsqUIAIhv2t69myurKlkZxJw06tjq
47skw20kG1NlxQ97SspL1Blap9yvMkETL3XgR6f6rdgIze8K0wpCIjB19rSg2OIX
yqV1RGC30vWoX2cG4ccKiw8G/juqIbqBpGjHf/pG9LUM4upQQ59gDzkVlCnmorzg
kzBTBEM9TpomqOttB4YICxzkhztcorKJ3cClaPKfoO2Ds9WpQaOYl6b3YW0HUaRW
7VtwjEMDg3BwNoBusBIK+ZLSUSNP5smffX1/oyGHA0QGZCrlMwoH7j5fdZj9weiY
nxM1/jZ+fpiV33jfAt4HzavQDxnpHvYsf5v54Jlmrm+FNtCCp7tWICK/KjVqrn0=
=E6TS
-----END PGP SIGNATURE-----

--------------060701040904010101070308
Content-Type: text/x-patch;
 name="cpu_throttle.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="cpu_throttle.diff"

Index: sys/dev/acpica/acpi_throttle.c
===================================================================
--- sys/dev/acpica/acpi_throttle.c	(revision 258002)
+++ sys/dev/acpica/acpi_throttle.c	(working copy)
@@ -167,7 +167,7 @@ static int
 acpi_throttle_probe(device_t dev)
 {
 
-	if (resource_disabled("acpi_throttle", 0))
+	if (!resource_enabled("acpi_throttle", 0))
 		return (ENXIO);
 
 	/*
@@ -177,7 +177,7 @@ acpi_throttle_probe(device_t dev)
 	 * we disable acpi_throttle when p4tcc is also present.
 	 */
 	if (device_find_child(device_get_parent(dev), "p4tcc", -1) &&
-	    !resource_disabled("p4tcc", 0))
+	    resource_ensabled("p4tcc", 0))
 		return (ENXIO);
 
 	device_set_desc(dev, "ACPI CPU Throttling");
Index: sys/kern/subr_hints.c
===================================================================
--- sys/kern/subr_hints.c	(revision 258002)
+++ sys/kern/subr_hints.c	(working copy)
@@ -449,15 +449,29 @@ resource_find_dev(int *anchor, const char *name, i
 }
 
 /*
- * Check to see if a device is disabled via a disabled hint.
+ * Check to see if a device is disabled or enabled via a hint.
  */
-int
-resource_disabled(const char *name, int unit)
+static __inline int
+resource_find_hint(const char *name, int unit, const char *hint)
 {
 	int error, value;
 
-	error = resource_int_value(name, unit, "disabled", &value);
+	error = resource_int_value(name, unit, hint, &value);
 	if (error)
 	       return (0);
 	return (value);
 }
+
+int
+resource_disabled(const char *name, int unit)
+{
+
+	return (resource_find_hint(name, unit, "disabled"));
+}
+
+int
+resource_enabled(const char *name, int unit)
+{
+
+	return (resource_find_hint(name, unit, "enabled"));
+}
Index: sys/sys/bus.h
===================================================================
--- sys/sys/bus.h	(revision 258002)
+++ sys/sys/bus.h	(working copy)
@@ -503,6 +503,7 @@ int	resource_long_value(const char *name, int unit
 int	resource_string_value(const char *name, int unit, const char *resname,
 			      const char **result);
 int	resource_disabled(const char *name, int unit);
+int	resource_enabled(const char *name, int unit);
 int	resource_find_match(int *anchor, const char **name, int *unit,
 			    const char *resname, const char *value);
 int	resource_find_dev(int *anchor, const char *name, int *unit,
Index: sys/x86/cpufreq/p4tcc.c
===================================================================
--- sys/x86/cpufreq/p4tcc.c	(revision 258002)
+++ sys/x86/cpufreq/p4tcc.c	(working copy)
@@ -142,7 +142,7 @@ static int
 p4tcc_probe(device_t dev)
 {
 
-	if (resource_disabled("p4tcc", 0))
+	if (!resource_enabled("p4tcc", 0))
 		return (ENXIO);
 
 	device_set_desc(dev, "CPU Frequency Thermal Control");

--------------060701040904010101070308--



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