Comment 172 for bug 1220426

Revision history for this message
Kyrillos (kmossad) wrote : Re: [Bug 1220426] Re: [nvidia-prime]Freeze while using touchpad

Nice work Mikhil! Can't wait to try the patch! Thank you for your efforts.
Everyone has been waiting for a resolution for quite some time.
On Nov 13, 2014 3:01 AM, "Nikhil Mahale" <email address hidden> wrote:

> Hi guys,
>
> This is a xserver issue where timers-list gets corrupted because of race
> condition.
> nVidia X-driver uses timer to update scanout surface after regular
> interval, this timer gets removed from timers list because of this
> timers-list corruption and desktop gets freezed. This is only happening
> with touch pad because touch pad driver is also heavily using timers, which
> is easily triggering this race condition.
>
> xserver goes through following race condition -
>
> WaitForSomething()
> |
> ----> // timers -> synaptics-1 -> nvidia-2 -> null
> while (timers && (int) (timers->expires - now) <= 0)
> // prototype - DoTimer(OsTimerPtr timer, CARD32 now,
> OsTimerPtr *prev)
> DoTimer(timers, now, &timers)
> |
> |
> ----> OsBlockSignals(); .... SIGIO OS Signal comes
> just before blocking it,
> ....
> synaptics-1 handler gets called.
> //
> synaptics-1 gets served and scheduled again;
> // timers ->
> nvidia-2 -> synaptics-1 -> null
> ....
> *prev = timer->next;
> timer->next = NULL; // timers -> null
> // timers list gets corrupted here and
> nvidia-2 gets removed from list.
>
> Attaching patch to fix this issue, its working for me.
>
>
> ** Patch added: "0001-os-Fix-timer-race-conditions.patch"
>
> https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1220426/+attachment/4259702/+files/0001-os-Fix-timer-race-conditions.patch
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1220426
>
> Title:
> [nvidia-prime]Freeze while using touchpad
>
> Status in “nvidia-graphics-drivers-319” package in Ubuntu:
> Triaged
> Status in “nvidia-graphics-drivers-331” package in Ubuntu:
> Triaged
> Status in “nvidia-graphics-drivers-343” package in Ubuntu:
> Triaged
> Status in “nvidia-prime” package in Ubuntu:
> Triaged
>
> Bug description:
> I'm using an Optimus laptop (Asus N43SL)
> nvidia-prime is installed, so my nvidia dedicated graphics card (GT
> 540m) is in use.
>
> Once in a while, my screen will freeze, only when I use my touchpad.
> This does not happen with my USB mouse.
> This does not happen either when I uninstall nvidia-prime and use my
> intel integrated graphics (HD3000).
>
> I can temporarily solve the issue by doing a VT switch.
>
>
> In the attached Xorg.0.log, you can see "synaptics: ETPS/2 Elantech
> Touchpad: touchpad found" each time I did a VT switch and regained control.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-319/+bug/1220426/+subscriptions
>