linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s
@ 2012-07-08 18:50 Jason Vas Dias
  2012-07-09  0:30 ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Vas Dias @ 2012-07-08 18:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andreas Herrmann, Matthew Garrett, Len Brown, Comrade DOS

[-- Attachment #1: Type: text/plain, Size: 3966 bytes --]

This patch adds a new acpi.thermal.temp_b4_trip = 1 settting, which
causes the temperature
to be set before evaluation of thermal trip points (the old default) ;
 this mode should
be selected automatically by DMI match if the system identifies as "HP
Compaq 6715b" .

Please consider applying a patch like that attached to fix the issue reported
in lkml thread "Re: PROBLEM: Performance drop" recently,  whereby
it was found that HP 6715b laptops ( which have 2.2Ghz dual-core  AMD
x86_64 k8 CPUs)
get stuck running the CPU at 800Khz and cannot switch frequency. I have verified
that this still the case with v3.4.4 tagged "stable" kernel.

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..de2b164 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,10 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");

+static int temp_b4_trip;
+module_param(temp_b4_trip, int, 0);
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before
initializing trip points.");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct
acpi_thermal *tz)
        if (!tz)
                return -EINVAL;

-       /* Get trip points [_CRT, _PSV, etc.] (required) */
-       result = acpi_thermal_get_trip_points(tz);
-       if (result)
+       if( temp_b4_trip )
+       { /* some CPUs, eg AMD K8 need temperature before trip points
can be obtained */
+           /* Get temperature [_TMP] (required) */
+           result = acpi_thermal_get_temperature(tz);
+           if (result)
                return result;
-
-       /* Get temperature [_TMP] (required) */
-       result = acpi_thermal_get_temperature(tz);
-       if (result)
+
+           /* Get trip points [_CRT, _PSV, etc.] (required) */
+           result = acpi_thermal_get_trip_points(tz);
+           if (result)
                return result;
-
+       }else
+       { /* newer x86_64s need trip points set before temperature
obtained */
+           /* Get trip points [_CRT, _PSV, etc.] (required) */
+           result = acpi_thermal_get_trip_points(tz);
+           if (result)
+               return result;
+
+           /* Get temperature [_TMP] (required) */
+           result = acpi_thermal_get_temperature(tz);
+           if (result)
+               return result;
+       }
+
        /* Set the cooling mode [_SCP] to active cooling (default) */
        result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
        if (!result)
                tz->flags.cooling_mode = 1;
-
+
        /* Get default polling frequency [_TZP] (optional) */
        if (tzp)
                tz->polling_frequency = tzp;
        else
                acpi_thermal_get_polling_frequency(tz);
-
+
        return 0;
 }

@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct dmi_system_id *d) {
        return 0;
 }

+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+       printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point
initialisation\n", d->ident);
+       temp_b4_trip = 1;
+       return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
        /*
         * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[]
__initdata = {
                DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
                },
        },
+       {
+        .callback = thermal_temp_b4_trip,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+               },
+       },
        {}
 };

[-- Attachment #2: acpi_thermal_HP6715b.patch --]
[-- Type: application/octet-stream, Size: 2911 bytes --]

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..de2b164 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,10 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
 
+static int temp_b4_trip;
+module_param(temp_b4_trip, int, 0);
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before initializing trip points.");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
 	if (!tz)
 		return -EINVAL;
 
-	/* Get trip points [_CRT, _PSV, etc.] (required) */
-	result = acpi_thermal_get_trip_points(tz);
-	if (result)
+	if( temp_b4_trip )
+	{ /* some CPUs, eg AMD K8 need temperature before trip points can be obtained */
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
 		return result;
-
-	/* Get temperature [_TMP] (required) */
-	result = acpi_thermal_get_temperature(tz);
-	if (result)
+	    
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
 		return result;
-
+	}else
+	{ /* newer x86_64s need trip points set before temperature obtained */
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
+		return result;
+	    
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
+		return result;
+	}
+	
 	/* Set the cooling mode [_SCP] to active cooling (default) */
 	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
 	if (!result)
 		tz->flags.cooling_mode = 1;
-
+	
 	/* Get default polling frequency [_TZP] (optional) */
 	if (tzp)
 		tz->polling_frequency = tzp;
 	else
 		acpi_thermal_get_polling_frequency(tz);
-
+	
 	return 0;
 }
 
@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct dmi_system_id *d) {
 	return 0;
 }
 
