Re: Intel Core Duo/Solo Temperature Monitoring Working On Intel DG965 Motherboard

2007-03-18 Thread Rudolf Marek
Hello all,
> I'm just wondering if it is right to export the functions msr_read and
> msr_write from arch/i386/kernel/msr.c, or if it would be better to put
> these functions in arch/i386/lib/msr-on-cpu.c with rdmsr_on_cpu and
> wrmsr_on_cpu.

I'm fixing this, please stay tuned. I will CC you in new thread, when looking
for testers. The driver is reviewed, this is the last issue.

Rudolf


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: [lm-sensors] Intel Core Duo/Solo Temperature Monitoring Working On Intel DG965 Motherboard

2007-03-15 Thread Jean Delvare
Hi Nicolas,

On Thu, 15 Mar 2007 19:27:21 +0800, Nicolas Boichat wrote:
> I ported this patch to the latest git, I hope this can help to get it
> merged.
> 
> I'm just wondering if it is right to export the functions msr_read and
> msr_write from arch/i386/kernel/msr.c, or if it would be better to put
> these functions in arch/i386/lib/msr-on-cpu.c with rdmsr_on_cpu and
> wrmsr_on_cpu.
> 
> Note the difference between msr_read/msr_write and
> rdmsr_on_cpu/wrmsr_on_cpu is that msr_read/msr_write use "safe" rdmsr
> /wrmsr functions (i.e. test return value), while
> rdmsr_on_cpu/wrmsr_on_cpu does not. Coretemp needs the return value to
> work properly.

I reviewed Rudolf Marek's patches a few days ago and my first comment
was along these lines:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-March/019169.html

I do indeed believe that the functions in lib/msr-on-cpu.c should be
improved to be suitable for our needs. Others are likely to need the
same feature. Library functions should really return the errors, and
leave it up to the caller to decide whether to ignore them or not,
rather than hiding them.

Could you possibly propose a separate patch fixing lib/msr-on-cpu.c (on
both i386 and x86_64) to reliably report the errors? I guess it's a
simple matter of changing the prototypes of the functions? If we can
get this upstream, this would make the integration of the coretemp
driver easier and faster.

Thanks,
-- 
Jean Delvare


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Intel Core Duo/Solo Temperature Monitoring Working On Intel DG965 Motherboard

2007-03-15 Thread Nicolas Boichat
Hello,

Justin Piszcz wrote:
> DISCLAIMER: This patch is still experimental. AUTHOR: Rudolf Marek has
> written the coretemp module for Intel Core Duo/Solo
> processors.
>
> Without this patch, you cannot monitor your CPU temperature, at least
> not on a DG965 motherboard.
[snip]
> Commentary:
> It will probably be a few weeks until this is incorporated into Linus'
> tree, hopefully it can make it into 2.6.22, then userland support
> should follow over time.
>
I ported this patch to the latest git, I hope this can help to get it
merged.

I'm just wondering if it is right to export the functions msr_read and
msr_write from arch/i386/kernel/msr.c, or if it would be better to put
these functions in arch/i386/lib/msr-on-cpu.c with rdmsr_on_cpu and
wrmsr_on_cpu.

Note the difference between msr_read/msr_write and
rdmsr_on_cpu/wrmsr_on_cpu is that msr_read/msr_write use "safe" rdmsr
/wrmsr functions (i.e. test return value), while
rdmsr_on_cpu/wrmsr_on_cpu does not. Coretemp needs the return value to
work properly.

Best regards,

Nicolas

Intel Core Duo/Solo Temperature Monitoring driver.

Author: Rudolf Marek <[EMAIL PROTECTED]>
---

 Documentation/hwmon/coretemp |   37 
 arch/i386/kernel/msr.c   |   31 ++-
 drivers/hwmon/Kconfig|9 +
 drivers/hwmon/Makefile   |1 
 drivers/hwmon/coretemp.c |  400 ++
 include/asm-i386/msr.h   |3 
 include/asm-x86_64/msr.h |3 
 7 files changed, 470 insertions(+), 14 deletions(-)

diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
new file mode 100644
index 000..ba02dee
--- /dev/null
+++ b/Documentation/hwmon/coretemp
@@ -0,0 +1,37 @@
+Kernel driver coretemp
+==
+
+Supported chips:
+  * All Intel Core family
+Prefix: 'coretemp'
+Addresses scanned: CPUID (family 0x6, models 0xe, 0xf)
+Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual
+   Volume 3A: System Programming Guide
+
+Author: Rudolf Marek
+Contact: Rudolf Marek <[EMAIL PROTECTED]>
+
+Description
+---
+
+This driver permits reading temperature sensor embedded inside Intel Core CPU.
+Temperature is measured in degrees Celsius and measurement resolution is
+1 degree C. Valid temperatures are from 0 to TjMax degrees C, because
+the actual temperature is in fact a delta from TjMax.
+
+Temperature known as TjMax is the maximum junction temperature of processor.
+Intel defines this temperature as 85C or 100C. At this temperature, protection
+mechanism will perform actions to forcibly cool down the processor. Alarm
+may be raised, if the temperature grows enough (more than TjMax) to trigger
+the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
+
+temp1_input - Core temperature (in milidegrees of Celsius).
+temp1_crit  - Maximum junction temperature  (in milidegrees of Celsius).
+temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
+  Correct CPU operation is no longer guaranteed.
+temp1_label - Contains string with the "Core X", where X is processor
+  number.
+
+The TjMax temperature is set to 85C if undocumented model specific register
+(UMSR) 0xee has bit 30 set. If not the TjMax is 100C as documented in processor
+datasheet. Intel will not disclose this information to individuals.
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index bcaa6e9..c9a8f88 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -87,7 +87,7 @@ static void msr_smp_rdmsr(void *cmd_block)
cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
 }
 
-static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
+int msr_write(int cpu, u32 reg, u32 eax, u32 edx)
 {
struct msr_command cmd;
int ret;
@@ -107,7 +107,7 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 
edx)
return ret;
 }
 
-static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, u32 * edx)
+int msr_read(int cpu, u32 reg, u32 * eax, u32 * edx)
 {
struct msr_command cmd;
int ret;
@@ -131,19 +131,22 @@ static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, 
u32 * edx)
 
 #else  /* ! CONFIG_SMP */
 
-static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
+int msr_write(int cpu, u32 reg, u32 eax, u32 edx)
 {
return wrmsr_eio(reg, eax, edx);
 }
 
-static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
+int msr_read(int cpu, u32 reg, u32 *eax, u32 *edx)
 {
return rdmsr_eio(reg, eax, edx);
 }
 
 #endif /* ! CONFIG_SMP */
 
-static loff_t msr_seek(struct file *file, loff_t offset, int orig)
+EXPORT_SYMBOL_GPL(msr_write);
+EXPORT_SYMBOL_GPL(msr_read);
+
+static loff_t msr_fseek(struct file *file, loff_t offset, int orig)
 {
loff_t ret = -EINVAL;
 
@@ -161,7 +164,7 @@ static loff_t msr_seek(struct file *file, loff_t offset, 
int orig)
return ret;
 }
 
-stat

Intel Core Duo/Solo Temperature Monitoring Working On Intel DG965 Motherboard

2007-03-10 Thread Justin Piszcz
DISCLAIMER: This patch is still experimental. 
AUTHOR: Rudolf Marek has written the coretemp module for Intel Core Duo/Solo

processors.

Without this patch, you cannot monitor your CPU temperature, at least not 
on a DG965 motherboard.


From the readme (second patch):

+Kernel driver coretemp
+==
+
+Supported chips:
+  * All Intel Core family
+Prefix: 'coretemp'
+Addresses scanned: CPUID (family 0x6, models 0xe, 0xf)
+Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual
+   Volume 3A: System Programming Guide
+
+Author: Rudolf Marek
+Contact: Rudolf Marek 

