RE: [RFC PATCH] dmabuf-sync: Introduce buffer synchronization framework

From
Inki Dae <inki.dae@samsung.com>
Date
2013-06-13 11:25:11
Also in
dri-devel, linux-arm-kernel, linux-media
Reply to
Inki Dae, 2013-06-13
+static void dmabuf_sync_timeout_worker(struct work_struct *work)
+{
+	struct dmabuf_sync *sync = container_of(work, struct dmabuf_sync,
work);
+	struct dmabuf_sync_object *sobj;
+
+	mutex_lock(&sync->lock);
+
+	list_for_each_entry(sobj, &sync->syncs, head) {
+		if (WARN_ON(!sobj->robj))
+			continue;
+
+		printk(KERN_WARNING "%s: timeout = 0x%x [type = %d, " \
+					"refcnt = %d, locked = %d]\n",
+					sync->name, (u32)sobj->dmabuf,
+					sobj->access_type,
+
atomic_read(&sobj->robj->shared_cnt),
quoted hunk ↗ jump to hunk
+					sobj->robj->locked);
+
+		/* unlock only valid sync object. */
+		if (!sobj->robj->locked)
+			continue;
+
+		if (sobj->robj->shared &&
+				atomic_read(&sobj->robj->shared_cnt) > 1) {
+			atomic_dec(&sobj->robj->shared_cnt);
+			continue;
+		}
+
+		ww_mutex_unlock(&sobj->robj->lock);
+
+		if (sobj->access_type & DMA_BUF_ACCESS_READ)
+			printk(KERN_WARNING "%s: r-unlocked = 0x%x\n",
+					sync->name, (u32)sobj->dmabuf);
+		else
+			printk(KERN_WARNING "%s: w-unlocked = 0x%x\n",
+					sync->name, (u32)sobj->dmabuf);
+
+#if defined(CONFIG_DEBUG_FS)
+		sync_debugfs_timeout_cnt++;
+#endif
Oops, unnecessary codes. will remove them.
Thread (10 messages) 10 messages, 3 authors, last reply 2013-06-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help