+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+	printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point initialisation\n", d->ident);
+	temp_b4_trip = 1;
+	return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
 	/*
 	 * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
 		},
 	},
+	{
+	 .callback = thermal_temp_b4_trip,
+	 .ident = "HP 6715b laptop",
+	 .matches = {
+		     DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+		     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+		},
+	},
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s
  2012-07-08 18:50 [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s Jason Vas Dias
@ 2012-07-09  0:30 ` Rusty Russell
  2012-07-09 18:16   ` Jason Vas Dias
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2012-07-09  0:30 UTC (permalink / raw)
  To: Jason Vas Dias, linux-kernel
  Cc: Andreas Herrmann, Matthew Garrett, Len Brown, Comrade DOS

On Sun, 8 Jul 2012 19:50:54 +0100, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
> This patch adds a new acpi.thermal.temp_b4_trip = 1 settting, which
> causes the temperature
> to be set before evaluation of thermal trip points (the old default) ;
>  this mode should
> be selected automatically by DMI match if the system identifies as "HP
> Compaq 6715b" .
> 
> Please consider applying a patch like that attached to fix the issue reported
> in lkml thread "Re: PROBLEM: Performance drop" recently,  whereby
> it was found that HP 6715b laptops ( which have 2.2Ghz dual-core  AMD
> x86_64 k8 CPUs)
> get stuck running the CPU at 800Khz and cannot switch frequency. I have verified
> that this still the case with v3.4.4 tagged "stable" kernel.


> 
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 7dbebea..de2b164 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -96,6 +96,10 @@ static int psv;
>  module_param(psv, int, 0644);
>  MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
> 
> +static int temp_b4_trip;
> +module_param(temp_b4_trip, int, 0);
> +MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before
> initializing trip points.");
> +

Hi Jason,

        Two points: this is a bool, why not make it one?  I know, the
rest of the code is old-school, but this is a new parameter.  Also, why
not 0644 so it can be read and set at runtime?

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s
  2012-07-09  0:30 ` Rusty Russell
@ 2012-07-09 18:16   ` Jason Vas Dias
  2012-07-10  0:06     ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Vas Dias @ 2012-07-09 18:16 UTC (permalink / raw)
  To: Rusty Russell
  Cc: linux-kernel, Andreas Herrmann, Matthew Garrett, Len Brown, Comrade DOS

[-- Attachment #1: Type: text/plain, Size: 6291 bytes --]

Thanks Rusty - sorry I didn't see your email until now - revised patch
addressing your comments attached -
BTW,  sorry about the word wrap on the initial posting - should I
attach a '.patch' file or inline ?  Trying both .

The Revised Patch (against :
commit bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Jul 7 17:23:56 2012 -0700

    Linux 3.5-rc6
) :
$ git diff bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a >
/tmp/acpi_thermal_temp_b4_trip.patch
$ cat /tmp/acpi_thermal_temp_b4_trip.patch
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..13d3b22 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,10 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip
points.");

+static bool temp_b4_trip;
+module_param(temp_b4_trip, bool, 0644);
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before
initializing trip points.");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct
acpi_thermal *tz)
        if (!tz)
                return -EINVAL;

-       /* Get trip points [_CRT, _PSV, etc.] (required) */
-       result = acpi_thermal_get_trip_points(tz);
-       if (result)
+       if( temp_b4_trip )
+       { /* some CPUs, eg AMD K8 need temperature before trip points
can be obtained */
+           /* Get temperature [_TMP] (required) */
+           result = acpi_thermal_get_temperature(tz);
+           if (result)
                return result;
-
-       /* Get temperature [_TMP] (required) */
-       result = acpi_thermal_get_temperature(tz);
-       if (result)
+
+           /* Get trip points [_CRT, _PSV, etc.] (required) */
+           result = acpi_thermal_get_trip_points(tz);
+           if (result)
                return result;
-
+       }else
+       { /* newer x86_64s need trip points set before temperature
obtained */
+           /* Get trip points [_CRT, _PSV, etc.] (required) */
+           result = acpi_thermal_get_trip_points(tz);
+           if (result)
+               return result;
+
+           /* Get temperature [_TMP] (required) */
+           result = acpi_thermal_get_temperature(tz);
+           if (result)
+               return result;
+       }
+
        /* Set the cooling mode [_SCP] to active cooling (default) */
        result = acpi_thermal_set_cooling_mode(tz,
ACPI_THERMAL_MODE_ACTIVE);
        if (!result)
                tz->flags.cooling_mode = 1;
