linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID
@ 2010-05-07  9:54 Huaxu Wan
  2010-05-07 12:43 ` Jean Delvare
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-07  9:54 UTC (permalink / raw)
  To: linux-kernel, lm-sensors; +Cc: huaxu.wan, khali


The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
indicated by CPUID.06H.EAX[0].

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
---
 drivers/hwmon/coretemp.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index e9b7fbc..237c68d 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -440,6 +440,7 @@ static int __init coretemp_init(void)
 {
        int i, err = -ENODEV;
        struct pdev_entry *p, *n;
+       u32 eax;

        /* quick check if we run Intel */
        if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -450,23 +451,12 @@ static int __init coretemp_init(void)
                goto exit;

        for_each_online_cpu(i) {
-               struct cpuinfo_x86 *c = &cpu_data(i);
-
-               /* check if family 6, models 0xe (Pentium M DC),
-                 0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-                 0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-                 0x1e (Lynnfield) */
-               if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-                   !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-                       (c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-                       (c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-                       (c->x86_model == 0x1e))) {
-
-                       /* supported CPU not found, but report the unknown
-                          family 6 CPU */
-                       if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-                               printk(KERN_WARNING DRVNAME ": Unknown CPU "
-                                       "model 0x%x\n", c->x86_model);
+               /* check if the CPU has thermal sensor */
+               eax = cpuid_eax(0x06);
+               if (!(eax & 0x01)) {
+                       struct cpuinfo_x86 *c = &cpu_data(i);
+                       printk_once(KERN_WARNING DRVNAME ": CPU (model=0x%x)"
+                               " has no thermal sensor!\n", c->x86_model);
                        continue;
                }

--
1.6.3.3.363.g725cf7

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

* [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
@ 2010-05-07  9:59 Huaxu Wan
  2010-05-07 13:29 ` [lm-sensors] " Carsten Emde
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-07  9:59 UTC (permalink / raw)
  To: linux-kernel, lm-sensors; +Cc: huaxu.wan, khali


The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
processers.

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
---
 drivers/hwmon/coretemp.c |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 237c68d..7a01032 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -241,6 +241,49 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
        return tjmax;
 }

+static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
+{
+       /* The 100C is default for both mobile and non mobile CPUs */
+       int err;
+       u32 eax, edx;
+       u32 val;
+
+       /* A new feature of current Intel(R) processors, the
+          IA32_TEMPERATURE_TARGET(0x1a2) contains the TjMax value */
+       err = rdmsr_safe_on_cpu(id, 0x1a2, &eax, &edx);
+       if (err){
+               printk_once(KERN_WARNING DRVNAME  " : Unable to read TjMax from CPU.\n");
+       } else {
+               val = (eax >> 16 ) & 0xff;
+               /* If the TjMax is not reasonable, an assumption value
+                  will be used */
+               if (( val > 80) && (val < 120)){
+                       printk_once(KERN_INFO DRVNAME " : The TjMax is %d C. \n", val);
+                       return val * 1000;
+               }
+       }
+
+       /* For the early CPUs, an approximation is given.
+        NOTE: the given value may not be correct. */
+       switch(c->x86_model){
+       case 0xe :
+       case 0xf :
+       case 0x16 :
+       case 0x1a :
+               printk_once(KERN_WARNING DRVNAME  " : TjMax is assumed as 100 C! \n");
+               return 100000;
+               break;
+       case 0x17 :
+       case 0x1c :             /* Atom CPUs */
+               return adjust_tjmax(c, id, dev);
+               break;
+       default :
+               printk_once(KERN_WARNING DRVNAME " : Your CPU is not support yet,"
+                       "using the default TjMax: 100 C.\n");
+               return 100000;
+       }
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
        struct coretemp_data *data;
@@ -283,7 +326,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
                }
        }

