[lm-sensors] Could the k8temp driver be interfering with ACPI?

Jean Delvare khali at linux-fr.org
Mon Mar 19 08:08:49 CET 2007

Hi Richard,

On Sun, 18 Mar 2007 14:36:08 -0500, Richard Voigt wrote:
> On 3/3/07, Jean Delvare wrote:
> > On Fri, 2 Mar 2007 21:12:51 +0000, Matthew Garrett wrote:
> > > Assuming arbitration of access, what's the problem with having two
> > > drivers accessing the same hardware? Do these chips generally have any
> > > significant internal state other than trip points and the like?
> >
> > The "assuming arbitration of access" is the key part of your
> > sentence ;) The problem is that currently no arbitration is done. If it
> > was done, then state would probably not be a problem. Most hardware
> > monitoring drivers don't assume any state is preserved between
> > accesses, and those which do can easily be changed not to. The ACPI
> > side is another story though, I guess we can't assume anything about
> > the AML code's assumption on states, as it differs from one machine to
> > the next. But we can try to be cooperative and restore the sensible
> > registers (e.g. bank selector) in the same state we found them.
> I recall that one of the stated drawbacks of a lock was that no ACPI
> code could execute while the hwmon driver was doing its fairly lengthy
> conversation with the hardware.
> It seems that using transactional concepts here would solve that
> problem.  For example, the hwmon driver issues a start transaction
> request.  The first write request to any given location (bank register
> for example) causes the previous memory value to be saved.  Then,
> instead of locking AML out, AML is allowed to execute, but any access
> to the memory/port ranges reserved by the driver (when the transaction
> is set up) cause the hwmon transaction to be rolled back so the AML
> sees the expected state.  Then AML proceeds as usual.  When hwmon
> tries additional operations, they fail with some "transaction
> interrupted" error message, indicating to the hwmon driver to start
> over.
> The only issue with this that I can see, is that if AML isn't
> executed atomically wrt hwmon, then knowing when it is safe for hwmon
> to retry is going to be difficult.

No. We're not rolling back anything, it's totally unrealistic. These
are device drivers we're talking about here, not a database. The I/O
accesses done by the hardware monitoring drivers are not that long, so
AML gets to wait for them to be finished, and that's it. There is no
valid reason to give the priority to AML over regular device drivers.
Rudolf Marek's approach sounds much better.

> This probably requires changes to every hwmon driver, but they can be
> updated piecemeal, starting with the ones most commonly found in
> notebooks, where ACPI is most important.

Most notebooks don't expose their hardware monitoring chip at all.
Those which do use SMBus devices in majority, where I/O forwarding is
going to be difficult, as it needs to be done at the SMBus controller
level, not the hardware monitoring device level. I want to get my hands
on such a laptop first though, as I need to see what exacly ACPI is
doing before I can think of a solution.

Jean Delvare

More information about the lm-sensors mailing list