-
+
        /* Get default polling frequency [_TZP] (optional) */
        if (tzp)
                tz->polling_frequency = tzp;
        else
                acpi_thermal_get_polling_frequency(tz);
-
+
        return 0;
 }

@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct
dmi_system_id *d) {
        return 0;
 }

+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+       printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point
initialisation\n", d->ident);
+       temp_b4_trip = TRUE;
+       return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
        /*
         * Award BIOS on this AOpen makes thermal control almost
worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[]
__initdata = {
                DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
                },
        },
+       {
+        .callback = thermal_temp_b4_trip,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+               },
+       },
        {}
 };

Incidentally,  there are still plenty of cpufreq and temperature
related issues on this platform :
    with the "ondemand" or "performance"  governors,  placing a large
load on system
      ( eg. building gcc-4.7.1 ) makes the CPU switch into highest
frequency, but not switch
     down after the 65 degree trip point has been toggled once .
     And once the trip point has been reached once and the temperature
falls below 65, returning CPU freq to 2GHz,
     the reported temperature seems to be stuck at 62 degrees even
though the base of   the laptop nearly burns my hand .
     So I get emergency overheating reboots unless I manually run my
cpufreq & temperature monitoring scripts -
     which, if the CPU freq is 2Ghz,  now have to down the freqency to
800Khz for 2 seconds every 8 seconds
regardless of what temperature
     is reported .


On Mon, Jul 9, 2012 at 1:30 AM, Rusty Russell <rusty@ozlabs.org> wrote:
> On Sun, 8 Jul 2012 19:50:54 +0100, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
>> This patch adds a new acpi.thermal.temp_b4_trip = 1 settting, which
>> causes the temperature
>> to be set before evaluation of thermal trip points (the old default) ;
>>  this mode should
>> be selected automatically by DMI match if the system identifies as "HP
>> Compaq 6715b" .
>>
>> Please consider applying a patch like that attached to fix the issue reported
>> in lkml thread "Re: PROBLEM: Performance drop" recently,  whereby
>> it was found that HP 6715b laptops ( which have 2.2Ghz dual-core  AMD
>> x86_64 k8 CPUs)
>> get stuck running the CPU at 800Khz and cannot switch frequency. I have verified
>> that this still the case with v3.4.4 tagged "stable" kernel.
>
>
>>
>> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
>> index 7dbebea..de2b164 100644
>> --- a/drivers/acpi/thermal.c
>> +++ b/drivers/acpi/thermal.c
>> @@ -96,6 +96,10 @@ static int psv;
>>  module_param(psv, int, 0644);
>>  MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
>>
>> +static int temp_b4_trip;
>> +module_param(temp_b4_trip, int, 0);
>> +MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before
>> initializing trip points.");
>> +
>
> Hi Jason,
>
>         Two points: this is a bool, why not make it one?  I know, the
> rest of the code is old-school, but this is a new parameter.  Also, why
> not 0644 so it can be read and set at runtime?
>
> Cheers,
> Rusty.

[-- Attachment #2: acpi_thermal_temp_b4_trip.patch --]
[-- Type: application/octet-stream, Size: 2919 bytes --]

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..13d3b22 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,10 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
 
+static bool temp_b4_trip;
+module_param(temp_b4_trip, bool, 0644);
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before initializing trip points.");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
 	if (!tz)
 		return -EINVAL;
 
-	/* Get trip points [_CRT, _PSV, etc.] (required) */
-	result = acpi_thermal_get_trip_points(tz);
-	if (result)
+	if( temp_b4_trip )
+	{ /* some CPUs, eg AMD K8 need temperature before trip points can be obtained */
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
 		return result;
-
-	/* Get temperature [_TMP] (required) */
-	result = acpi_thermal_get_temperature(tz);
-	if (result)
+	    
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
 		return result;
-
+	}else
+	{ /* newer x86_64s need trip points set before temperature obtained */
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
+		return result;
+	    
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
+		return result;
+	}
+	
 	/* Set the cooling mode [_SCP] to active cooling (default) */
 	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
 	if (!result)
 		tz->flags.cooling_mode = 1;
-
+	
 	/* Get default polling frequency [_TZP] (optional) */
 	if (tzp)
 		tz->polling_frequency = tzp;
 	else
 		acpi_thermal_get_polling_frequency(tz);
-
+	
 	return 0;
 }
 
@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct dmi_system_id *d) {
 	return 0;
 }
 