-       data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
+       data->tjmax = get_tjmax(c, data->id, &pdev->dev);
        platform_set_drvdata(pdev, data);

        /* read the still undocumented IA32_TEMPERATURE_TARGET it exists
--
1.6.3.3.363.g725cf7

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

* Re: [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-07  9:54 [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID Huaxu Wan
@ 2010-05-07 12:43 ` Jean Delvare
  2010-05-07 13:21 ` [lm-sensors] " Carsten Emde
  2010-05-10  3:35 ` [PATCH 1/2 V2] " Huaxu Wan
  2 siblings, 0 replies; 34+ messages in thread
From: Jean Delvare @ 2010-05-07 12:43 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan

Hi Huawu,

On Fri, 7 May 2010 17:54:59 +0800, Huaxu Wan wrote:
> 
> The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
> indicated by CPUID.06H.EAX[0].

I can see that you are sending these two patches for quite some time
and I understand you'd like them to get finally reviewed and merged.
Unfortunately I simply don't have the time for this. So please don't
wait for my ack, just send your patches to Andrew Morton and hopefully
he will take care.

> 
> Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
> ---
>  drivers/hwmon/coretemp.c |   24 +++++++-----------------
>  1 files changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index e9b7fbc..237c68d 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -440,6 +440,7 @@ static int __init coretemp_init(void)
>  {
>         int i, err = -ENODEV;
>         struct pdev_entry *p, *n;
> +       u32 eax;
> 
>         /* quick check if we run Intel */
>         if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
> @@ -450,23 +451,12 @@ static int __init coretemp_init(void)
>                 goto exit;
> 
>         for_each_online_cpu(i) {
> -               struct cpuinfo_x86 *c = &cpu_data(i);
> -
> -               /* check if family 6, models 0xe (Pentium M DC),
> -                 0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
> -                 0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
> -                 0x1e (Lynnfield) */
> -               if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
> -                   !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
> -                       (c->x86_model == 0x16) || (c->x86_model == 0x17) ||
> -                       (c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
> -                       (c->x86_model == 0x1e))) {
> -
> -                       /* supported CPU not found, but report the unknown
> -                          family 6 CPU */
> -                       if ((c->x86 == 0x6) && (c->x86_model > 0xf))
> -                               printk(KERN_WARNING DRVNAME ": Unknown CPU "
> -                                       "model 0x%x\n", c->x86_model);
> +               /* check if the CPU has thermal sensor */
> +               eax = cpuid_eax(0x06);
> +               if (!(eax & 0x01)) {
> +                       struct cpuinfo_x86 *c = &cpu_data(i);
> +                       printk_once(KERN_WARNING DRVNAME ": CPU (model=0x%x)"
> +                               " has no thermal sensor!\n", c->x86_model);
>                         continue;
>                 }
> 
> --
> 1.6.3.3.363.g725cf7


-- 
Jean Delvare

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

* Re: [lm-sensors] [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-07  9:54 [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID Huaxu Wan
  2010-05-07 12:43 ` Jean Delvare
@ 2010-05-07 13:21 ` Carsten Emde
  2010-05-10  2:35   ` Huaxu Wan
  2010-05-10  3:35 ` [PATCH 1/2 V2] " Huaxu Wan
  2 siblings, 1 reply; 34+ messages in thread
From: Carsten Emde @ 2010-05-07 13:21 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: LKML, lm-sensors, Huaxu Wan

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

Hi Huaxu,

> The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
> indicated by CPUID.06H.EAX[0].
Thanks, works great, successfully tested it on an i7 machine.

I would propose to use dev_warn() instead of printk_once(), since all
other per-cpu info is also logged this way.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>


[-- Attachment #2: coretemp-simplify-intel-thermal-sensor-recognition.patch --]
[-- Type: text/x-patch, Size: 1536 bytes --]

---
 drivers/hwmon/coretemp.c |   23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

Index: head/drivers/hwmon/coretemp.c
===================================================================
--- head.orig/drivers/hwmon/coretemp.c
+++ head/drivers/hwmon/coretemp.c
@@ -440,6 +440,7 @@ static int __init coretemp_init(void)
 {
 	int i, err = -ENODEV;
 	struct pdev_entry *p, *n;
+	u32 eax;
 
 	/* quick check if we run Intel */
 	if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -450,23 +451,13 @@ static int __init coretemp_init(void)
 		goto exit;
 
 	for_each_online_cpu(i) {
-		struct cpuinfo_x86 *c = &cpu_data(i);
+		/* check if the CPU has thermal sensor */
+		eax = cpuid_eax(0x06);
+		if (!(eax & 0x01)) {
+			struct cpuinfo_x86 *c = &cpu_data(i);
 
-		/* check if family 6, models 0xe (Pentium M DC),
-		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-		  0x1e (Lynnfield) */
-		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-			(c->x86_model == 0x1e))) {
-
-			/* supported CPU not found, but report the unknown
-			   family 6 CPU */
-			if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-				printk(KERN_WARNING DRVNAME ": Unknown CPU "
-					"model 0x%x\n", c->x86_model);
+			dev_warn("CPU (model=0x%x) has no thermal sensor!\n",
+			    c->x86_model);
 			continue;
 		}
 

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-07  9:59 [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR Huaxu Wan
@ 2010-05-07 13:29 ` Carsten Emde
  2010-05-10  3:09   ` Huaxu Wan
  2010-05-10  3:50 ` [PATCH 2/2 V2] " Huaxu Wan
  2010-05-29  5:39 ` [PATCH 2/2] " Maxim Levitsky
  2 siblings, 1 reply; 34+ messages in thread
From: Carsten Emde @ 2010-05-07 13:29 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, Huaxu Wan

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

Hi Huaxu,

> The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> processers.
I took the liberty to make some very minor changes to your patch:
- Unified and adapted messages and comments
- Added a definition of MSR_IA32_TEMPERATURE_TARGET to the arch header
- Replaced 0x1a2 by MSR_IA32_TEMPERATURE_TARGET
- Applied changes suggested by checkpatch

Hope you like it.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>

[-- Attachment #2: coretemp-add-tjmax-method-for-i-series-processors.patch --]
[-- Type: text/x-patch, Size: 3105 bytes --]

---
 arch/x86/include/asm/msr-index.h |    3 ++
 drivers/hwmon/coretemp.c         |   54 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 53 insertions(+), 4 deletions(-)

Index: head/arch/x86/include/asm/msr-index.h
===================================================================
--- head.orig/arch/x86/include/asm/msr-index.h
+++ head/arch/x86/include/asm/msr-index.h
@@ -277,6 +277,9 @@
 #define MSR_IA32_MCG_EIP		0x00000189
 #define MSR_IA32_MCG_RESERVED		0x0000018a
 
+/* Specific to i series processors */
+#define MSR_IA32_TEMPERATURE_TARGET	0x000001a2
+
 /* Pentium IV performance counter MSRs */
 #define MSR_P4_BPU_PERFCTR0		0x00000300
 #define MSR_P4_BPU_PERFCTR1		0x00000301
Index: head/drivers/hwmon/coretemp.c
===================================================================
--- head.orig/drivers/hwmon/coretemp.c
+++ head/drivers/hwmon/coretemp.c
@@ -153,7 +153,8 @@ static struct coretemp_data *coretemp_up
 	return data;
 }
 
-static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
+static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
+				  struct device *dev)
 {
 	/* The 100C is default for both mobile and non mobile CPUs */
 
@@ -241,6 +242,51 @@ static int __devinit adjust_tjmax(struct
 	return tjmax;
 }
 
+static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id,
+			       struct device *dev)
+{
+	int err;
+	u32 eax, edx;
+	u32 val;
+
+	err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
+	if (err)
+		dev_warn(dev, "Unable to read TjMax from CPU.\n");
+	else {
+		val = (eax >> 16) & 0xff;
+		if (val > 80 && val < 120) {
+			dev_info(dev, "TjMax is %dC.\n", val);
+			return val * 1000;
+		} else {
+			dev_warn(dev, "TjMax of %dC not plausible,"
+			    " using 100C instead." , val);
+			return 100000;
+		}
+	}
+
+	/*
+	 * An assumption is made for early CPUs and unreadable MSR.
+	 * NOTE: the given value may not be correct.
+	 */
+	switch (c->x86_model) {
+	case 0x0e:
+	case 0x0f:
+	case 0x16:
+	case 0x1a:
+		dev_warn(dev, "TjMax is assumed as 100C!\n");
+		return 100000;
+		break;
+	case 0x17:
+	case 0x1c: /* Atom CPUs */
+		return adjust_tjmax(c, id, dev);
+		break;
+	default:
+		dev_warn(dev, "CPU (model=0x%x) is not supported yet,"
+		    " using default TjMax of 100C.\n", c->x86_model);
+		return 100000;
+	}
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -283,14 +329,14 @@ static int __devinit coretemp_probe(stru
 		}
 	}
 
-	data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
+	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
 	platform_set_drvdata(pdev, data);
 
 	/* read the still undocumented IA32_TEMPERATURE_TARGET it exists
 	   on older CPUs but not in this register, Atoms don't have it either */
-
 	if ((c->x86_model > 0xe) && (c->x86_model != 0x1c)) {
-		err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx);
+		err = rdmsr_safe_on_cpu(data->id, MSR_IA32_TEMPERATURE_TARGET,
+		     &eax, &edx);
 		if (err) {
 			dev_warn(&pdev->dev, "Unable to read"
 					" IA32_TEMPERATURE_TARGET MSR\n");

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

* Re: [lm-sensors] [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-07 13:21 ` [lm-sensors] " Carsten Emde
@ 2010-05-10  2:35   ` Huaxu Wan
  0 siblings, 0 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-10  2:35 UTC (permalink / raw)
  To: Carsten Emde; +Cc: Huaxu Wan, LKML, lm-sensors, Huaxu Wan

On 15:21 Fri 07 May, Carsten Emde wrote:
> Hi Huaxu,
> 
> > The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
> > indicated by CPUID.06H.EAX[0].
> Thanks, works great, successfully tested it on an i7 machine.
> 
> I would propose to use dev_warn() instead of printk_once(), since all
> other per-cpu info is also logged this way.
> 
> Signed-off-by: Carsten Emde <C.Emde@osadl.org>
> 

That reminds me that dev_warn is right one on multiple CPU system, especially with different CPUs. Thank you.

> ---
>  drivers/hwmon/coretemp.c |   23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)
> 
> Index: head/drivers/hwmon/coretemp.c
> ===================================================================
> --- head.orig/drivers/hwmon/coretemp.c
> +++ head/drivers/hwmon/coretemp.c
> @@ -440,6 +440,7 @@ static int __init coretemp_init(void)
>  {
>  	int i, err = -ENODEV;
>  	struct pdev_entry *p, *n;
> +	u32 eax;
>  
>  	/* quick check if we run Intel */
>  	if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
> @@ -450,23 +451,13 @@ static int __init coretemp_init(void)
>  		goto exit;
>  
>  	for_each_online_cpu(i) {
> -		struct cpuinfo_x86 *c = &cpu_data(i);
> +		/* check if the CPU has thermal sensor */
> +		eax = cpuid_eax(0x06);
> +		if (!(eax & 0x01)) {
> +			struct cpuinfo_x86 *c = &cpu_data(i);
>  
> -		/* check if family 6, models 0xe (Pentium M DC),
> -		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
> -		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
> -		  0x1e (Lynnfield) */
> -		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
> -		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
> -			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
> -			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
> -			(c->x86_model == 0x1e))) {
> -
> -			/* supported CPU not found, but report the unknown
> -			   family 6 CPU */
> -			if ((c->x86 == 0x6) && (c->x86_model > 0xf))
> -				printk(KERN_WARNING DRVNAME ": Unknown CPU "
> -					"model 0x%x\n", c->x86_model);
> +			dev_warn("CPU (model=0x%x) has no thermal sensor!\n",
> +			    c->x86_model);
>  			continue;
>  		}
>  


-- 
Thanks
Huaxu

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-07 13:29 ` [lm-sensors] " Carsten Emde
@ 2010-05-10  3:09   ` Huaxu Wan
  0 siblings, 0 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-10  3:09 UTC (permalink / raw)
  To: Carsten Emde; +Cc: Huaxu Wan, linux-kernel, lm-sensors, Huaxu Wan

On 15:29 Fri 07 May, Carsten Emde wrote:

> +	err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
> +	if (err)
> +		dev_warn(dev, "Unable to read TjMax from CPU.\n");
> +	else {
> +		val = (eax >> 16) & 0xff;
> +		if (val > 80 && val < 120) {
> +			dev_info(dev, "TjMax is %dC.\n", val);
> +			return val * 1000;
> +		} else {
> +			dev_warn(dev, "TjMax of %dC not plausible,"
> +			    " using 100C instead." , val);
> +			return 100000;
> +		}
> +	}

The CPU, in the following case switch, may return no err at the above rdmsr. The
val is 0 with CPU model 0x0f in my test. The function should not return when
(val > 80 && val < 120) is false. 

> +
> +	/*
> +	 * An assumption is made for early CPUs and unreadable MSR.
> +	 * NOTE: the given value may not be correct.
> +	 */
> +	switch (c->x86_model) {
> +	case 0x0e:
> +	case 0x0f:
> +	case 0x16:
> +	case 0x1a:
> +		dev_warn(dev, "TjMax is assumed as 100C!\n");
> +		return 100000;
> +		break;
> +	case 0x17:
> +	case 0x1c: /* Atom CPUs */
> +		return adjust_tjmax(c, id, dev);
> +		break;
> +	default:
> +		dev_warn(dev, "CPU (model=0x%x) is not supported yet,"
> +		    " using default TjMax of 100C.\n", c->x86_model);
> +		return 100000;
> +	}
> +}

-- 
Thanks
Huaxu

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

* [PATCH 1/2 V2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-07  9:54 [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID Huaxu Wan
  2010-05-07 12:43 ` Jean Delvare
  2010-05-07 13:21 ` [lm-sensors] " Carsten Emde
@ 2010-05-10  3:35 ` Huaxu Wan
  2010-05-10 12:45   ` Valdis.Kletnieks
  2010-05-11  8:01   ` [PATCH 1/2 V3] " Huaxu Wan
  2 siblings, 2 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-10  3:35 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, Carsten Emde


The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
indicated by CPUID.06H.EAX[0].

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
---
 drivers/hwmon/coretemp.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index e9b7fbc..d194207 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -440,6 +440,7 @@ static int __init coretemp_init(void)
 {
 	int i, err = -ENODEV;
 	struct pdev_entry *p, *n;
+	u32 eax;
 
 	/* quick check if we run Intel */
 	if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -450,23 +451,12 @@ static int __init coretemp_init(void)
 		goto exit;
 
 	for_each_online_cpu(i) {
-		struct cpuinfo_x86 *c = &cpu_data(i);
-
-		/* check if family 6, models 0xe (Pentium M DC),
-		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-		  0x1e (Lynnfield) */
-		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-			(c->x86_model == 0x1e))) {
-
-			/* supported CPU not found, but report the unknown
-			   family 6 CPU */
-			if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-				printk(KERN_WARNING DRVNAME ": Unknown CPU "
-					"model 0x%x\n", c->x86_model);
+ 		/* check if the CPU has thermal sensor */
+ 		eax = cpuid_eax(0x06);
+ 		if (!(eax & 0x01)) {
+ 			struct cpuinfo_x86 *c = &cpu_data(i);
+ 			printk(KERN_WARNING DRVNAME ": CPU (model=0x%x)"
+ 				" has no thermal sensor!\n", c->x86_model);
 			continue;
 		}
 
-- 
1.6.3.3.363.g725cf7


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

* [PATCH 2/2 V2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-07  9:59 [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR Huaxu Wan
  2010-05-07 13:29 ` [lm-sensors] " Carsten Emde
@ 2010-05-10  3:50 ` Huaxu Wan
  2010-05-29  5:39 ` [PATCH 2/2] " Maxim Levitsky
  2 siblings, 0 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-10  3:50 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, Carsten Emde

The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
processers.

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
---
 arch/x86/include/asm/msr-index.h |    2 +
 drivers/hwmon/coretemp.c         |   52 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 4604e6a..9bc0cf8 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -232,6 +232,8 @@
 
 #define MSR_IA32_MISC_ENABLE		0x000001a0
 
+#define MSR_IA32_TEMPERATURE_TARGET	0x000001a2
+
 /* MISC_ENABLE bits: architectural */
 #define MSR_IA32_MISC_ENABLE_FAST_STRING	(1ULL << 0)
 #define MSR_IA32_MISC_ENABLE_TCC		(1ULL << 1)
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index d194207..9959390 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -241,6 +241,54 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
 	return tjmax;
 }
 
+static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
+{
+	/* The 100C is default for both mobile and non mobile CPUs */
+	int err;
+	u32 eax, edx;
+	u32 val;
+
+	/* A new feature of current Intel(R) processors, the
+	   IA32_TEMPERATURE_TARGET contains the TjMax value */
+	err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
+	if (err){
+		dev_warn(dev, "Unable to read TjMax from CPU.\n");
+	} else {
+		val = (eax >> 16 ) & 0xff;
+		/*
+		 * If the TjMax is not plausible, an assumption
+		 * will be used
+		 */
+		if (( val > 80) && (val < 120)){
+			dev_info(dev, "TjMax is %d C. \n", val);
+			return val * 1000;
+		}
+	}
+
+	/*
+	 * An assumption is made for early CPUs and unreadable MSR.
+	 * NOTE: the given value may not be correct.
+	 */
+
+	switch(c->x86_model){
+	case 0xe :
+	case 0xf :
+	case 0x16 :
+	case 0x1a :
+		dev_warn(dev, "TjMax is assumed as 100 C! \n");
+		return 100000;
+		break;
+	case 0x17 :
+	case 0x1c :		/* Atom CPUs */
+		return adjust_tjmax(c, id, dev);
+		break;
+	default :
+		dev_warn(dev, "CPU (model=0x%x) is not supported yet,"
+			" using default TjMax of 100C.\n", c->x86_model);
+		return 100000;
+	}
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -283,14 +331,14 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 		}
 	}
 
-	data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
+	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
 	platform_set_drvdata(pdev, data);
 
 	/* read the still undocumented IA32_TEMPERATURE_TARGET it exists
 	   on older CPUs but not in this register, Atoms don't have it either */
 
 	if ((c->x86_model > 0xe) && (c->x86_model != 0x1c)) {
-		err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx);
+		err = rdmsr_safe_on_cpu(data->id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
 		if (err) {
 			dev_warn(&pdev->dev, "Unable to read"
 					" IA32_TEMPERATURE_TARGET MSR\n");
-- 
1.6.3.3.363.g725cf7


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

* Re: [PATCH 1/2 V2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-10  3:35 ` [PATCH 1/2 V2] " Huaxu Wan
@ 2010-05-10 12:45   ` Valdis.Kletnieks
  2010-05-11  3:41     ` Huaxu Wan
  2010-05-11  8:01   ` [PATCH 1/2 V3] " Huaxu Wan
  1 sibling, 1 reply; 34+ messages in thread
From: Valdis.Kletnieks @ 2010-05-10 12:45 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, Carsten Emde

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

On Mon, 10 May 2010 11:35:25 +0800, Huaxu Wan said:
> 
> The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
> indicated by CPUID.06H.EAX[0].
> 
> Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
> Signed-off-by: Carsten Emde <C.Emde@osadl.org>
> ---
>  drivers/hwmon/coretemp.c |   24 +++++++-----------------
>  1 files changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index e9b7fbc..d194207 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -440,6 +440,7 @@ static int __init coretemp_init(void)
>  {
>  	int i, err = -ENODEV;
>  	struct pdev_entry *p, *n;
> +	u32 eax;
>  
>  	/* quick check if we run Intel */
>  	if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
> @@ -450,23 +451,12 @@ static int __init coretemp_init(void)
>  		goto exit;
>  
>  	for_each_online_cpu(i) {
> -		struct cpuinfo_x86 *c = &cpu_data(i);
> -
> -		/* check if family 6, models 0xe (Pentium M DC),
> -		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
> -		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
> -		  0x1e (Lynnfield) */
> -		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
> -		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
> -			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
> -			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
> -			(c->x86_model == 0x1e))) {

So we remove something that checks the CPU level for a model we *expect*
to find a thermal sensor, and only throws a KERN_WARNING if we're on a
model we don't know about...

> + 		/* check if the CPU has thermal sensor */
> + 		eax = cpuid_eax(0x06);
> + 		if (!(eax & 0x01)) {
> + 			struct cpuinfo_x86 *c = &cpu_data(i);
> + 			printk(KERN_WARNING DRVNAME ": CPU (model=0x%x)"
> + 				" has no thermal sensor!\n", c->x86_model);

And replace it with a totally unprotected check that's going to fire off
a KERN_WARNING on every single CPU that Intel ever made that doesn't
include a hardware thermal sensor - including all the family 0-5,
and model < 0x0e hardware.

KERN_WARNING is for "We expected to find the hardware but it's gone off
for a walk on us".  If you wanted to say "Hmm.. this CPU doesn't have one"
you probably wanted KERN_DEBUG or *maybe* KERN_INFO.

[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: [PATCH 1/2 V2] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-10 12:45   ` Valdis.Kletnieks
@ 2010-05-11  3:41     ` Huaxu Wan
  0 siblings, 0 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-11  3:41 UTC (permalink / raw)
  To: Valdis.Kletnieks
  Cc: Huaxu Wan, linux-kernel, lm-sensors, huaxu.wan, Carsten Emde

On 08:45 Mon 10 May, Valdis.Kletnieks@vt.edu wrote:
> On Mon, 10 May 2010 11:35:25 +0800, Huaxu Wan said:
> > -
> > -		/* check if family 6, models 0xe (Pentium M DC),
> > -		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
> > -		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
> > -		  0x1e (Lynnfield) */
> > -		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
> > -		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
> > -			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
> > -			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
> > -			(c->x86_model == 0x1e))) {
> 
> So we remove something that checks the CPU level for a model we *expect*
> to find a thermal sensor, and only throws a KERN_WARNING if we're on a
> model we don't know about...
> 
> > + 		/* check if the CPU has thermal sensor */
> > + 		eax = cpuid_eax(0x06);
> > + 		if (!(eax & 0x01)) {
> > + 			struct cpuinfo_x86 *c = &cpu_data(i);
> > + 			printk(KERN_WARNING DRVNAME ": CPU (model=0x%x)"
> > + 				" has no thermal sensor!\n", c->x86_model);
> 
> And replace it with a totally unprotected check that's going to fire off
> a KERN_WARNING on every single CPU that Intel ever made that doesn't
> include a hardware thermal sensor - including all the family 0-5,
> and model < 0x0e hardware.

Oops! That's a bug. Thank you!

> 
> KERN_WARNING is for "We expected to find the hardware but it's gone off
> for a walk on us".  If you wanted to say "Hmm.. this CPU doesn't have one"
> you probably wanted KERN_DEBUG or *maybe* KERN_INFO.

I think the better one is KERN_INFO here. 

-- 
Thanks
Huaxu

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

* [PATCH 1/2 V3] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-10  3:35 ` [PATCH 1/2 V2] " Huaxu Wan
  2010-05-10 12:45   ` Valdis.Kletnieks
@ 2010-05-11  8:01   ` Huaxu Wan
  2010-05-11 21:45     ` Valdis.Kletnieks
  2010-05-14  3:20     ` [lm-sensors] " Henrique de Moraes Holschuh
  1 sibling, 2 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-11  8:01 UTC (permalink / raw)
  To: Huaxu Wan
  Cc: linux-kernel, lm-sensors, huaxu.wan, Carsten Emde, Valdis.Kletnieks

The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
indicated by CPUID.06H.EAX[0].

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
---
 drivers/hwmon/coretemp.c |   34 +++++++++++++---------------------
 1 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index e9b7fbc..be0ddcf 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -451,28 +451,20 @@ static int __init coretemp_init(void)

        for_each_online_cpu(i) {
                struct cpuinfo_x86 *c = &cpu_data(i);
+               /*
+                * CPUID.06H.EAX[0] indicates whether the CPU has thermal
+                * sensors. We check this bit only, all the early CPUs
+                * without thermal sensors will be filtered out.
+                */
+               if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
+                       err = coretemp_device_add(i);
+                       if (err)
+                               goto exit_devices_unreg;

-               /* check if family 6, models 0xe (Pentium M DC),
-                 0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-                 0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-                 0x1e (Lynnfield) */
-               if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-                   !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-                       (c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-                       (c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-                       (c->x86_model == 0x1e))) {
-
-                       /* supported CPU not found, but report the unknown
-                          family 6 CPU */
-                       if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-                               printk(KERN_WARNING DRVNAME ": Unknown CPU "
-                                       "model 0x%x\n", c->x86_model);
-                       continue;
-               }
-
-               err = coretemp_device_add(i);
-               if (err)
-                       goto exit_devices_unreg;
+               } else {
+                       printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
+                               " has no thermal sensor!\n", c->x86_model);
+               }
        }
        if (list_empty(&pdev_list)) {
                err = -ENODEV;
--
1.6.3.3.363.g725cf7

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

* Re: [PATCH 1/2 V3] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-11  8:01   ` [PATCH 1/2 V3] " Huaxu Wan
@ 2010-05-11 21:45     ` Valdis.Kletnieks
  2010-05-14  3:20     ` [lm-sensors] " Henrique de Moraes Holschuh
  1 sibling, 0 replies; 34+ messages in thread
From: Valdis.Kletnieks @ 2010-05-11 21:45 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, Carsten Emde

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

On Tue, 11 May 2010 16:01:12 +0800, Huaxu Wan said:
> The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
> indicated by CPUID.06H.EAX[0].
> 
> Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
> Signed-off-by: Carsten Emde <C.Emde@osadl.org>
> ---
>  drivers/hwmon/coretemp.c |   34 +++++++++++++---------------------
>  1 files changed, 13 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index e9b7fbc..be0ddcf 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -451,28 +451,20 @@ static int __init coretemp_init(void)
> 
>         for_each_online_cpu(i) {
>                 struct cpuinfo_x86 *c = &cpu_data(i);
> +               /*
> +                * CPUID.06H.EAX[0] indicates whether the CPU has thermal
> +                * sensors. We check this bit only, all the early CPUs
> +                * without thermal sensors will be filtered out.
> +                */
> +               if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
> +                       err = coretemp_device_add(i);
> +                       if (err)
> +                               goto exit_devices_unreg;

OK, that looks sane. :)  For what it's worth, feel free to stick on a

Reviewed-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>

[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: [lm-sensors] [PATCH 1/2 V3] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-11  8:01   ` [PATCH 1/2 V3] " Huaxu Wan
  2010-05-11 21:45     ` Valdis.Kletnieks
@ 2010-05-14  3:20     ` Henrique de Moraes Holschuh
  2010-05-14  6:58       ` [PATCH 1/2 V3 minor change] " Huaxu Wan
  1 sibling, 1 reply; 34+ messages in thread
From: Henrique de Moraes Holschuh @ 2010-05-14  3:20 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: huaxu.wan, Valdis.Kletnieks, linux-kernel, lm-sensors

On Tue, 11 May 2010, Huaxu Wan wrote:
> +                       printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
> +                               " has no thermal sensor!\n", c->x86_model);

IMHO, it is better to drop that "!" since it is now a simple status message,
otherwise it still looks like there is something wrong with the CPU not
having a thermal sensor.

Minor thing, really, so feel free to ignore this comment.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* [PATCH 1/2 V3 minor change] hwmon: (coretemp) Detect the thermal sensors by CPUID
  2010-05-14  3:20     ` [lm-sensors] " Henrique de Moraes Holschuh
@ 2010-05-14  6:58       ` Huaxu Wan
  2010-05-17  9:41         ` [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
  0 siblings, 1 reply; 34+ messages in thread
From: Huaxu Wan @ 2010-05-14  6:58 UTC (permalink / raw)
  To: linux-kernel, lm-sensors
  Cc: huaxu.wan, Valdis.Kletnieks, Henrique de Moraes Holschuh


The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
indicated by CPUID.06H.EAX[0].

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Reviewed-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
---
 drivers/hwmon/coretemp.c |   34 +++++++++++++---------------------
 1 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index e9b7fbc..885da2b 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -451,28 +451,20 @@ static int __init coretemp_init(void)
 
 	for_each_online_cpu(i) {
 		struct cpuinfo_x86 *c = &cpu_data(i);
+ 		/* 
+		 * CPUID.06H.EAX[0] indicates whether the CPU has thermal
+		 * sensors. We check this bit only, all the early CPUs
+		 * without thermal sensors will be filtered out. 
+		 */
+		if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
+			err = coretemp_device_add(i);
+			if (err)
+				goto exit_devices_unreg;
 
-		/* check if family 6, models 0xe (Pentium M DC),
-		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-		  0x1e (Lynnfield) */
-		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-			(c->x86_model == 0x1e))) {
-
-			/* supported CPU not found, but report the unknown
-			   family 6 CPU */
-			if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-				printk(KERN_WARNING DRVNAME ": Unknown CPU "
-					"model 0x%x\n", c->x86_model);
-			continue;
-		}
-
-		err = coretemp_device_add(i);
-		if (err)
-			goto exit_devices_unreg;
+		} else {
+			printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
+				" has no thermal sensor.\n", c->x86_model);
+		} 
 	}
 	if (list_empty(&pdev_list)) {
 		err = -ENODEV;
-- 
1.6.3.3.363.g725cf7


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

* [PATCH 0/2] hwmon: Update coretemp to current Intel processors
  2010-05-14  6:58       ` [PATCH 1/2 V3 minor change] " Huaxu Wan
@ 2010-05-17  9:41         ` Carsten Emde
  2010-05-17  9:41           ` [PATCH 1/2] Detect the thermal sensors by CPUID Carsten Emde
                             ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Carsten Emde @ 2010-05-17  9:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jean Delvare, Huaxu Wan, Carsten Emde, LM Sensors, LKML

Hi!

Here comes the current version of the coretemp patches. Huaxu did the initial
work; Jean suggested to submit them directly to Andrew.

I made some style changes as advised by checkpatch.

The patches have been tested successfully on Core 2 Duo and Quad, and on
Nehalem and Nehalem/Westmere where temperature readings were plausible and
changed with load as expected. When tested on an Atom processor (N270), the
temperature values were identical to previous versions of the coretemp
module and also changed with load. However, the readings should be higher
by 10 to 15C as compared to the outside temperature of the processor. Huaxu,
could you check? I would guess TjMax to be 105 instead of 90C in these
processors.

        Carsten.


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

* [PATCH 1/2] Detect the thermal sensors by CPUID
  2010-05-17  9:41         ` [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
@ 2010-05-17  9:41           ` Carsten Emde
  2010-05-17  9:41           ` [PATCH 2/2] Get TjMax value from MSR Carsten Emde
       [not found]           ` <AANLkTinQlH7LhCAz00WaHqbbslcSqipzVx4tDoQKSqIL@mail.gmail.com>
  2 siblings, 0 replies; 34+ messages in thread
From: Carsten Emde @ 2010-05-17  9:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jean Delvare, Huaxu Wan, Carsten Emde, LM Sensors, LKML,
	Henrique de Moraes Holschuh, Huaxu Wan

[-- Attachment #1: coretemp-simplify-intel-thermal-sensor-recognition.patch --]
[-- Type: text/plain, Size: 2062 bytes --]

The thermal sensors of Intel(R) CPUs can be detected by CPUID instruction,
indicated by CPUID.06H.EAX[0].

CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jean Delvare <khali@linux-fr.org>
CC: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Reviewed-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>

---
 drivers/hwmon/coretemp.c |   34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

Index: head/drivers/hwmon/coretemp.c
===================================================================
--- head.orig/drivers/hwmon/coretemp.c
+++ head/drivers/hwmon/coretemp.c
@@ -451,28 +451,20 @@ static int __init coretemp_init(void)
 
 	for_each_online_cpu(i) {
 		struct cpuinfo_x86 *c = &cpu_data(i);
-
-		/* check if family 6, models 0xe (Pentium M DC),
-		  0xf (Core 2 DC 65nm), 0x16 (Core 2 SC 65nm),
-		  0x17 (Penryn 45nm), 0x1a (Nehalem), 0x1c (Atom),
-		  0x1e (Lynnfield) */
-		if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
-		    !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
-			(c->x86_model == 0x16) || (c->x86_model == 0x17) ||
-			(c->x86_model == 0x1a) || (c->x86_model == 0x1c) ||
-			(c->x86_model == 0x1e))) {
-
-			/* supported CPU not found, but report the unknown
-			   family 6 CPU */
-			if ((c->x86 == 0x6) && (c->x86_model > 0xf))
-				printk(KERN_WARNING DRVNAME ": Unknown CPU "
-					"model 0x%x\n", c->x86_model);
-			continue;
+		/*
+		 * CPUID.06H.EAX[0] indicates whether the CPU has thermal
+		 * sensors. We check this bit only, all the early CPUs
+		 * without thermal sensors will be filtered out.
+		 */
+		if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
+			err = coretemp_device_add(i);
+			if (err)
+				goto exit_devices_unreg;
+
+		} else {
+			printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
+				" has no thermal sensor.\n", c->x86_model);
 		}
-
-		err = coretemp_device_add(i);
-		if (err)
-			goto exit_devices_unreg;
 	}
 	if (list_empty(&pdev_list)) {
 		err = -ENODEV;


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

* [PATCH 2/2] Get TjMax value from MSR
  2010-05-17  9:41         ` [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
  2010-05-17  9:41           ` [PATCH 1/2] Detect the thermal sensors by CPUID Carsten Emde
@ 2010-05-17  9:41           ` Carsten Emde
       [not found]           ` <AANLkTinQlH7LhCAz00WaHqbbslcSqipzVx4tDoQKSqIL@mail.gmail.com>
  2 siblings, 0 replies; 34+ messages in thread
From: Carsten Emde @ 2010-05-17  9:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jean Delvare, Huaxu Wan, Carsten Emde, LM Sensors, LKML, Huaxu Wan

[-- Attachment #1: coretemp-add-tjmax-method-for-i-series-processors.patch --]
[-- Type: text/plain, Size: 3294 bytes --]

The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
Intel processors.

CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>

---
 arch/x86/include/asm/msr-index.h |    2 +
 drivers/hwmon/coretemp.c         |   61 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 59 insertions(+), 4 deletions(-)

Index: head/arch/x86/include/asm/msr-index.h
===================================================================
--- head.orig/arch/x86/include/asm/msr-index.h
+++ head/arch/x86/include/asm/msr-index.h
@@ -235,6 +235,8 @@
 
 #define MSR_IA32_MISC_ENABLE		0x000001a0
 
+#define MSR_IA32_TEMPERATURE_TARGET	0x000001a2
+
 /* MISC_ENABLE bits: architectural */
 #define MSR_IA32_MISC_ENABLE_FAST_STRING	(1ULL << 0)
 #define MSR_IA32_MISC_ENABLE_TCC		(1ULL << 1)
Index: head/drivers/hwmon/coretemp.c
===================================================================
--- head.orig/drivers/hwmon/coretemp.c
+++ head/drivers/hwmon/coretemp.c
@@ -241,6 +241,55 @@ static int __devinit adjust_tjmax(struct
 	return tjmax;
 }
 
+static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id,
+			       struct device *dev)
+{
+	/* The 100C is default for both mobile and non mobile CPUs */
+	int err;
+	u32 eax, edx;
+	u32 val;
+
+	/* A new feature of current Intel(R) processors, the
+	   IA32_TEMPERATURE_TARGET contains the TjMax value */
+	err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
+	if (err) {
+		dev_warn(dev, "Unable to read TjMax from CPU.\n");
+	} else {
+		val = (eax >> 16) & 0xff;
+		/*
+		 * If the TjMax is not plausible, an assumption
+		 * will be used
+		 */
+		if ((val > 80) && (val < 120)) {
+			dev_info(dev, "TjMax is %d C.\n", val);
+			return val * 1000;
+		}
+	}
+
+	/*
+	 * An assumption is made for early CPUs and unreadable MSR.
+	 * NOTE: the given value may not be correct.
+	 */
+
+	switch (c->x86_model) {
+	case 0xe:
+	case 0xf:
+	case 0x16:
+	case 0x1a:
+		dev_warn(dev, "TjMax is assumed as 100 C!\n");
+		return 100000;
+		break;
+	case 0x17:
+	case 0x1c:		/* Atom CPUs */
+		return adjust_tjmax(c, id, dev);
+		break;
+	default:
+		dev_warn(dev, "CPU (model=0x%x) is not supported yet,"
+			" using default TjMax of 100C.\n", c->x86_model);
+		return 100000;
+	}
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -283,14 +332,18 @@ static int __devinit coretemp_probe(stru
 		}
 	}
 
-	data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
+	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
 	platform_set_drvdata(pdev, data);
 
-	/* read the still undocumented IA32_TEMPERATURE_TARGET it exists
-	   on older CPUs but not in this register, Atoms don't have it either */
+	/*
+	 * read the still undocumented IA32_TEMPERATURE_TARGET. It exists
+	 * on older CPUs but not in this register,
+	 * Atoms don't have it either.
+	 */
 
 	if ((c->x86_model > 0xe) && (c->x86_model != 0x1c)) {
-		err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx);
+		err = rdmsr_safe_on_cpu(data->id, MSR_IA32_TEMPERATURE_TARGET,
+		    &eax, &edx);
 		if (err) {
 			dev_warn(&pdev->dev, "Unable to read"
 					" IA32_TEMPERATURE_TARGET MSR\n");


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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors
       [not found]           ` <AANLkTinQlH7LhCAz00WaHqbbslcSqipzVx4tDoQKSqIL@mail.gmail.com>
@ 2010-05-18  7:01             ` Carsten Emde
  2010-05-18 12:03               ` Dmitry Gromov
  2010-05-19  1:27               ` Huaxu Wan
       [not found]             ` <625BA99ED14B2D499DC4E29D8138F150181F574C31@shsmsx502.ccr.corp.intel.com>
  1 sibling, 2 replies; 34+ messages in thread
From: Carsten Emde @ 2010-05-18  7:01 UTC (permalink / raw)
  To: Dmitry Gromov; +Cc: Huaxu Wan, Andrew Morton, LKML, LM Sensors

Dmitry,

>> Here comes the current version of the coretemp patches. Huaxu did the
>> initial work; Jean suggested to submit them directly to Andrew.
>>
>> I made some style changes as advised by checkpatch.
>>
>> The patches have been tested successfully on Core 2 Duo and Quad, and on
>> Nehalem and Nehalem/Westmere where temperature readings were plausible and
>> changed with load as expected. When tested on an Atom processor (N270), the
>> temperature values were identical to previous versions of the coretemp
>> module and also changed with load. However, the readings should be higher
>> by 10 to 15C as compared to the outside temperature of the processor.
>> Huaxu, could you check? I would guess TjMax to be 105 instead of 90C in these
>> processors.
> I apologize, if I ask a stupid question, but are you saying that TjMax in
> coretemp.c should be set to higher value than Tcase-max value specified in
> Intel documents?
Hmm, no. I am saying that I would like the reading to be correct. I have 
measured the outside temperature of the case with an infrared 
thermometer [1] and found it to be higher than the readings returned by 
the coretemp module. In all other CPUs I have, the coretemp readings are 
higher than the case temperature.

	Carsten.


[1] http://www.osadl.org/uploads/media/IPCworld-2008-4.pdf

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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors
       [not found]               ` <AANLkTimQnaUvXs75rpTOcW7CODXWgUfzekY9FCDa5S8P@mail.gmail.com>
@ 2010-05-18  7:13                 ` Carsten Emde
  2010-05-19  0:50                 ` Huaxu Wan
  1 sibling, 0 replies; 34+ messages in thread
From: Carsten Emde @ 2010-05-18  7:13 UTC (permalink / raw)
  To: Dmitry Gromov; +Cc: Wan, Huaxu, Andrew Morton, LKML, LM Sensors

On 05/18/2010 08:45 AM, Dmitry Gromov wrote:
> On Tue, May 18, 2010 at 01:07, Wan, Huaxu<huaxu.wan@intel.com>  wrote:
>> The TjMax of N270 is 90C, according the official documents [1][2].
>> [1] http://ark.intel.com/Product.aspx?id=36331&processor=N270&spec-codes=SLB73
>> [2] http://download.intel.com/design/processor/datashts/319977.pdf
>> Thank you, this is exactly why I'm asking. I think, "guessing" values here
> can be dangerous - who knows what critical apps they will relied upon.
Yes, of course. I never wanted to use a guessed and not documented
value. I only wanted the temperature reading to be plausible.

> And 90C seems to be good for N200 series of Atom CPUs only - I could not
> find TjMax value published for N330 Dual Core  (quite popular one). Intel
> only published Tcase for it:
> http://ark.intel.com/Product.aspx?id=35641
> So, if for N270 Tcase = TjMax = 90C, then, I'd suggest to use Tcase = 85.2C
> for N330 TjMax value.
They have the same CPU model ID:

# grep model /proc/cpuinfo
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz

# grep model /proc/cpuinfo
model		: 28
model name	: Intel(R) Atom(TM) CPU  330   @ 1.60GHz

I would like to propose to use the patch as it is. It's the best
version we ever had.

	Carsten.

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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel  processors
  2010-05-18  7:01             ` [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
@ 2010-05-18 12:03               ` Dmitry Gromov
  2010-05-19  1:27               ` Huaxu Wan
  1 sibling, 0 replies; 34+ messages in thread
From: Dmitry Gromov @ 2010-05-18 12:03 UTC (permalink / raw)
  To: Carsten Emde; +Cc: Huaxu Wan, Andrew Morton, LKML, LM Sensors

Hi!

On Tue, May 18, 2010 at 03:01, Carsten Emde <C.Emde@osadl.org> wrote:
> Dmitry,
>
>>> Here comes the current version of the coretemp patches. Huaxu did the
>>> initial work; Jean suggested to submit them directly to Andrew.
>>>
>>> I made some style changes as advised by checkpatch.
>>>
>>> The patches have been tested successfully on Core 2 Duo and Quad, and on
>>> Nehalem and Nehalem/Westmere where temperature readings were plausible
>>> and
>>> changed with load as expected. When tested on an Atom processor (N270),
>>> the
>>> temperature values were identical to previous versions of the coretemp
>>> module and also changed with load. However, the readings should be higher
>>> by 10 to 15C as compared to the outside temperature of the processor.
>>> Huaxu, could you check? I would guess TjMax to be 105 instead of 90C in
>>> these
>>> processors.
>>
>> I apologize, if I ask a stupid question, but are you saying that TjMax in
>> coretemp.c should be set to higher value than Tcase-max value specified in
>> Intel documents?
>
> Hmm, no. I am saying that I would like the reading to be correct. I have
> measured the outside temperature of the case with an infrared thermometer
> [1] and found it to be higher than the readings returned by the coretemp
> module. In all other CPUs I have, the coretemp readings are higher than the
> case temperature.
>

Thank you very much for an explanation, Carsten.


-- 
DG
NJ

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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors
       [not found]               ` <AANLkTimQnaUvXs75rpTOcW7CODXWgUfzekY9FCDa5S8P@mail.gmail.com>
  2010-05-18  7:13                 ` Carsten Emde
@ 2010-05-19  0:50                 ` Huaxu Wan
  2010-05-19  3:12                   ` Dmitry Gromov
  1 sibling, 1 reply; 34+ messages in thread
From: Huaxu Wan @ 2010-05-19  0:50 UTC (permalink / raw)
  To: Dmitry Gromov; +Cc: Wan, Huaxu, Andrew Morton, LM Sensors, LKML, Carsten Emde

On 02:45 Tue 18 May, Dmitry Gromov wrote:
> Hi!
> 
> And 90C seems to be good for N200 series of Atom CPUs only - I could not
> find TjMax value published for N330 Dual Core  (quite popular one). Intel
> only published Tcase for it:
> http://ark.intel.com/Product.aspx?id=35641
> So, if for N270 Tcase = TjMax = 90C, then, I'd suggest to use Tcase = 85.2C
> for N330 TjMax value.

Quoted a sentence from [1], "Unless specified otherwise, all specifications for 
the processor are at TJ = 90°C", I believe the TjMax of 330 is 90C too.

[1]http://download.intel.com/design/processor/datashts/320528.pdf

Thanks
Huaxu

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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors
  2010-05-18  7:01             ` [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
  2010-05-18 12:03               ` Dmitry Gromov
@ 2010-05-19  1:27               ` Huaxu Wan
  1 sibling, 0 replies; 34+ messages in thread
From: Huaxu Wan @ 2010-05-19  1:27 UTC (permalink / raw)
  To: Carsten Emde; +Cc: Dmitry Gromov, Andrew Morton, LM Sensors, Huaxu Wan, LKML

On 09:01 Tue 18 May, Carsten Emde wrote:
> Dmitry,
> 
> >>Here comes the current version of the coretemp patches. Huaxu did the
> >>initial work; Jean suggested to submit them directly to Andrew.
> >>
> >>I made some style changes as advised by checkpatch.
> >>
> >>The patches have been tested successfully on Core 2 Duo and Quad, and on
> >>Nehalem and Nehalem/Westmere where temperature readings were plausible and
> >>changed with load as expected. When tested on an Atom processor (N270), the
> >>temperature values were identical to previous versions of the coretemp
> >>module and also changed with load. However, the readings should be higher
> >>by 10 to 15C as compared to the outside temperature of the processor.
> >>Huaxu, could you check? I would guess TjMax to be 105 instead of 90C in these
> >>processors.
> >I apologize, if I ask a stupid question, but are you saying that TjMax in
> >coretemp.c should be set to higher value than Tcase-max value specified in
> >Intel documents?
> Hmm, no. I am saying that I would like the reading to be correct. I
> have measured the outside temperature of the case with an infrared
> thermometer [1] and found it to be higher than the readings returned
> by the coretemp module. In all other CPUs I have, the coretemp
> readings are higher than the case temperature.
> 
> [1] http://www.osadl.org/uploads/media/IPCworld-2008-4.pdf
> 

Hi Carsten,

I have no N270 and infrared thermometer in hand, so I can't check it by myself.
I'll find a channel and file this issue to them. 

Thank you.


Huaxu

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

* Re: [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel  processors
  2010-05-19  0:50                 ` Huaxu Wan
@ 2010-05-19  3:12                   ` Dmitry Gromov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Gromov @ 2010-05-19  3:12 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: Wan, Huaxu, Andrew Morton, LM Sensors, LKML, Carsten Emde

Hi!

On Tue, May 18, 2010 at 20:50, Huaxu Wan <huaxu.wan@linux.intel.com> wrote:
> On 02:45 Tue 18 May, Dmitry Gromov wrote:
>> Hi!
>>
>> And 90C seems to be good for N200 series of Atom CPUs only - I could not
>> find TjMax value published for N330 Dual Core  (quite popular one). Intel
>> only published Tcase for it:
>> http://ark.intel.com/Product.aspx?id=35641
>> So, if for N270 Tcase = TjMax = 90C, then, I'd suggest to use Tcase = 85.2C
>> for N330 TjMax value.
>
> Quoted a sentence from [1], "Unless specified otherwise, all specifications for
> the processor are at TJ = 90°C", I believe the TjMax of 330 is 90C too.
>

Well, that refers for the values in that specific table and entire
document (which I went through as well) does not specify TjMax :(
Similar document for N270 series does specify TjMax explicitly in Table 14:
http://download.intel.com/design/processor/datashts/320032.pdf

Another document, "Thermal and Mechanical Design Guidelines" for Atom
300 series:
http://download.intel.com/design/processor/designex/320530.pdf
specifies Tcase-max = 85.2C
Thinking about this a bit, I think Tcase-max should be lower than
TjMax, which probably is still 90C.
The document itself is a good reading too.

Anyway, thank you very much for your help, Huaxu!

-- 
DG
NJ

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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-07  9:59 [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR Huaxu Wan
  2010-05-07 13:29 ` [lm-sensors] " Carsten Emde
  2010-05-10  3:50 ` [PATCH 2/2 V2] " Huaxu Wan
@ 2010-05-29  5:39 ` Maxim Levitsky
  2010-05-30 14:43   ` Maxim Levitsky
  2010-05-31  1:39   ` Huaxu Wan
  2 siblings, 2 replies; 34+ messages in thread
From: Maxim Levitsky @ 2010-05-29  5:39 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, khali

On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> processers.

I know that TjMax on my system is 85, and now coretemp reports wrong
temperatures.
First of all BIOS using stupid tricks actualy reports CPU temperature
through ACPI, and assuming it was correct TjMax is 85.
It also shuts down the system if I 'lie' to it that cpu temperature is
85C.

Coretemp was working correctly in 2.6.34

cat /proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 Duo CPU     T5450  @ 1.66GHz
stepping	: 13
cpu MHz		: 1667.000
cache size	: 2048 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm
bogomips	: 3324.70
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 Duo CPU     T5450  @ 1.66GHz
stepping	: 13
cpu MHz		: 1667.000
cache size	: 2048 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm
bogomips	: 3324.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:


Best regards,
	Maxim Levitsky


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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-29  5:39 ` [PATCH 2/2] " Maxim Levitsky
@ 2010-05-30 14:43   ` Maxim Levitsky
  2010-05-31  1:39   ` Huaxu Wan
  1 sibling, 0 replies; 34+ messages in thread
From: Maxim Levitsky @ 2010-05-30 14:43 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, khali

On Sat, 2010-05-29 at 08:39 +0300, Maxim Levitsky wrote: 
> On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> > processers.
> 
> I know that TjMax on my system is 85, and now coretemp reports wrong
> temperatures.
> First of all BIOS using stupid tricks actualy reports CPU temperature
> through ACPI, and assuming it was correct TjMax is 85.
> It also shuts down the system if I 'lie' to it that cpu temperature is
> 85C.
> 
> Coretemp was working correctly in 2.6.34

The following patch unbreaks the driver:


commit 8ff4f666908dd208a10f1b6b38286303fdb774fc
Author: Maxim Levitsky <maximlevitsky@gmail.com>
Date:   Sat May 29 08:57:09 2010 +0300

coretemp: unbreak tjmax reports on Core2 CPUs

Core2 CPUS don't report TjMax, but its not always 100C

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>


diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 2988da1..fb100a4 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -276,11 +276,8 @@ static int __devinit get_tjmax(struct cpuinfo_x86
*c, u32 id,
case 0xf:
case 0x16:
case 0x1a:
- dev_warn(dev, "TjMax is assumed as 100 C!\n");
- return 100000;
- break;
case 0x17:
- case 0x1c: /* Atom CPUs */
+ case 0x1c:
return adjust_tjmax(c, id, dev);
break;
default:



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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-29  5:39 ` [PATCH 2/2] " Maxim Levitsky
  2010-05-30 14:43   ` Maxim Levitsky
@ 2010-05-31  1:39   ` Huaxu Wan
  2010-06-02 16:34     ` Maxim Levitsky
  1 sibling, 1 reply; 34+ messages in thread
From: Huaxu Wan @ 2010-05-31  1:39 UTC (permalink / raw)
  To: Maxim Levitsky; +Cc: Huaxu Wan, linux-kernel, lm-sensors, huaxu.wan, khali

On 08:39 Sat 29 May, Maxim Levitsky wrote:
> On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> > processers.
> 
> I know that TjMax on my system is 85, and now coretemp reports wrong
> temperatures.
> First of all BIOS using stupid tricks actualy reports CPU temperature
> through ACPI, and assuming it was correct TjMax is 85.
> It also shuts down the system if I 'lie' to it that cpu temperature is
> 85C.

>From the list at [1], the TjMax(Tjunction) of T5450 is 100C. Does anyone
here can make a double check?

[1] http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec-codes=SLA4F

Thanks
Huaxu



> 
> Coretemp was working correctly in 2.6.34
> 
> cat /proc/cpuinfo
> 
> processor	: 0
> vendor_id	: GenuineIntel
> cpu family	: 6
> model		: 15
> model name	: Intel(R) Core(TM)2 Duo CPU     T5450  @ 1.66GHz
> stepping	: 13
> cpu MHz		: 1667.000
> cache size	: 2048 KB
> physical id	: 0
> siblings	: 2
> core id		: 0
> cpu cores	: 2
> apicid		: 0
> initial apicid	: 0
> fpu		: yes
> fpu_exception	: yes
> cpuid level	: 10
> wp		: yes
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm
> bogomips	: 3324.70
> clflush size	: 64
> cache_alignment	: 64
> address sizes	: 36 bits physical, 48 bits virtual
> power management:
> 
> processor	: 1
> vendor_id	: GenuineIntel
> cpu family	: 6
> model		: 15
> model name	: Intel(R) Core(TM)2 Duo CPU     T5450  @ 1.66GHz
> stepping	: 13
> cpu MHz		: 1667.000
> cache size	: 2048 KB
> physical id	: 0
> siblings	: 2
> core id		: 1
> cpu cores	: 2
> apicid		: 1
> initial apicid	: 1
> fpu		: yes
> fpu_exception	: yes
> cpuid level	: 10
> wp		: yes
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm
> bogomips	: 3324.99
> clflush size	: 64
> cache_alignment	: 64
> address sizes	: 36 bits physical, 48 bits virtual
> power management:
> 
> 
> Best regards,
> 	Maxim Levitsky
> 

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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-05-31  1:39   ` Huaxu Wan
@ 2010-06-02 16:34     ` Maxim Levitsky
  2010-06-02 20:10       ` Maxim Levitsky
  0 siblings, 1 reply; 34+ messages in thread
From: Maxim Levitsky @ 2010-06-02 16:34 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, khali

On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> On 08:39 Sat 29 May, Maxim Levitsky wrote:
> > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> > > processers.
> > 
> > I know that TjMax on my system is 85, and now coretemp reports wrong
> > temperatures.
> > First of all BIOS using stupid tricks actualy reports CPU temperature
> > through ACPI, and assuming it was correct TjMax is 85.
> > It also shuts down the system if I 'lie' to it that cpu temperature is
> > 85C.
> 
> From the list at [1], the TjMax(Tjunction) of T5450 is 100C. Does anyone
> here can make a double check?
> 
> [1] http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec-codes=SLA4F

This is very interesting.

With TjMax 85C, the CPUs idle temperature is reported at around 45~50C
GPU temperature that is around 60C

BIOS also reports 45~50C.

BIOS hooks an SMI to CPU thermal report, and stores the temperature it
read in ram, then ACPI code reads it, reports and passes to the EC
(embedded controller).

If I write myself 85 to embedded controller, systems shuts down.
(values less that 85, eg 84 don't shut system).

Thats all I know.

Best regards,
Maxim Levitsky


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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-06-02 16:34     ` Maxim Levitsky
@ 2010-06-02 20:10       ` Maxim Levitsky
  2010-06-12 13:03         ` Maxim Levitsky
  0 siblings, 1 reply; 34+ messages in thread
From: Maxim Levitsky @ 2010-06-02 20:10 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, khali

On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
> On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> > On 08:39 Sat 29 May, Maxim Levitsky wrote:
> > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> > > > processers.
> > > 
> > > I know that TjMax on my system is 85, and now coretemp reports wrong
> > > temperatures.
> > > First of all BIOS using stupid tricks actualy reports CPU temperature
> > > through ACPI, and assuming it was correct TjMax is 85.
> > > It also shuts down the system if I 'lie' to it that cpu temperature is
> > > 85C.
> > 
> > From the list at [1], the TjMax(Tjunction) of T5450 is 100C. Does anyone
> > here can make a double check?
> > 
> > [1] http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec-codes=SLA4F
> 
> This is very interesting.
> 
> With TjMax 85C, the CPUs idle temperature is reported at around 45~50C
> GPU temperature that is around 60C
> 
> BIOS also reports 45~50C.
> 
> BIOS hooks an SMI to CPU thermal report, and stores the temperature it
> read in ram, then ACPI code reads it, reports and passes to the EC
> (embedded controller).
> 
> If I write myself 85 to embedded controller, systems shuts down.
> (values less that 85, eg 84 don't shut system).


Another clue is that right after resume from ram, after long delay
(~hour) the displayed temperature with TjMax 85 is 33C. Since room
temperature here is around 27C, this seems more plausible that 
33 + 15 = 48C 


Best regards,
Maxim Levitsky


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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-06-02 20:10       ` Maxim Levitsky
@ 2010-06-12 13:03         ` Maxim Levitsky
  2010-06-13  2:27           ` Wan, Huaxu
  0 siblings, 1 reply; 34+ messages in thread
From: Maxim Levitsky @ 2010-06-12 13:03 UTC (permalink / raw)
  To: Huaxu Wan; +Cc: linux-kernel, lm-sensors, huaxu.wan, khali

On Wed, 2010-06-02 at 23:10 +0300, Maxim Levitsky wrote: 
> On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
> > On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> > > On 08:39 Sat 29 May, Maxim Levitsky wrote:
> > > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax value in the newer
> > > > > processers.
> > > > 
> > > > I know that TjMax on my system is 85, and now coretemp reports wrong
> > > > temperatures.
> > > > First of all BIOS using stupid tricks actualy reports CPU temperature
> > > > through ACPI, and assuming it was correct TjMax is 85.
> > > > It also shuts down the system if I 'lie' to it that cpu temperature is
> > > > 85C.
> > > 
> > > From the list at [1], the TjMax(Tjunction) of T5450 is 100C. Does anyone
> > > here can make a double check?
> > > 
> > > [1] http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec-codes=SLA4F
> > 
> > This is very interesting.
> > 
> > With TjMax 85C, the CPUs idle temperature is reported at around 45~50C
> > GPU temperature that is around 60C
> > 
> > BIOS also reports 45~50C.
> > 
> > BIOS hooks an SMI to CPU thermal report, and stores the temperature it
> > read in ram, then ACPI code reads it, reports and passes to the EC
> > (embedded controller).
> > 
> > If I write myself 85 to embedded controller, systems shuts down.
> > (values less that 85, eg 84 don't shut system).
> 
> 
> Another clue is that right after resume from ram, after long delay
> (~hour) the displayed temperature with TjMax 85 is 33C. Since room
> temperature here is around 27C, this seems more plausible that 
> 33 + 15 = 48C 


Any update? 
> 
> 
> Best regards,
> Maxim Levitsky
> 



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

* RE: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-06-12 13:03         ` Maxim Levitsky
@ 2010-06-13  2:27           ` Wan, Huaxu
  2010-07-26  8:16             ` Maxim Levitsky
  0 siblings, 1 reply; 34+ messages in thread
From: Wan, Huaxu @ 2010-06-13  2:27 UTC (permalink / raw)
  To: 'Maxim Levitsky', 'Huaxu Wan'
  Cc: 'linux-kernel@vger.kernel.org',
	'lm-sensors@lm-sensors.org', 'khali@linux-fr.org'

>On Wed, 2010-06-02 at 23:10 +0300, Maxim Levitsky wrote: 
>> On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
>> > On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
>> > > On 08:39 Sat 29 May, Maxim Levitsky wrote:
>> > > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
>> > > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax 
>value in the newer
>> > > > > processers.
>> > > > 
>> > > > I know that TjMax on my system is 85, and now coretemp 
>reports wrong
>> > > > temperatures.
>> > > > First of all BIOS using stupid tricks actualy reports 
>CPU temperature
>> > > > through ACPI, and assuming it was correct TjMax is 85.
>> > > > It also shuts down the system if I 'lie' to it that 
>cpu temperature is
>> > > > 85C.
>> > > 
>> > > From the list at [1], the TjMax(Tjunction) of T5450 is 
>100C. Does anyone
>> > > here can make a double check?
>> > > 
>> > > [1] 
>http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec
>-codes=SLA4F
>> > 
>> > This is very interesting.
>> > 
>> > With TjMax 85C, the CPUs idle temperature is reported at 
>around 45~50C
>> > GPU temperature that is around 50C 
>> > 
>> > BIOS also reports 45~50C.
>> > 
>> > BIOS hooks an SMI to CPU thermal report, and stores the 
>temperature it
>> > read in ram, then ACPI code reads it, reports and passes to the EC
>> > (embedded controller).
>> > 
>> > If I write myself 85 to embedded controller, systems shuts down.
>> > (values less that 85, eg 84 don't shut system).
>> 
>> 
>> Another clue is that right after resume from ram, after long delay
>> (~hour) the displayed temperature with TjMax 85 is 33C. Since room
>> temperature here is around 27C, this seems more plausible that 
>> 33 + 15 = 48C 
>
>
>Any update? 

I'm occupied by other things, sorry for slow response. But, as said in a 
spec, I can't remember which one now, there are too many, the relative
value read from DTS is accurate approaching to TjMax. The accuracy
deteriorates to +-10C at 50C. Any DTS reading below 50C should be
considered to indicate only a temperature below 50C and not a specific
temperature.

So, the value around 50C can't be taken as real chip temperature. I
would like this issue could be confirmed by more users to avoid it as a 
particular case. At the meantime, I still looking for a laptop with T5450, 
this may take some time. 

Thanks
Huaxu 

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

* RE: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-06-13  2:27           ` Wan, Huaxu
@ 2010-07-26  8:16             ` Maxim Levitsky
  2010-08-30  1:42               ` Huaxu Wan
  0 siblings, 1 reply; 34+ messages in thread
From: Maxim Levitsky @ 2010-07-26  8:16 UTC (permalink / raw)
  To: Wan, Huaxu
  Cc: 'Huaxu Wan', 'linux-kernel@vger.kernel.org',
	'lm-sensors@lm-sensors.org', 'khali@linux-fr.org'

On Sun, 2010-06-13 at 10:27 +0800, Wan, Huaxu wrote: 
> >On Wed, 2010-06-02 at 23:10 +0300, Maxim Levitsky wrote: 
> >> On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
> >> > On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> >> > > On 08:39 Sat 29 May, Maxim Levitsky wrote:
> >> > > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> >> > > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax 
> >value in the newer
> >> > > > > processers.
> >> > > > 
> >> > > > I know that TjMax on my system is 85, and now coretemp 
> >reports wrong
> >> > > > temperatures.
> >> > > > First of all BIOS using stupid tricks actualy reports 
> >CPU temperature
> >> > > > through ACPI, and assuming it was correct TjMax is 85.
> >> > > > It also shuts down the system if I 'lie' to it that 
> >cpu temperature is
> >> > > > 85C.
> >> > > 
> >> > > From the list at [1], the TjMax(Tjunction) of T5450 is 
> >100C. Does anyone
> >> > > here can make a double check?
> >> > > 
> >> > > [1] 
> >http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec
> >-codes=SLA4F
> >> > 
> >> > This is very interesting.
> >> > 
> >> > With TjMax 85C, the CPUs idle temperature is reported at 
> >around 45~50C
> >> > GPU temperature that is around 50C 
> >> > 
> >> > BIOS also reports 45~50C.
> >> > 
> >> > BIOS hooks an SMI to CPU thermal report, and stores the 
> >temperature it
> >> > read in ram, then ACPI code reads it, reports and passes to the EC
> >> > (embedded controller).
> >> > 
> >> > If I write myself 85 to embedded controller, systems shuts down.
> >> > (values less that 85, eg 84 don't shut system).
> >> 
> >> 
> >> Another clue is that right after resume from ram, after long delay
> >> (~hour) the displayed temperature with TjMax 85 is 33C. Since room
> >> temperature here is around 27C, this seems more plausible that 
> >> 33 + 15 = 48C 
> >
> >
> >Any update? 
> 
> I'm occupied by other things, sorry for slow response. But, as said in a 
> spec, I can't remember which one now, there are too many, the relative
> value read from DTS is accurate approaching to TjMax. The accuracy
> deteriorates to +-10C at 50C. Any DTS reading below 50C should be
> considered to indicate only a temperature below 50C and not a specific
> temperature.
> 
> So, the value around 50C can't be taken as real chip temperature. I
> would like this issue could be confirmed by more users to avoid it as a 
> particular case. At the meantime, I still looking for a laptop with T5450, 
> this may take some time. 
> 
> Thanks
> Huaxu 

Any update?

Best regards,
Maxim Levitsky


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

* RE: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-07-26  8:16             ` Maxim Levitsky
@ 2010-08-30  1:42               ` Huaxu Wan
  2010-08-31 21:01                 ` Fenghua Yu
  0 siblings, 1 reply; 34+ messages in thread
From: Huaxu Wan @ 2010-08-30  1:42 UTC (permalink / raw)
  To: Maxim Levitsky, Fenghua Yu
  Cc: Wan, Huaxu, 'linux-kernel@vger.kernel.org',
	'lm-sensors@lm-sensors.org', 'khali@linux-fr.org'

CC Fenghua. 

Could you found a Laptop with T5450 at hand? I can't found anywhere.

-Huaxu

On Mon, 2010-07-26 at 11:16 +0300, Maxim Levitsky wrote:
> On Sun, 2010-06-13 at 10:27 +0800, Wan, Huaxu wrote: 
> > >On Wed, 2010-06-02 at 23:10 +0300, Maxim Levitsky wrote: 
> > >> On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
> > >> > On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> > >> > > On 08:39 Sat 29 May, Maxim Levitsky wrote:
> > >> > > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > >> > > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax 
> > >value in the newer
> > >> > > > > processers.
> > >> > > > 
> > >> > > > I know that TjMax on my system is 85, and now coretemp 
> > >reports wrong
> > >> > > > temperatures.
> > >> > > > First of all BIOS using stupid tricks actualy reports 
> > >CPU temperature
> > >> > > > through ACPI, and assuming it was correct TjMax is 85.
> > >> > > > It also shuts down the system if I 'lie' to it that 
> > >cpu temperature is
> > >> > > > 85C.
> > >> > > 
> > >> > > From the list at [1], the TjMax(Tjunction) of T5450 is 
> > >100C. Does anyone
> > >> > > here can make a double check?
> > >> > > 
> > >> > > [1] 
> > >http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec
> > >-codes=SLA4F
> > >> > 
> > >> > This is very interesting.
> > >> > 
> > >> > With TjMax 85C, the CPUs idle temperature is reported at 
> > >around 45~50C
> > >> > GPU temperature that is around 50C 
> > >> > 
> > >> > BIOS also reports 45~50C.
> > >> > 
> > >> > BIOS hooks an SMI to CPU thermal report, and stores the 
> > >temperature it
> > >> > read in ram, then ACPI code reads it, reports and passes to the EC
> > >> > (embedded controller).
> > >> > 
> > >> > If I write myself 85 to embedded controller, systems shuts down.
> > >> > (values less that 85, eg 84 don't shut system).
> > >> 
> > >> 
> > >> Another clue is that right after resume from ram, after long delay
> > >> (~hour) the displayed temperature with TjMax 85 is 33C. Since room
> > >> temperature here is around 27C, this seems more plausible that 
> > >> 33 + 15 = 48C 
> > >
> > >
> > >Any update? 
> > 
> > I'm occupied by other things, sorry for slow response. But, as said in a 
> > spec, I can't remember which one now, there are too many, the relative
> > value read from DTS is accurate approaching to TjMax. The accuracy
> > deteriorates to +-10C at 50C. Any DTS reading below 50C should be
> > considered to indicate only a temperature below 50C and not a specific
> > temperature.
> > 
> > So, the value around 50C can't be taken as real chip temperature. I
> > would like this issue could be confirmed by more users to avoid it as a 
> > particular case. At the meantime, I still looking for a laptop with T5450, 
> > this may take some time. 
> > 
> > Thanks
> > Huaxu 
> 
> Any update?
> 
> Best regards,
> Maxim Levitsky
> 



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

* Re: [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR
  2010-08-30  1:42               ` Huaxu Wan
@ 2010-08-31 21:01                 ` Fenghua Yu
  0 siblings, 0 replies; 34+ messages in thread
From: Fenghua Yu @ 2010-08-31 21:01 UTC (permalink / raw)
  To: Huaxu Wan
  Cc: Maxim Levitsky, Yu, Fenghua, Wan, Huaxu,
	'linux-kernel@vger.kernel.org',
	'lm-sensors@lm-sensors.org', 'khali@linux-fr.org'

On Sun, Aug 29, 2010 at 06:42:36PM -0700, Huaxu Wan wrote:
> On Mon, 2010-07-26 at 11:16 +0300, Maxim Levitsky wrote:
> > On Sun, 2010-06-13 at 10:27 +0800, Wan, Huaxu wrote: 
> > > >On Wed, 2010-06-02 at 23:10 +0300, Maxim Levitsky wrote: 
> > > >> On Wed, 2010-06-02 at 19:34 +0300, Maxim Levitsky wrote: 
> > > >> > On Mon, 2010-05-31 at 09:39 +0800, Huaxu Wan wrote: 
> > > >> > > On 08:39 Sat 29 May, Maxim Levitsky wrote:
> > > >> > > > On Fri, 2010-05-07 at 17:59 +0800, Huaxu Wan wrote: 
> > > >> > > > > The MSR IA32_TEMPERATURE_TARGET contains the TjMax 
> > > >value in the newer
> > > >> > > > > processers.
> > > >> > > > 
> > > >> > > > I know that TjMax on my system is 85, and now coretemp 
> > > >reports wrong
> > > >> > > > temperatures.
> > > >> > > > First of all BIOS using stupid tricks actualy reports 
> > > >CPU temperature
> > > >> > > > through ACPI, and assuming it was correct TjMax is 85.
> > > >> > > > It also shuts down the system if I 'lie' to it that 
> > > >cpu temperature is
> > > >> > > > 85C.
> > > >> > > 
> > > >> > > From the list at [1], the TjMax(Tjunction) of T5450 is 
> > > >100C. Does anyone
> > > >> > > here can make a double check?
> > > >> > > 
> > > >> > > [1] 
> > > >http://ark.intel.com/Product.aspx?id=30787&processor=T5450&spec
> > > >-codes=SLA4F
> > > >> > 
> > > >> > This is very interesting.
> > > >> > 
> > > >> > With TjMax 85C, the CPUs idle temperature is reported at 
> > > >around 45~50C
> > > >> > GPU temperature that is around 50C 
> > > >> > 
> > > >> > BIOS also reports 45~50C.
> > > >> > 
> > > >> > BIOS hooks an SMI to CPU thermal report, and stores the 
> > > >temperature it
> > > >> > read in ram, then ACPI code reads it, reports and passes to the EC
> > > >> > (embedded controller).
> > > >> > 
> > > >> > If I write myself 85 to embedded controller, systems shuts down.
> > > >> > (values less that 85, eg 84 don't shut system).
> > > >> 
> > > >> 
> > > >> Another clue is that right after resume from ram, after long delay
> > > >> (~hour) the displayed temperature with TjMax 85 is 33C. Since room
> > > >> temperature here is around 27C, this seems more plausible that 
> > > >> 33 + 15 = 48C 
> > > >
> > > >
> > > >Any update? 
> > > 
> > > I'm occupied by other things, sorry for slow response. But, as said in a 
> > > spec, I can't remember which one now, there are too many, the relative
> > > value read from DTS is accurate approaching to TjMax. The accuracy
> > > deteriorates to +-10C at 50C. Any DTS reading below 50C should be
> > > considered to indicate only a temperature below 50C and not a specific
> > > temperature.
> > > 
> > > So, the value around 50C can't be taken as real chip temperature. I
> > > would like this issue could be confirmed by more users to avoid it as a 
> > > particular case. At the meantime, I still looking for a laptop with T5450, 
> > > this may take some time. 

Hi, Maxim,

Could you send out thermal zone info under /proc/acpi/thermal_zone/TZ*?

Thanks.

-Fenghua

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

end of thread, other threads:[~2010-08-31 21:10 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-07  9:54 [PATCH 1/2] hwmon: (coretemp) Detect the thermal sensors by CPUID Huaxu Wan
2010-05-07 12:43 ` Jean Delvare
2010-05-07 13:21 ` [lm-sensors] " Carsten Emde
2010-05-10  2:35   ` Huaxu Wan
2010-05-10  3:35 ` [PATCH 1/2 V2] " Huaxu Wan
2010-05-10 12:45   ` Valdis.Kletnieks
2010-05-11  3:41     ` Huaxu Wan
2010-05-11  8:01   ` [PATCH 1/2 V3] " Huaxu Wan
2010-05-11 21:45     ` Valdis.Kletnieks
2010-05-14  3:20     ` [lm-sensors] " Henrique de Moraes Holschuh
2010-05-14  6:58       ` [PATCH 1/2 V3 minor change] " Huaxu Wan
2010-05-17  9:41         ` [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
2010-05-17  9:41           ` [PATCH 1/2] Detect the thermal sensors by CPUID Carsten Emde
2010-05-17  9:41           ` [PATCH 2/2] Get TjMax value from MSR Carsten Emde
     [not found]           ` <AANLkTinQlH7LhCAz00WaHqbbslcSqipzVx4tDoQKSqIL@mail.gmail.com>
2010-05-18  7:01             ` [lm-sensors] [PATCH 0/2] hwmon: Update coretemp to current Intel processors Carsten Emde
2010-05-18 12:03               ` Dmitry Gromov
2010-05-19  1:27               ` Huaxu Wan
     [not found]             ` <625BA99ED14B2D499DC4E29D8138F150181F574C31@shsmsx502.ccr.corp.intel.com>
     [not found]               ` <AANLkTimQnaUvXs75rpTOcW7CODXWgUfzekY9FCDa5S8P@mail.gmail.com>
2010-05-18  7:13                 ` Carsten Emde
2010-05-19  0:50                 ` Huaxu Wan
2010-05-19  3:12                   ` Dmitry Gromov
2010-05-07  9:59 [PATCH 2/2] hwmon: (coretemp) Get TjMax value from MSR Huaxu Wan
2010-05-07 13:29 ` [lm-sensors] " Carsten Emde
2010-05-10  3:09   ` Huaxu Wan
2010-05-10  3:50 ` [PATCH 2/2 V2] " Huaxu Wan
2010-05-29  5:39 ` [PATCH 2/2] " Maxim Levitsky
2010-05-30 14:43   ` Maxim Levitsky
2010-05-31  1:39   ` Huaxu Wan
2010-06-02 16:34     ` Maxim Levitsky
2010-06-02 20:10       ` Maxim Levitsky
2010-06-12 13:03         ` Maxim Levitsky
2010-06-13  2:27           ` Wan, Huaxu
2010-07-26  8:16             ` Maxim Levitsky
2010-08-30  1:42               ` Huaxu Wan
2010-08-31 21:01                 ` Fenghua Yu

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).