[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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


 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"),
+               },
+       },
        {}
 };



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"),
+		},
+	},
 	{}
 };
 

[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Linux Kbuild]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]