Touchpad sometimes not working upon system startup

Bug #1014460 reported by Eric Miao
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Fix Released
High
Unassigned
Declined for Quantal by Stéphane Graber
Oneiric
Fix Released
High
Eric Miao
Precise
Fix Released
High
Eric Miao

Bug Description

SRU Justification
=================

[Impact]
Sometimes the notebook touchpad is non-functional upon system boot or resuming from suspend. OEMs that we work with consider this bug as very bad user experience.

[Test Case]
This bug happens infrequently, but on machines that are affected by this bug, one can prove this fix empirically by rebooting the machine many times (e.g. >50) and make sure the touchpad is working after each reboot.

[Regression Potential]
This bug is fixed by adding a new udev rule, and this rule is to modprobe the kernel module when serio event is received. This does not have adverse effect on unaffected systems, and I can't see how it will lead to regressions.

--

Original description:

This happens very infrequently. The symptom is touchpad not working after boot up unless a reboot is made, or a manual "modprobe psmouse" is performed on the command line. Movement or click activities on the touchpad during system startup will increase the chance of happening of this issue.

The root cause is a race condition upon system startup, that the serio1 device (i.e. the AUX port) could be temporarily binded to the keyboard driver, and thus udev rule will ignore the event by not loading psmouse at all. A detailed explanation of the theory is as follows:

1. serio ports (e.g. AUX port for touchpad) are different than other devices that:
   - the kernel is using a dedicated kernel thread kseriod to handle the events
   - interrupts on serio port will trigger connect attempt, as the OS has no idea when a keyboard/mouse could be plugged into the computer

2. The AT keyboard driver atkbd.c is built-in to the kernel for speed up as there will be normally an AT keyboard present, however, as on a normal PC, the keyboard can be connected to either the keyboard PS/2 port (i.e. KBD port), or the mouse PS/2 port (i.e. AUX port), the atkbd driver will be probed each time an interrupt is generated on the AUX port, in case there is a plug

3. When doing the probing, the serio1 device will be temporarily binded with atkbd, and this is in the context of kseriod

4. udev has the chance of being launched at the same time, the time that udev is launched, there will be a trigger to replay all uevents

5. that trigger will request uevents to be generated from the kernel, and if serio1 happens to be in the middle of a probing (most likely with atkbd), the uevent generated will have DRIVER=atkbd with it

6. psmouse is being built as a module, udev is following the rule below to load psmouse ondemand:

  /lib/udev/rules.d/80-drivers.rules:
  ...
  DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}"

7. So if uevent for serio1 happens to be with DRIVER entry, this rule will _not_ be performed as DRIVER!="?*" is _not_ matched, thus modprobe will not load psmouse on demand

8. One simple fix is to add one additional rule to 80-drivers.rules, so that serio events are treated special that modprobe will anyway be performed, e.g.

  SUBSYSTEM=="serio", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}"

Revision history for this message
Eric Miao (eric.y.miao) wrote :
tags: added: blocks-hwcert-enablement
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fix-race-condition-of-serio-driver-module-not-loading.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in udev (Ubuntu):
importance: Undecided → High
Revision history for this message
Martin Pitt (pitti) wrote :

I quickly discussed this with Eric, and it was discussed with upstream already. This seems fine for now to apply as an Ubuntu patch, so sponsors, please go ahead.

