mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	dri-devel@lists.freedesktop.org,
	"Daniel Stone" <daniels@collabora.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Rob Clark" <robdclark@gmail.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"John Harrison" <John.C.Harrison@Intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: [PATCH 2/7] staging/android: display sync_pt name on debugfs
Date: Mon, 20 Jun 2016 12:53:08 -0300	[thread overview]
Message-ID: <1466437993-21573-3-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1466437993-21573-1-git-send-email-gustavo@padovan.org>

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

When creating a sync_pt the name received wasn't used anywhere.
Now we add it to the sync info debug output to make it easier to indetify
the userspace name of that sync pt.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sw_sync.c    | 16 ++++------------
 drivers/staging/android/sync_debug.c |  5 +++--
 drivers/staging/android/sync_debug.h |  9 +++++++++
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index b4ae092..ea27512 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -37,15 +37,6 @@ struct sw_sync_create_fence_data {
 		struct sw_sync_create_fence_data)
 #define SW_SYNC_IOC_INC			_IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
 
-static const struct fence_ops timeline_fence_ops;
-
-static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
-{
-	if (fence->ops != &timeline_fence_ops)
-		return NULL;
-	return container_of(fence, struct sync_pt, base);
-}
-
 struct sync_timeline *sync_timeline_create(const char *name)
 {
 	struct sync_timeline *obj;
@@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
 }
 
 static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
-			     unsigned int value)
+			     unsigned int value, char *name)
 {
 	unsigned long flags;
 	struct sync_pt *pt;
@@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
 	if (!pt)
 		return NULL;
 
+	strlcpy(pt->name, name, sizeof(pt->name));
 	spin_lock_irqsave(&obj->child_list_lock, flags);
 	sync_timeline_get(obj);
 	fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
@@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence,
 	snprintf(str, size, "%d", parent->value);
 }
 
-static const struct fence_ops timeline_fence_ops = {
+const struct fence_ops timeline_fence_ops = {
 	.get_driver_name = timeline_fence_get_driver_name,
 	.get_timeline_name = timeline_fence_get_timeline_name,
 	.enable_signaling = timeline_fence_enable_signaling,
@@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
 		goto err;
 	}
 
-	pt = sync_pt_create(obj, sizeof(*pt), data.value);
+	pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name);
 	if (!pt) {
 		err = -ENOMEM;
 		goto err;
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index 4c5a855..b732ea3 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
 {
 	int status = 1;
 	struct sync_timeline *parent = fence_parent(fence);
+	struct sync_pt *pt = fence_to_sync_pt(fence);
 
 	if (fence_is_signaled_locked(fence))
 		status = fence->status;
 
-	seq_printf(s, "  %s%sfence %s",
+	seq_printf(s, "  %s%sfence %s %s",
 		   show ? parent->name : "",
-		   show ? "_" : "",
+		   show ? "_" : "", pt->name,
 		   sync_status_str(status));
 
 	if (status <= 0) {
diff --git a/drivers/staging/android/sync_debug.h b/drivers/staging/android/sync_debug.h
index c44f447..c14587c 100644
--- a/drivers/staging/android/sync_debug.h
+++ b/drivers/staging/android/sync_debug.h
@@ -43,10 +43,19 @@ static inline struct sync_timeline *fence_parent(struct fence *fence)
 
 struct sync_pt {
 	struct fence base;
+	char name[32];
 	struct list_head child_list;
 	struct list_head active_list;
 };
 
+extern const struct fence_ops timeline_fence_ops;
+static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
+{
+	if (fence->ops != &timeline_fence_ops)
+		return NULL;
+	return container_of(fence, struct sync_pt, base);
+}
+
 #ifdef CONFIG_SW_SYNC
 
 extern const struct file_operations sw_sync_debugfs_fops;
-- 
2.5.5

  parent reply	other threads:[~2016-06-20 15:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 15:53 [PATCH 0/7] de-stage SW_SYNC validation frawework Gustavo Padovan
2016-06-20 15:53 ` [PATCH 1/7] staging/android: remove doc from sw_sync Gustavo Padovan
2016-06-20 15:53 ` Gustavo Padovan [this message]
2016-08-08  9:34   ` [PATCH 2/7] staging/android: display sync_pt name on debugfs Maarten Lankhorst
2016-08-08 19:59     ` Gustavo Padovan
2016-08-09 10:04       ` Maarten Lankhorst
2016-08-09 14:45         ` Gustavo Padovan
2016-06-20 15:53 ` [PATCH 3/7] staging/android: do not let userspace trigger WARN_ON Gustavo Padovan
2016-06-20 15:53 ` [PATCH 4/7] staging/android: move trace/sync.h to sync_trace.h Gustavo Padovan
2016-06-20 15:53 ` [PATCH 5/7] staging/android: prepare sw_sync files for de-staging Gustavo Padovan
2016-06-20 16:09   ` Joe Perches
2016-06-20 16:16     ` Gustavo Padovan
2016-06-22 20:33   ` [PATCH v2] " Gustavo Padovan
2016-06-20 15:53 ` [PATCH 6/7] dma-buf/sw_sync: de-stage SW_SYNC Gustavo Padovan
2016-06-20 15:53 ` [PATCH 7/7] staging/android: remove sync framework TODO Gustavo Padovan
2016-06-22 23:46   ` Emil Velikov
2016-06-23 13:33     ` Gustavo Padovan
2016-06-26 21:45 ` [PATCH 0/7] de-stage SW_SYNC validation frawework Pavel Machek
2016-07-07 19:39 ` Gustavo Padovan
2016-07-18 19:12 ` Gustavo Padovan
2016-07-24 22:21   ` Greg Kroah-Hartman
2016-08-07 21:51     ` Pavel Machek
2016-08-08 19:08       ` Gustavo Padovan
2016-07-24 15:00         ` Pavel Machek
2016-08-08 19:53           ` Gustavo Padovan
2016-08-09  6:04           ` Daniel Vetter
2016-08-10 20:53             ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466437993-21573-3-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=John.C.Harrison@Intel.com \
    --cc=arve@android.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ghackmann@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=riandrews@android.com \
    --cc=robdclark@gmail.com \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®