+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+	printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point initialisation\n", d->ident);
+	temp_b4_trip = TRUE;
+	return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
 	/*
 	 * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
 		},
 	},
+	{
+	 .callback = thermal_temp_b4_trip,
+	 .ident = "HP 6715b laptop",
+	 .matches = {
+		     DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+		     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+		},
+	},
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s
  2012-07-09 18:16   ` Jason Vas Dias
@ 2012-07-10  0:06     ` Rusty Russell
  0 siblings, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2012-07-10  0:06 UTC (permalink / raw)
  To: Jason Vas Dias
  Cc: linux-kernel, Andreas Herrmann, Matthew Garrett, Len Brown, Comrade DOS

On Mon, 9 Jul 2012 19:16:24 +0100, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
> Thanks Rusty - sorry I didn't see your email until now - revised patch
> addressing your comments attached -
> BTW,  sorry about the word wrap on the initial posting - should I
> attach a '.patch' file or inline ?  Trying both .

The inline one was wrapped.

> +static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
> +
> +       printk(KERN_NOTICE "ACPI: %s detected: : "
> +                           "getting temperature before trip point
> initialisation\n", d->ident);
> +       temp_b4_trip = TRUE;
> +       return 0;
> +}

TRUE?  true is standard with stdbool.h.

The patch itself looks reasonable, but it's not my area: I just spotted
the module_param() abuse :)

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH: 1/1] ACPI: make evaluation of thermal trip points before  temperature or vice versa dependant on new "temp_b4_trip" module parameter to  support older AMD x86_64s
@ 2012-07-14 11:45 Jason Vas Dias
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Vas Dias @ 2012-07-14 11:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Andreas Herrmann, Matthew Garrett, Len Brown,
	Comrade DOS

[-- Attachment #1: Type: Text/Plain, Size: 7317 bytes --]

 This patch adds a new acpi.thermal.temp_b4_trip = 1 settting, which
 causes the temperature to be set before evaluation of thermal trip points (the old default) .
 This mode should be selected automatically by DMI match if the system identifies as 
  "HPCompaq 6715b" .
 Please consider applying a patch like that attached to fix the issue reported
 in lkml thread "Re: PROBLEM: Performance drop" recently,  whereby
 it was found that HP 6715b laptops ( which have 2.2Ghz dual-core  AMD
 x86_64 k8 CPUs) get stuck running the CPU at 800Khz and cannot switch frequency. 

 I have verified that this still the case with v3.4.4 tagged "stable" kernel. and with v3.5-rc6,
 which this is a patch against ( ie. against commit bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a :
 "Linux 3.5-rc6" :

diff --git a/Makefile b/Makefile                            
index 81ea154..bf02707 100644                               
--- a/Makefile                                              
+++ b/Makefile                                              
@@ -1,7 +1,7 @@                                             
 VERSION = 3                                                
 PATCHLEVEL = 5                                             
 SUBLEVEL = 0                                               
-EXTRAVERSION = -rc5                                        
+EXTRAVERSION = -rc6                                        
 NAME = Saber-toothed Squirrel                              
                                                            
 # *DOCUMENTATION*                                          
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..13d3b22 100644                               
--- a/drivers/acpi/thermal.c                                
+++ b/drivers/acpi/thermal.c                                
@@ -96,6 +96,10 @@ static int psv;                          
 module_param(psv, int, 0644);                              
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
                                                                       
+static bool temp_b4_trip;                                             
+module_param(temp_b4_trip, bool, 0644);                               
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before initializing trip points.");
+                                                                                       
 static int acpi_thermal_add(struct acpi_device *device);                               
 static int acpi_thermal_remove(struct acpi_device *device, int type);                  
 static int acpi_thermal_resume(struct acpi_device *device);                            
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)         
        if (!tz)                                                                        
                return -EINVAL;                                                         
                                                                                        
-       /* Get trip points [_CRT, _PSV, etc.] (required) */                             
-       result = acpi_thermal_get_trip_points(tz);                                      
-       if (result)                                                                     
+       if( temp_b4_trip )                                                              
+       { /* some CPUs, eg AMD K8 need temperature before trip points can be obtained */
+           /* Get temperature [_TMP] (required) */                                     
+           result = acpi_thermal_get_temperature(tz);                                  
+           if (result)                                                                 
                return result;                                                          
-                                                                                       
-       /* Get temperature [_TMP] (required) */                                         
-       result = acpi_thermal_get_temperature(tz);                                      
-       if (result)                                                                     
+                                                                                       
+           /* Get trip points [_CRT, _PSV, etc.] (required) */                         
+           result = acpi_thermal_get_trip_points(tz);                                  
+           if (result)                                                                 
                return result;                                                          
-                                                                                       
+       }else                                                                           
+       { /* newer x86_64s need trip points set before temperature obtained */          
+           /* Get trip points [_CRT, _PSV, etc.] (required) */                         
+           result = acpi_thermal_get_trip_points(tz);                                  
+           if (result)                                                                 
+               return result;                                                          
+                                                                                       
+           /* Get temperature [_TMP] (required) */                                     
+           result = acpi_thermal_get_temperature(tz);                                  
+           if (result)                                                                 
+               return result;                                                          
+       }                                                                               
+                                                                                       
        /* Set the cooling mode [_SCP] to active cooling (default) */                   
        result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
        if (!result)
                tz->flags.cooling_mode = 1;
