[ltp] tp_smapi 0.18 and hdaps lockups

Shem Multinymous linux-thinkpad@linux-thinkpad.org
Sat, 1 Apr 2006 03:37:37 +0300


Version 0.18 of the tp_smapi is out. This release improves stability
and code structure. There are no changes in functionality.

One major issue addressed is occasional embedded controller lockup
(manifested as keyboard+mouse input death) triggered by tp_smapi's
hdaps patch (i.e., "make HDAPS=3D1"). The fix was to avoid retrying
failed sensor reads from inside the mousedev_poll timer handler. The
fact that such retries confuse the embedded controller suggests that
there's something horribly wrong with touching the embedded controller
at all in that softirq context (maybe there's a race condition with
ACPI events that talk to the same hardware through a different
interface?).

My conclusion is that vanilla hdaps is therefore also broken, but
doesn't trigger the hang frequently because it spends so little time
in softirq (no retries). The hdaps patch in tp_smapi now does the
same, meaning it's equally un/broken.

Incidentally, by now the hdaps patch in tp_smapi includes quite a few
fixes, improvements and cleanups that are unrelated to tp_smapi
(though some of them are easier to implement given tp_smapi's
infrastructure). You may want to use it, and report your success, even
if you don't use tp_smapi's other functions. I hope to eventually have
it merged.

Back to the tp_smapI release:

0.18  2006-04-01
----------------
- Solved embedded controller lockups with HDAPS=3D1 (see hdaps comments bel=
ow).
- Added new function tp_controller_try_read_row() to tp_base.
- Added extra status checks in tp_base, to catch abnormal conditions earlie=
r.
- Restructured several functions in tp_base for clarity and reusability.
- Restructured tp_smapi attribute registration code using fancy macros, to
  remove redundancy.
- Reduced prefetch delay and maximum retries in tp_base.
- Now locks tp_controller when making SMAPI call (just in case).
- Makefile change to fix compilation in Debian.
- Minor cleanups and added comments in tp_smapi.c.
- Major changes to hdaps patch:
  - Whenever we read data from the controller, parse all of it and
    remember the values in global vars.
  - Simplified the device model *_show functions, via the above change.
  - If the mousedev poll timer handler experiences a transient fault, use
    use last saved data from the global vars.
  - Handle delayed calibration at first opportunity, not just mousedev poll=
s.
  - Disable mousedev poll timer when suspending, to prevent readouts before
    the resume code re-initializes the sensor.
  - Don't accept initial status 0x00, it was probably an artifact of
    the premature mousepoll invocation.
  - When doing a sensor readout in mousedev poll, avoid time-consuming
    retries and fetches, to minimize time in softirq. This effectively
    exorcises an embedded controller lockup Heisenbug. There may still
    a nonzero probability of lockup, but now it's not worse than the
    vanilla hdaps (since they do essentially the same).

http://thinkwiki.org/wiki/tp_smapi
http://sourceforge.net/project/showfiles.php?group_id=3D1212&package_id=3D1=
71579

  Shem