[PATCH 2/4] X event queue mutex
Tiago Vignatti
vignatti at c3sl.ufpr.br
Mon Oct 6 20:45:09 PDT 2008
Keith Packard escreveu:
> The input thread will block before enqueuing while the X server pulls
> events out of the queue, causing it to stop reading events and updating
> the cursor.
Indeed.
The following patch assert the order of events enqueued with a mutex
protecting writes to the tail pointer in mieqEnqueue. If the main thread
blocks somehow, the input thread continues doing its job. All
mieqEnqueue users must be safe now.
> The X server also reads the input queue pointers from DIX before calling
> into ProcessInputEvents, so you aren't safe against memory write races
> (where writes to one location are visible across CPUs before writes to
> another location).
I think this can be easily changed by nonblocking pipes. If someone
wants to wakeup PIE, then just write on the pipe in which this function
is listening. I have to think a little more about this but it may be
easy to address.
> So, we either need to fix the users of checkForInput along with all
> users of miEventQueue, or we need to assert that we're running on a
> sensible CPU that doesn't require a mutex to make memory changes visible
> across processors, in which case we don't need any mutex at all.
I really don't know how to check if a CPU is visible to the other CPU.
Thanks,
--
Tiago Vignatti
C3SL - Centro de Computação Científica e Software Livre
www.c3sl.ufpr.br
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lock-writes-to-the-tail-pointer-in-mieqEnqueue.patch
Type: text/x-diff
Size: 2662 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20081007/ec70fdea/attachment.patch>
More information about the xorg
mailing list