From 5ea6f1c32628887c9df0c53bc8c199eb12633fec Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 26 Feb 2015 11:54:03 +0100 Subject: 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 Reviewed-By: Emil Velikov --- tests/nouveau/Makefile.am | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/nouveau/Makefile.am (limited to 'tests/nouveau/Makefile.am') diff --git a/tests/nouveau/Makefile.am b/tests/nouveau/Makefile.am new file mode 100644 index 00000000..c4f6e299 --- /dev/null +++ b/tests/nouveau/Makefile.am @@ -0,0 +1,16 @@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include/drm \ + -I$(top_srcdir)/nouveau \ + -I$(top_srcdir) + +AM_CFLAGS = $(WARN_CFLAGS) + +LDADD = \ + ../../nouveau/libdrm_nouveau.la \ + ../../libdrm.la \ + -ldl -lpthread + +TESTS = threaded + +check_PROGRAMS = $(TESTS) + -- cgit v1.2.3