OSDN Git Service

nouveau: make nouveau importing global buffers completely thread-safe, with tests
authorMaarten Lankhorst <maarten.lankhorst@ubuntu.com>
Thu, 26 Feb 2015 10:54:03 +0000 (11:54 +0100)
committerMaarten Lankhorst <dev@mblankhorst.nl>
Fri, 13 Mar 2015 19:26:33 +0000 (20:26 +0100)
commit5ea6f1c32628887c9df0c53bc8c199eb12633fec
treef466d5ed08d547ebb20da6ccc6fa1cbb2efc3785
parent7caa442e761ab5e48698c937aea9ce18f4522ecb
nouveau: make nouveau importing global buffers completely thread-safe, with tests

While I've closed off most races in a previous patch, a small race still existed
where importing then unreffing cound cause an invalid bo. Add a test for this case.

Racing sequence fixed:

- thread 1 releases bo, refcount drops to zero, blocks on acquiring nvdev->lock.
- thread 2 increases refcount to 1.
- thread 2 decreases refcount to zero, blocks on acquiring nvdev->lock.

At this point the 2 threads will clean up the same bo.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Reviewed-By: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
nouveau/nouveau.c
tests/Makefile.am
tests/nouveau/.gitignore [new file with mode: 0644]
tests/nouveau/Makefile.am [new file with mode: 0644]
tests/nouveau/threaded.c [new file with mode: 0644]