+Description
+---
+
+This driver permits reading temperature sensor embedded inside Intel Core CPU.
+Temperature is measured in degrees Celsius and measurement resolution is
+1 degree C. Valid temperatures are from 0 to TjMax degrees C, because
+the actual temperature is in fact a delta from TjMax.
+
+Temperature known as TjMax is the maximum junction temperature of processor.
+Intel defines this temperature as 85C or 100C. At this temperature, protection
+mechanism will perform actions to forcibly cool down the processor. Alarm
+may be raised, if the temperature grows enough (more than TjMax) to trigger
+the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
+
+temp1_input - Core temperature (in milidegrees of Celsius).
+temp1_crit  - Maximum junction temperature  (in milidegrees of Celsius).
+temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
+  Correct CPU operation is no longer guaranteed.
+temp1_label - Contains string with the "Core X", where X is processor
+  number.
+
+The TjMax temperature is set to 85C if undocumented model specific register
+(UMSR) 0xee has bit 30 set. If not the TjMax is 100C as documented in processor
+datasheet. Intel will not disclose this information to individuals.

How to get it working:

Per: http://www.lm-sensors.org/wiki/Devices

Scroll down to:
IntelCore/Core2  yes coretempIntegrated
sensor in CPU, patch is here.

Here is the post:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-January/018676.html

Patch1: 
http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20070114/e666982f/attachment-0002.bin


Patch2: 
http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20070114/e666982f/attachment-0003.bin


Applies clean under 2.6.20.2:
p34:/usr/src/linux-2.6.20.2# patch -p1 < /home/user/attachment-0002.bin
patching file drivers/hwmon/coretemp.c
patching file drivers/hwmon/Kconfig
patching file drivers/hwmon/Makefile
p34:/usr/src/linux-2.6.20.2# patch -p1 < /home/user/attachment-0003.bin
patching file Documentation/hwmon/coretemp
p34:/usr/src/linux-2.6.20.2#

In the Kernel I selected the following two options under:
-> Hardware Monitoring support
Hardware Monitoring support
Intel Core (2) Duo/Solo temperature sensor

Then recompile/reboot/etc.

You will need:
http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-2.10.2.tar.gz

1. You will need to remove or overwrite your old libsensors3 if you have it
installed.
2. You need to make sure you have libsysfs-dev and flex installed to compile
the latest lm_sensors.

Once everything is compiled, load the modules and run sensors:

p34:~# modprobe coretemp
p34:~# lsmod
Module  Size  Used by
coretemp5120  0
hwmon   2372  1 coretemp
p34:~#

[EMAIL PROTECTED]:~/lm_sensors-2.10.2/prog/sensors# ./sensors 
coretemp-isa-

Adapter: ISA adapter
temp1:   +40°C  (high =   +85°C) (Core 1/2)

coretemp-isa-0001
Adapter: ISA adapter
temp1:   +39°C  (high =   +85°C) (Core 2/2)

Run 10 bzip2s to test to make sure its working correctly.

[EMAIL PROTECTED]:~/lm_sensors-2.10.2/lib$ ps auxww | grep -v grep | grep -c 
bzip2
10
[EMAIL PROTECTED]:~/lm_sensors-2.10.2/lib$

Watch temps:

[EMAIL PROTECTED]:~/lm_sensors-2.10.2/prog/sensors# ./sensors 
Adapter: ISA adapter

temp1:   +54°C  (high =   +85°C)
temp1:   +53°C  (high =   +85°C)

( .. a few minutes later .. )

temp1:   +57°C  (high =   +85°C) 
temp1:   +55°C  (high =   +85°C)


( .. a few minutes later .. )

temp1:   +58°C  (high =   +85°C) 
temp1:   +57°C  (high =   +85°C)


( .. a few minutes later .. )

temp1:   +60°C  (high =   +85°C) 
temp1:   +58°C  (high =   +85°C)


( .. a few minutes later .. )

temp1:   +62°C  (high =   +85°C) 
temp1:   +60°C  (high =   +85°C)


[EMAIL PROTECTED]:~/lm_sensors-2.10.2/lib$ killall -9 bzip2

temp1:   +52°C  (high =   +85°C) 
temp1:   +51°C  (high =   +85°C)


( .. a few minutes later .. )

temp1:   +48°C  (high =   +85°C) 
temp1:   +48°C  (high =   +85°C)


Setup:

p34:~# sensors 
coretemp-isa-

Adapter: ISA adapter
temp1:   +41°C  (high =   +85°C)

coretemp-isa-0001
Adapter: ISA adapter
temp1: