All of lore.kernel.org
 help / color / mirror / Atom feed
From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Cc: devel@driverdev.osuosl.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Maarten Lankhorst" <maarten.lankhorst@canonical.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: [RFC 1/9] staging/android/sync: Support sync points created from dma-fences
Date: Wed, 13 Jan 2016 17:57:27 +0000	[thread overview]
Message-ID: <1452707855-9791-2-git-send-email-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <1452707855-9791-1-git-send-email-John.C.Harrison@Intel.com>

From: Maarten Lankhorst <maarten.lankhorst@canonical.com>

Debug output assumes all sync points are built on top of Android sync
points and when we start creating them from dma-fences will NULL ptr deref
unless taught about this.

v0.4: Corrected patch ownership.

v0.5: Removed redundant braces to keep style checker happy

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: devel@driverdev.osuosl.org
Cc: Riley Andrews <riandrews@android.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/staging/android/sync_debug.c | 45 ++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index 91ed2c4..02a1649 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -82,36 +82,42 @@ static const char *sync_status_str(int status)
 	return "error";
 }
 
-static void sync_print_pt(struct seq_file *s, struct sync_pt *pt, bool fence)
+static void sync_print_pt(struct seq_file *s, struct fence *pt, bool fence)
 {
 	int status = 1;
-	struct sync_timeline *parent = sync_pt_parent(pt);
 
-	if (fence_is_signaled_locked(&pt->base))
-		status = pt->base.status;
+	if (fence_is_signaled_locked(pt))
+		status = pt->status;
 
 	seq_printf(s, "  %s%spt %s",
-		   fence ? parent->name : "",
+		   fence && pt->ops->get_timeline_name ?
+		   pt->ops->get_timeline_name(pt) : "",
 		   fence ? "_" : "",
 		   sync_status_str(status));
 
 	if (status <= 0) {
 		struct timespec64 ts64 =
-			ktime_to_timespec64(pt->base.timestamp);
+			ktime_to_timespec64(pt->timestamp);
 
 		seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec);
 	}
 
-	if (parent->ops->timeline_value_str &&
-	    parent->ops->pt_value_str) {
+	if ((!fence || pt->ops->timeline_value_str) &&
+	    pt->ops->fence_value_str) {
 		char value[64];
+		bool success;
 
-		parent->ops->pt_value_str(pt, value, sizeof(value));
-		seq_printf(s, ": %s", value);
-		if (fence) {
-			parent->ops->timeline_value_str(parent, value,
-						    sizeof(value));
-			seq_printf(s, " / %s", value);
+		pt->ops->fence_value_str(pt, value, sizeof(value));
+		success = strlen(value);
+
+		if (success)
+			seq_printf(s, ": %s", value);
+
+		if (success && fence) {
+			pt->ops->timeline_value_str(pt, value, sizeof(value));
+
+			if (strlen(value))
+				seq_printf(s, " / %s", value);
 		}
 	}
 
@@ -138,7 +144,7 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
 	list_for_each(pos, &obj->child_list_head) {
 		struct sync_pt *pt =
 			container_of(pos, struct sync_pt, child_list);
-		sync_print_pt(s, pt, false);
+		sync_print_pt(s, &pt->base, false);
 	}
 	spin_unlock_irqrestore(&obj->child_list_lock, flags);
 }
@@ -152,13 +158,8 @@ static void sync_print_fence(struct seq_file *s, struct sync_fence *fence)
 	seq_printf(s, "[%p] %s: %s\n", fence, fence->name,
 		   sync_status_str(atomic_read(&fence->status)));
 
-	for (i = 0; i < fence->num_fences; ++i) {
-		struct sync_pt *pt =
-			container_of(fence->cbs[i].sync_pt,
-				     struct sync_pt, base);
-
-		sync_print_pt(s, pt, true);
-	}
+	for (i = 0; i < fence->num_fences; ++i)
+		sync_print_pt(s, fence->cbs[i].sync_pt, true);
 
 	spin_lock_irqsave(&fence->wq.lock, flags);
 	list_for_each_entry(pos, &fence->wq.task_list, task_list) {
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-01-13 17:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 17:57 [RFC 0/9] Add native sync support to i915 driver John.C.Harrison
2016-01-13 17:57 ` John.C.Harrison [this message]
2016-01-13 17:57 ` [RFC 2/9] staging/android/sync: add sync_fence_create_dma John.C.Harrison
2016-01-13 19:03   ` Gustavo Padovan
2016-01-13 17:57 ` [RFC 3/9] staging/android/sync: Move sync framework out of staging John.C.Harrison
2016-01-13 19:00   ` Gustavo Padovan
2016-01-14 11:31     ` John Harrison
2016-01-14 13:42       ` Gustavo Padovan
2016-01-14 14:19         ` John Harrison
2016-01-13 19:51   ` Gustavo Padovan
2016-01-14  4:55   ` Greg Kroah-Hartman
2016-01-13 17:57 ` [RFC 4/9] android/sync: Improved debug dump to dmesg John.C.Harrison
2016-01-13 17:57 ` [RFC 5/9] android/sync: Fix reversed sense of signaled fence John.C.Harrison
2016-01-13 17:57 ` [RFC 6/9] drm/i915: Add sync framework support to execbuff IOCTL John.C.Harrison
2016-01-13 18:43   ` Chris Wilson
2016-01-14 11:47     ` John Harrison
2016-01-14 12:07       ` Chris Wilson
2016-01-21 14:47         ` Maarten Lankhorst
2016-01-21 15:07           ` Chris Wilson
2016-01-13 17:57 ` [RFC 7/9] drm/i915: Add sync wait support to scheduler John.C.Harrison
2016-01-13 17:57 ` [RFC 8/9] drm/i915: Connecting execbuff fences " John.C.Harrison
2016-01-13 17:57 ` [RFC 9/9] drm/i915: Add sync support to the scheduler statistics and status dump John.C.Harrison
2016-01-19 16:04 ` [RFC] igt/gem_exec_fence: New test for sync/fence interface John.C.Harrison
  -- strict thread matches above, loose matches on Subject: below --
2015-07-17 14:31 [RFC 0/9] Convert requests to use struct fence John.C.Harrison
2015-07-17 14:31 ` [RFC 1/9] staging/android/sync: Support sync points created from dma-fences John.C.Harrison
2015-07-17 14:44   ` Tvrtko Ursulin

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=1452707855-9791-2-git-send-email-John.C.Harrison@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=maarten.lankhorst@canonical.com \
    --cc=riandrews@android.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.