Comment 171 for bug 1220426

Revision history for this message
Nikhil Mahale (nmahale) 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.