-
+
        /* Get default polling frequency [_TZP] (optional) */
        if (tzp)
                tz->polling_frequency = tzp;
        else
                acpi_thermal_get_polling_frequency(tz);
-
+
        return 0;
 }

@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct dmi_system_id *d) {
        return 0;
 }

+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+       printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point initialisation\n", d->ident);
+       temp_b4_trip = TRUE;
+       return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
        /*
         * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
                DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
                },
        },
+       {
+        .callback = thermal_temp_b4_trip,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+               },
+       },
        {}
 };




[-- Attachment #2: ACPI-Thermal-PROBLEM_performance_X86_64_K8.patch --]
[-- Type: text/x-patch, Size: 3165 bytes --]

diff --git a/Makefile b/Makefile
index 81ea154..bf02707 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 5
 SUBLEVEL = 0
-EXTRAVERSION = -rc5
+EXTRAVERSION = -rc6
 NAME = Saber-toothed Squirrel
 
 # *DOCUMENTATION*
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..13d3b22 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,10 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
 
+static bool temp_b4_trip;
+module_param(temp_b4_trip, bool, 0644);
+MODULE_PARM_DESC(temp_b4_trip, "Get the temperature before initializing trip points.");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -941,27 +945,41 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
 	if (!tz)
 		return -EINVAL;
 
-	/* Get trip points [_CRT, _PSV, etc.] (required) */
-	result = acpi_thermal_get_trip_points(tz);
-	if (result)
+	if( temp_b4_trip )
+	{ /* some CPUs, eg AMD K8 need temperature before trip points can be obtained */
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
 		return result;
-
-	/* Get temperature [_TMP] (required) */
-	result = acpi_thermal_get_temperature(tz);
-	if (result)
+	    
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
 		return result;
-
+	}else
+	{ /* newer x86_64s need trip points set before temperature obtained */
+	    /* Get trip points [_CRT, _PSV, etc.] (required) */
+	    result = acpi_thermal_get_trip_points(tz);
+	    if (result)
+		return result;
+	    
+	    /* Get temperature [_TMP] (required) */
+	    result = acpi_thermal_get_temperature(tz);
+	    if (result)
+		return result;
+	}
+	
 	/* Set the cooling mode [_SCP] to active cooling (default) */
 	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
 	if (!result)
 		tz->flags.cooling_mode = 1;
-
+	
 	/* Get default polling frequency [_TZP] (optional) */
 	if (tzp)
 		tz->polling_frequency = tzp;
 	else
 		acpi_thermal_get_polling_frequency(tz);
-
+	
 	return 0;
 }
 
@@ -1110,6 +1128,14 @@ static int thermal_psv(const struct dmi_system_id *d) {
 	return 0;
 }
 
+static int thermal_temp_b4_trip(const struct dmi_system_id *d) {
+
+	printk(KERN_NOTICE "ACPI: %s detected: : "
+                           "getting temperature before trip point initialisation\n", d->ident);
+	temp_b4_trip = TRUE;
+	return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
 	/*
 	 * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1147,6 +1173,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
 		},
 	},
+	{
+	 .callback = thermal_temp_b4_trip,
+	 .ident = "HP 6715b laptop",
+	 .matches = {
+		     DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+		     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+		},
+	},
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-14 11:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08 18:50 [PATCH: 1/1] ACPI: make evaluation of thermal trip points before temperature or vice versa dependant on new "temp_b4_trip" module parameter to support older AMD x86_64s Jason Vas Dias
2012-07-09  0:30 ` Rusty Russell
2012-07-09 18:16   ` Jason Vas Dias
2012-07-10  0:06     ` Rusty Russell
2012-07-14 11:45 Jason Vas Dias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).