lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100510030917.GB9181@owl>
Date:	Mon, 10 May 2010 11:09:17 +0800
From:	Huaxu Wan <huaxu.wan@...ux.intel.com>
To:	Carsten Emde <Carsten.Emde@...dl.org>
Cc:	Huaxu Wan <huaxu.wan@...ux.intel.com>,
	linux-kernel@...r.kernel.org, lm-sensors@...sensors.org,
	Huaxu Wan <huaxu.wan@...el.com>
Subject: Re: [lm-sensors] [PATCH 2/2] hwmon: (coretemp) Get TjMax value
 from MSR

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