All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] reading CPU temp from kernel module
@ 2006-02-01 16:00 andreas.konrad
  2006-02-04 11:14 ` Jean Delvare
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: andreas.konrad @ 2006-02-01 16:00 UTC (permalink / raw)
  To: lm-sensors

Hello,

could anyone tell me how to read the CPU temperature within a kernel module?
Is this possible?
Any proposals?

Thanks

Andreas



Machen Sie aus 14 Cent spielend bis zu 100 Euro!
Die neue Gaming-Area von Arcor - ?ber 50 Onlinespiele im Angebot.
http://www.arcor.de/rd/emf-gaming-1


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

* [lm-sensors] reading CPU temp from kernel module
  2006-02-01 16:00 [lm-sensors] reading CPU temp from kernel module andreas.konrad
@ 2006-02-04 11:14 ` Jean Delvare
  2006-02-05 17:53 ` andreas.konrad
  2006-02-06  9:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2006-02-04 11:14 UTC (permalink / raw)
  To: lm-sensors

Hi Andreas,

> could anyone tell me how to read the CPU temperature within a kernel module?
> Is this possible?
> Any proposals?

Using the hardware monitoring drivers, no, it's not possible. The
drivers export temperature values, but don't know which temperature
corresponds to the CPU - as this is completely board-dependant, the
mapping is done in user-space. The returned values may also need
scaling, which is done in user-space as well.

Now, you may take you chance with ACPI. The "thermal" ACPI driver,
where available, provides a temperature which doesn't need scaling. I
see nothing which guarantees that the temperature provided correponds
to the CPU, but this seems to be true in most cases.

May I ask why you would need this information from a kernel driver?

> Machen Sie aus 14 Cent spielend bis zu 100 Euro!
> Die neue Gaming-Area von Arcor - ?ber 50 Onlinespiele im Angebot.
> http://www.arcor.de/rd/emf-gaming-1

This is a public mailing list, please don't spam it with advertisement.

Thanks,
-- 
Jean Delvare


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

* [lm-sensors] reading CPU temp from kernel module
  2006-02-01 16:00 [lm-sensors] reading CPU temp from kernel module andreas.konrad
  2006-02-04 11:14 ` Jean Delvare
@ 2006-02-05 17:53 ` andreas.konrad
  2006-02-06  9:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: andreas.konrad @ 2006-02-05 17:53 UTC (permalink / raw)
  To: lm-sensors

Hi Jean,

thank you very much for your answer.
I'm sorry because of the advertisement, but it is added by my email provider.

>> could anyone tell me how to read the CPU temperature within a kernel module?
>> Is this possible?
>> Any proposals?

> Using the hardware monitoring drivers, no, it's not possible. The
> drivers export temperature values, but don't know which temperature
> corresponds to the CPU - as this is completely board-dependant, the
> mapping is done in user-space. The returned values may also need
> scaling, which is done in user-space as well.

> Now, you may take you chance with ACPI. The "thermal" ACPI driver,
> where available, provides a temperature which doesn't need scaling. I
> see nothing which guarantees that the temperature provided correponds
> to the CPU, but this seems to be true in most cases.

> May I ask why you would need this information from a kernel driver?

I want to measure the influence of temperature on the performance of the CPU. Due to this I have an external hardware which generates a very precise signal every second. This signal causes an interrupt and in the interrupt service routine (= kernel-mode / kernel module) I want to printk the timestamp counter and the temperature of the CPU. First I wanted to use a user-mode application, but this way I get a too big and variing latencies. Unfortenately I don't know how to read from the bus which can deliver the temperature information.

How can I give ACPI a try? Is there a code example?

Nice day

Andreas



Machen Sie aus 14 Cent spielend bis zu 100 Euro!
Die neue Gaming-Area von Arcor - ?ber 50 Onlinespiele im Angebot.
http://www.arcor.de/rd/emf-gaming-1


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

* [lm-sensors] reading CPU temp from kernel module
  2006-02-01 16:00 [lm-sensors] reading CPU temp from kernel module andreas.konrad
  2006-02-04 11:14 ` Jean Delvare
  2006-02-05 17:53 ` andreas.konrad
@ 2006-02-06  9:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2006-02-06  9:10 UTC (permalink / raw)
  To: lm-sensors


Hallo Andreas,

> I'm sorry because of the advertisement, but it is added by my email
> provider.

I would urge you to change providers then. I guess you get the mail
service for "free" in echange of an advertisement being inserted in
each e-mail you send? Nothing is really free, you know, and someone has
to pay. In this case, the ones who pay are the recipients of your post -
150 people or so reading this list. Sure, we don't pay with money; but
we pay with bandwidth, storage space and time, and these have a value
too.

So, put in short, not only you are asking us for technical help (which is
OK, that's was the list was created for) but you ask us to pay in order
to help you. How acceptable is this? Not much, I fear.

> I want to measure the influence of temperature on the performance of the
> CPU. Due to this I have an external hardware which generates a very
> precise signal every second. This signal causes an interrupt and in the
> interrupt service routine (= kernel-mode / kernel module) I want to
> printk the timestamp counter and the temperature of the CPU. First I
> wanted to use a user-mode application, but this way I get a too big and
> variing latencies. Unfortenately I don't know how to read from the bus
> which can deliver the temperature information.

This is an interesting experiment, but I am not sure your experimental
setup is right. What exactly are you measuring? The time the kernel will
take to handle the interrupt, as I understand it. The variations of it
will probably be neglectable compared to the time spent by printk (and
the consequent logging, either on screen or on disk) and the noise from
the rest of the system.

What CPU are you working with, BTW? As far as I know, almost all CPUs
work at a fixed clock rate anyway, so how could the speed depend on the
temperature?

> How can I give ACPI a try? Is there a code example?

No idea, sorry. You better ask this question on the linux-acpi list (see
MAINTAINERS). Make sure that your test system supports ACPI temperature
reporting first (enable ACPI thermal and look in
/proc/acpi/thermal_zone).

Note that if your experiment is meant to be only run on one specific
system, and ACPI thermal doesn't work, and lm_sensors does, then you
may just hack the relevant hardware monitoring driver to do just what
you need: export a function which probes for just one temperature and
prints it. It might be preferable over ACPI anyway, because ACPI thermal
seems to report the measured temperature with limited resolution (1
degree C) and may also cache the measured value for some times, like the
hardware monitoring drivers do by default.

--
Jean Delvare


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

end of thread, other threads:[~2006-02-06  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-01 16:00 [lm-sensors] reading CPU temp from kernel module andreas.konrad
2006-02-04 11:14 ` Jean Delvare
2006-02-05 17:53 ` andreas.konrad
2006-02-06  9:10 ` Jean Delvare

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.