public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: Huaxu Wan <huaxu.wan@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org,
	huaxu.wan@intel.com, Carsten Emde <Carsten.Emde@osadl.org>
Subject: Re: [PATCH 1/2 V2] hwmon: (coretemp) Detect the thermal sensors by CPUID
Date: Mon, 10 May 2010 08:45:51 -0400	[thread overview]
Message-ID: <148928.1273495551@localhost> (raw)
In-Reply-To: Your message of "Mon, 10 May 2010 11:35:25 +0800." <20100510033525.GC9181@owl>

[-- 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 --]

  reply	other threads:[~2010-05-10 12:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=148928.1273495551@localhost \
    --to=valdis.kletnieks@vt.edu \
    --cc=Carsten.Emde@osadl.org \
    --cc=huaxu.wan@intel.com \
    --cc=huaxu.wan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox