From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: (coretemp) Do not return -EAGAIN for low temperatures
Date: Sat, 14 Dec 2013 16:31:02 +0000 [thread overview]
Message-ID: <52AC87C6.1090204@roeck-us.net> (raw)
In-Reply-To: <1386439557-27341-1-git-send-email-linux@roeck-us.net>
On 12/07/2013 10:05 AM, Guenter Roeck wrote:
> Some Intel CPUs do not set the 'valid' bit in IA32_THERM_STATUS if the
> temperature is too low to be measured. This condition will not change until
> the CPU is hot enough for its temperature to be measured. Returning an error
> in such conditions is not very useful. Drop checking the valid bit and just
> return the reported temperature instead.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> I don't think we ever closed on this. Giving it a shot.
>
Comments, anyone ?
Guenter
> drivers/hwmon/coretemp.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index 310ce19..6e0579e 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -177,18 +177,19 @@ static ssize_t show_temp(struct device *dev,
> /* Check whether the time interval has elapsed */
> if (!tdata->valid || time_after(jiffies, tdata->last_updated + HZ)) {
> rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx);
> - tdata->valid = 0;
> - /* Check whether the data is valid */
> - if (eax & 0x80000000) {
> - tdata->temp = tdata->tjmax -
> - ((eax >> 16) & 0x7f) * 1000;
> - tdata->valid = 1;
> - }
> + /*
> + * Ignore the valid bit. In all observed cases the register
> + * value is either low or zero if the valid bit is 0.
> + * Return it instead of reporting an error which doesn't
> + * really help at all.
> + */
> + tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000;
> + tdata->valid = 1;
> tdata->last_updated = jiffies;
> }
>
> mutex_unlock(&tdata->update_lock);
> - return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN;
> + return sprintf(buf, "%d\n", tdata->temp);
> }
>
> struct tjmax_pci {
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2013-12-14 16:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 18:05 [lm-sensors] [PATCH] hwmon: (coretemp) Do not return -EAGAIN for low temperatures Guenter Roeck
2013-12-14 16:31 ` Guenter Roeck [this message]
2013-12-20 15:53 ` Guenter Roeck
2013-12-21 18:14 ` Jean Delvare
2013-12-21 19:55 ` Guenter Roeck
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=52AC87C6.1090204@roeck-us.net \
--to=linux@roeck-us.net \
--cc=lm-sensors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.