Changed in udev (Ubuntu):
status: New → Triaged
Eric Miao (eric.y.miao)
tags: added: rls-q-incoming
Steve Langasek (vorlon)
Changed in udev (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 175-0ubuntu10

---------------
udev (175-0ubuntu10) quantal; urgency=low

  * debian/patches/fix-race-condition-of-serio-driver-module-not-
    loading.patch: Fix a race condition at boot with serio devices.
    Thanks to Eric Miao <email address hidden>. Closes LP: #1014460.
  * Update Vcs-Bzr for the current release branch.

  [ Herton Ronaldo Krzesinski ]
  * Refresh debian/patches/avoid-exit-deadlock-for-dm_cookie.patch:
    avoid serialization issues in handling of events with DM_COOKIE
    set (LP: #1017715).
 -- Steve Langasek <email address hidden> Tue, 03 Jul 2012 00:25:55 -0700

Changed in udev (Ubuntu):
status: Fix Committed → Fix Released
Steve Langasek (vorlon)
Changed in udev (Ubuntu Oneiric):
status: New → Triaged
Changed in udev (Ubuntu Precise):
status: New → Triaged
Changed in udev (Ubuntu Oneiric):
importance: Undecided → High
Changed in udev (Ubuntu Precise):
importance: Undecided → High
Revision history for this message
Stéphane Graber (stgraber) wrote :

Can you please update the bug description to include:
[rational]
[test case]
[regression potential]

These are required before uploading the SRU: https://wiki.ubuntu.com/StableReleaseUpdates

Marking the SRU tasks Incomplete until then.

Changed in udev (Ubuntu Oneiric):
status: Triaged → Incomplete
Changed in udev (Ubuntu Precise):
status: Triaged → Incomplete
Revision history for this message
Anthony Wong (anthonywong) wrote :

Updated bug description with SRU rationale, set bug status back to Triaged.

description: updated
Changed in udev (Ubuntu Oneiric):
status: Incomplete → Triaged
Changed in udev (Ubuntu Precise):
status: Incomplete → Triaged
Revision history for this message
Chris Halse Rogers (raof) wrote :

Uploaded to precise-proposed and oneiric-proposed queues; I'll let another member of the SRU team accept these into -proposed, where they will build and can then be tested.

Revision history for this message
Anthony Wong (anthonywong) wrote :

Will they be accepted soon so we can begin testing?

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Anthony: when the SRU team review it, should be sometime in the next week, I recommend you ping the SRU team member on duty to ask for it if it's important, see the list on https://wiki.ubuntu.com/StableReleaseUpdates#Publishing

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Eric, or anyone else affected,

Accepted udev into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/udev/175-0ubuntu9.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in udev (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Chris Van Hoof (vanhoof)
Changed in udev (Ubuntu Precise):
assignee: nobody → Eric Miao (eric.y.miao)
Changed in udev (Ubuntu Oneiric):
assignee: nobody → Eric Miao (eric.y.miao)
Revision history for this message
Anthony Wong (anthonywong) wrote :

Hi Brian,

Can you also accept for oneiric? We need that for an oem project. Thanks.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Eric, or anyone else affected,

Accepted udev into oneiric-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/udev/173-0ubuntu4.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in udev (Ubuntu Oneiric):
status: Triaged → Fix Committed
Revision history for this message
Sebastien Bacher (seb128) wrote :

setting verification-done, while I didn't get the original issue I can confirm that the new version works without visible regression there, the other got verified to be fixed so we should move the SRU

tags: added: verification-done
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 175-0ubuntu9.1

---------------
udev (175-0ubuntu9.1) precise-proposed; urgency=low

  [ Herton Ronaldo Krzesinski ]
  * Refresh debian/patches/avoid-exit-deadlock-for-dm_cookie.patch:
    avoid serialization issues in handling of events with DM_COOKIE
    set (LP: #1017715).

  [ Eric Miao ]
  * fix-race-condition-of-serio-driver-module-not-loading.patch:
    Work around race condition in PS/2 keyboard/mouse handling. This resulted
    in udev sometimes failing to load the psmouse driver, causing touchpads to
    occasionally not work after boot up. (LP: #1014460)
 -- Herton Ronaldo Krzesinski <email address hidden> Mon, 16 Jul 2012 07:17:56 +0200

Changed in udev (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Eric Miao (eric.y.miao) wrote :

Confirmed that both Precise and Oneiric have no visible regression.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 173-0ubuntu4.3

---------------
udev (173-0ubuntu4.3) oneiric-proposed; urgency=low

  [ Herton Ronaldo Krzesinski ]
  * Refresh debian/patches/avoid-exit-deadlock-for-dm_cookie.patch:
    avoid serialization issues in handling of events with DM_COOKIE
    set (LP: #1017715).

  [ Eric Miao ]
  * fix-race-condition-of-serio-driver-module-not-loading.patch:
    Work around race condition in PS/2 keyboard/mouse handling. This resulted
    in udev sometimes failing to load the psmouse driver, causing touchpads to
    occasionally not work after boot up. (LP: #1014460)
 -- Herton Ronaldo Krzesinski <email address hidden> Mon, 16 Jul 2012 07:25:22 +0200

Changed in udev (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Sebastian (sebastianhaselbeck) wrote :

hate to dig this up, but i keep having this, throughout 13.04, 13.10, 14.04.... sometimes touchpad/intellipoint just dont work. sometimes putting the laptop to sleep and re-awaking helps. Sometimes an external mouse will work though

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.