Bug 86288 - [nvidia-prime]Freeze while using touchpad
Summary: [nvidia-prime]Freeze while using touchpad
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium critical
Assignee: Nikhil Mahale
QA Contact: Xorg Project Team
Depends on:
Reported: 2014-11-14 17:52 UTC by Nikhil Mahale
Modified: 2015-03-03 19:51 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:

[PATCH] os: Fix timer race conditions (3.77 KB, patch)
2014-11-14 18:24 UTC, Nikhil Mahale
no flags Details | Splinter Review

Description Nikhil Mahale 2014-11-14 17:52:32 UTC

This bug is root caused in xorg-server os layer, attaching patch to fix it and sending it to xorg-devel list.
Comment 1 Nikhil Mahale 2014-11-14 18:24:06 UTC
Created attachment 109479 [details] [review]
[PATCH] os: Fix timer race conditions
Comment 2 snafu109 2015-02-03 23:50:20 UTC
Now patch is merged, should status be updated?

Reference: http://cgit.freedesktop.org/xorg/xserver/commit/?id=fe4c774c572e3f55a7417f0ca336ae1479a966ad

It would be great to update status so this flows to Ubuntu's bug tracker.
Comment 3 Aaron Plattner 2015-02-06 16:52:10 UTC
Yeah, it should.  Thanks for the ping.

Marking fixed with commit fe4c774c572e3f55a7417f0ca336ae1479a966ad
Author: Nikhil Mahale <nmahale@nvidia.com>
Date:   Sat Jan 24 17:06:59 2015 -0800

    os: Fix timer race conditions
    Fixing following kind of race-conditions -
        ---->  // timers -> timer-1 -> timer-2 -> null
               while (timers && (int) (timers->expires - now) <= 0)
                   // prototype - DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
                   DoTimer(timers, now, &timers)
                   ----> OsBlockSignals();  .... OS Signal comes just before blocking it,
                                            .... timer-1 handler gets called.
                                                 // timer-1 gets served and scheduled again;
                                                 // timers -> timer-2 -> timer-1 -> null
                         *prev = timer->next;
                          timer->next = NULL;   // timers -> null
                          // timers list gets corrupted here and timer-2 gets removed from list.
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86288
    Signed-off-by: Nikhil Mahale <nmahale@nvidia.com>
    Reviewed-by: Julien Cristau <jcristau@debian.org>
    v2: Apply warning fixes from Keith Packard <keithp@keithp.com>
    Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
    Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

 os/WaitFor.c | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.