lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 23 Mar 2016 15:47:26 -0300
From:	Gustavo Padovan <gustavo@...ovan.org>
To:	dri-devel@...ts.freedesktop.org
Cc:	linux-kernel@...r.kernel.org, Daniel Stone <daniels@...labora.com>,
	Arve Hjønnevåg <arve@...roid.com>,
	Riley Andrews <riandrews@...roid.com>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	Rob Clark <robdclark@...il.com>,
	Greg Hackmann <ghackmann@...gle.com>,
	John Harrison <John.C.Harrison@...el.com>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Gustavo Padovan <gustavo.padovan@...labora.co.uk>
Subject: [RFC 5/6] dma-buf/fence: add fence_collection_wait()

From: Gustavo Padovan <gustavo.padovan@...labora.co.uk>

Iterate over the array of fences and wait for all of the to finish.

Signed-off-by: Gustavo Padovan <gustavo.padovan@...labora.co.uk>
---
 drivers/dma-buf/fence.c | 16 ++++++++++++++++
 include/linux/fence.h   |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
index a3fe3e7..31e554b 100644
--- a/drivers/dma-buf/fence.c
+++ b/drivers/dma-buf/fence.c
@@ -532,6 +532,22 @@ fence_init(struct fence *fence, const struct fence_ops *ops,
 EXPORT_SYMBOL(fence_init);
 
 /**
+ * fence_collection_wait - Wait for collection of fences to signal
+ * @collection:	[in]	the collection to wait on
+ *
+ * This functions simplifies the waiting process when one needs to
+ * wait for many fences at the same time.
+ */
+void fence_collection_wait(struct fence_collection *collection)
+{
+	int i;
+
+	for (i = 0 ; i < collection->num_fences ; i++)
+		fence_wait(collection->fences[i], false);
+}
+EXPORT_SYMBOL(fence_collection_wait);
+
+/**
  * fence_collection_put - put all the fences in a collection
  * @collection:	[in]	the collection to put fences
  *
diff --git a/include/linux/fence.h b/include/linux/fence.h
index 3f871b0..52f1aea 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -244,6 +244,7 @@ int fence_add_callback(struct fence *fence, struct fence_cb *cb,
 bool fence_remove_callback(struct fence *fence, struct fence_cb *cb);
 void fence_enable_sw_signaling(struct fence *fence);
 
+void fence_collection_wait(struct fence_collection *collection);
 void fence_collection_put(struct fence_collection *collection);
 
 /**
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