Skip to contentSkip to conversation

drm: trace: Introduce drm_trace() and instrument drm_atomic.c

PATCH In review Sean Paul 3 participants 14 messages Nov 7, 2019 – Nov 8, 2019

Subsystems (3)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

cover drm: trace: Introduce drm_trace() and instrument drm_atomic.c

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Sean

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH 1/6 drm: trace: Make the vblank queued/delivered events classed

From: Sean Paul <[email protected]>

We can use an event class to remove some boilerplate for the event queued/delivered trace events.

---
 drivers/gpu/drm/drm_trace.h | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_trace.h +9 -18
index 11c6dd577e8ed..487bc3478efec 100644
@@ -32,7 +32,7 @@ TRACE_EVENT(drm_vblank_event,
 			__entry->high_prec ? "true" : "false")
 );
 
-TRACE_EVENT(drm_vblank_event_queued,
+DECLARE_EVENT_CLASS(class_drm_vblank_event,
 	    TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
 	    TP_ARGS(file, crtc, seq),
 	    TP_STRUCT__entry(
@@ -45,25 +45,16 @@ TRACE_EVENT(drm_vblank_event_queued,
 		    __entry->crtc = crtc;
 		    __entry->seq = seq;
 		    ),
-	    TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc, \
+	    TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc,
 		      __entry->seq)
 );
-
-TRACE_EVENT(drm_vblank_event_delivered,
-	    TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
-	    TP_ARGS(file, crtc, seq),
-	    TP_STRUCT__entry(
-		    __field(struct drm_file *, file)
-		    __field(int, crtc)
-		    __field(unsigned int, seq)
-		    ),
-	    TP_fast_assign(
-		    __entry->file = file;
-		    __entry->crtc = crtc;
-		    __entry->seq = seq;
-		    ),
-	    TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc, \
-		      __entry->seq)
+DEFINE_EVENT(class_drm_vblank_event, drm_vblank_event_queued,
+	TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
+	TP_ARGS(file, crtc, seq)
+);
+DEFINE_EVENT(class_drm_vblank_event, drm_vblank_event_delivered,
+	TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
+	TP_ARGS(file, crtc, seq)
 );
 
 #endif /* _DRM_TRACE_H_ */
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH 2/6 drm: trace: Introduce drm_trace() and trace event classes

In reply to Sean Paul

From: Sean Paul <[email protected]>

This patch is the first step in expanding trace events in drm. It introduces a new enum used to classify trace events as well as a couple helper macros to issue trace events from around drm.

It's a bit of a toy right now since we're just converting one class (vblank) and there aren't any error events in this class. However later patches in this series will add more interesting classes.

---
 Documentation/gpu/drm-internals.rst |   9 +++
 drivers/gpu/drm/drm_trace.h         | 109 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 3 files changed, 114 insertions(+), 12 deletions(-)
Documentation/gpu/drm-internals.rst +9 -0
index 966bd2d9f0ccd..ac87a94b7057a 100644
@@ -176,6 +176,15 @@ Printer
 .. kernel-doc:: drivers/gpu/drm/drm_print.c
    :export:
 
+Tracing
+-------
+
+.. kernel-doc:: drivers/gpu/drm/drm_trace.h
+   :doc: overview
+
+.. kernel-doc:: drivers/gpu/drm/drm_trace.h
+   :internal:
+
 Utilities
 ---------
 
drivers/gpu/drm/drm_trace.h +101 -8

148 lines not on this page · raw message

drivers/gpu/drm/drm_vblank.c +4 -4
index 1659b13b178c2..19a63a94586ad 100644
@@ -880,7 +880,7 @@ static void send_vblank_event(struct drm_device *dev,
 		e->event.seq.time_ns = ktime_to_ns(now);
 		break;
 	}
-	trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
+	drm_trace(vblank, event_delivered, e->base.file_priv, e->pipe, seq);
 	drm_send_event_locked(dev, &e->base);
 }
 
@@ -1529,7 +1529,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
 	DRM_DEBUG("event on vblank count %llu, current %llu, crtc %u\n",
 		  req_seq, seq, pipe);
 
-	trace_drm_vblank_event_queued(file_priv, pipe, req_seq);
+	drm_trace(vblank, event_queued, file_priv, pipe, req_seq);
 
 	e->sequence = req_seq;
 	if (vblank_passed(seq, req_seq)) {
@@ -1760,8 +1760,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	trace_drm_vblank_event(pipe, seq, now,
-			dev->driver->get_vblank_timestamp != NULL);
+	drm_trace(vblank, event, pipe, seq, now,
+		  dev->driver->get_vblank_timestamp != NULL);
 }
 
 /**
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw

PATCH 3/6 drm: trace: Add trace events for atomic state lifetime

In reply to Sean Paul

From: Sean Paul <[email protected]>

Mirror some atomic debug messages which track a state through allocation/clear/check/commit/free

Change-Id I0387ddf4b2f1d84137a5b471e347878c04c6d0af
---
 drivers/gpu/drm/drm_atomic.c | 19 +++++---
 drivers/gpu/drm/drm_trace.h  | 84 ++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic.c +14 -5
index 14aeaf7363210..93ca64af67f55 100644
@@ -41,6 +41,7 @@
 
 #include "drm_crtc_internal.h"
 #include "drm_internal.h"
+#include "drm_trace.h"
 
 void __drm_crtc_commit_free(struct kref *kref)
 {
@@ -118,10 +119,11 @@ struct drm_atomic_state *
 drm_atomic_state_alloc(struct drm_device *dev)
 {
 	struct drm_mode_config *config = &dev->mode_config;
+	struct drm_atomic_state *state;
 
-	if (!config->funcs->atomic_state_alloc) {
-		struct drm_atomic_state *state;
-
+	if (config->funcs->atomic_state_alloc) {
+		state = config->funcs->atomic_state_alloc(dev);
+	} else {
 		state = kzalloc(sizeof(*state), GFP_KERNEL);
 		if (!state)
 			return NULL;
@@ -129,10 +131,10 @@ drm_atomic_state_alloc(struct drm_device *dev)
 			kfree(state);
 			return NULL;
 		}
-		return state;
 	}
 
-	return config->funcs->atomic_state_alloc(dev);
+	drm_trace(atomic, alloc, state);
+	return state;
 }
 EXPORT_SYMBOL(drm_atomic_state_alloc);
 
@@ -239,6 +241,7 @@ void drm_atomic_state_clear(struct drm_atomic_state *state)
 	struct drm_device *dev = state->dev;
 	struct drm_mode_config *config = &dev->mode_config;
 
+	drm_trace(atomic, clear, state);
 	if (config->funcs->atomic_state_clear)
 		config->funcs->atomic_state_clear(state);
 	else
@@ -261,6 +264,7 @@ void __drm_atomic_state_free(struct kref *ref)
 	drm_atomic_state_clear(state);
 
 	DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state);
+	drm_trace(atomic, free, state);
 
 	if (config->funcs->atomic_state_free) {
 		config->funcs->atomic_state_free(state);
@@ -1145,6 +1149,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 	int i, ret = 0;
 
 	DRM_DEBUG_ATOMIC("checking %p\n", state);
+	drm_trace(atomic, check, state);
 
 	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
 		ret = drm_atomic_plane_check(old_plane_state, new_plane_state);
@@ -1179,6 +1184,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		if (ret) {
 			DRM_DEBUG_ATOMIC("atomic driver check for %p failed: %d\n",
 					 state, ret);
+			drm_trace_err(atomic, check_failed, state);
 			return ret;
 		}
 	}
@@ -1193,6 +1199,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		}
 	}
 
+	drm_trace(atomic, check_passed, state);
 	return 0;
 }
 EXPORT_SYMBOL(drm_atomic_check_only);
@@ -1221,6 +1228,7 @@ int drm_atomic_commit(struct drm_atomic_state *state)
 		return ret;
 
 	DRM_DEBUG_ATOMIC("committing %p\n", state);
+	drm_trace(atomic, commit, state);
 
 	return config->funcs->atomic_commit(state->dev, state, false);
 }
@@ -1250,6 +1258,7 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
 		return ret;
 
 	DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
+	drm_trace(atomic, commit_nonblock, state);
 
 	return config->funcs->atomic_commit(state->dev, state, true);
 }
drivers/gpu/drm/drm_trace.h +84 -0

102 lines not on this page · raw message

Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#4 lore raw

PATCH 4/6 drm: trace: Add crtc state trace events

In reply to Sean Paul

From: Sean Paul <[email protected]>

Add tracing which tracks important crtc_state events through the atomic core.

---
 drivers/gpu/drm/drm_atomic.c |  14 +++++
 drivers/gpu/drm/drm_trace.h  | 109 +++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)
drivers/gpu/drm/drm_atomic.c +14 -0
index 93ca64af67f55..955650729115d 100644
@@ -319,6 +319,7 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
 
 	DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n",
 			 crtc->base.id, crtc->name, crtc_state, state);
+	drm_trace(crtc, add, crtc_state);
 
 	return crtc_state;
 }
@@ -340,6 +341,8 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
 	if (new_crtc_state->active && !new_crtc_state->enable) {
 		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n",
 				 crtc->base.id, crtc->name);
+		drm_trace_err(crtc, check_fail_active_not_enabled,
+			      new_crtc_state);
 		return -EINVAL;
 	}
 
@@ -350,6 +353,7 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
 	    WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) {
 		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n",
 				 crtc->base.id, crtc->name);
+		drm_trace_err(crtc, check_fail_enable_no_mode, new_crtc_state);
 		return -EINVAL;
 	}
 
@@ -357,6 +361,7 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
 	    WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) {
 		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n",
 				 crtc->base.id, crtc->name);
+		drm_trace_err(crtc, check_fail_mode_no_enable, new_crtc_state);
 		return -EINVAL;
 	}
 
@@ -374,9 +379,12 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
 	    !new_crtc_state->active && !old_crtc_state->active) {
 		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n",
 				 crtc->base.id, crtc->name);
+		drm_trace_err(crtc, check_fail_event_not_active,
+			      new_crtc_state);
 		return -EINVAL;
 	}
 
+	drm_trace(crtc, check_passed, new_crtc_state);
 	return 0;
 }
 
@@ -1057,6 +1065,8 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
 
 	DRM_DEBUG_ATOMIC("Adding all current connectors for [CRTC:%d:%s] to %p\n",
 			 crtc->base.id, crtc->name, state);
+	drm_trace(crtc, add_affected_connectors, crtc_state);
+
 
 	/*
 	 * Changed connectors are already in @state, so only need to look
@@ -1111,6 +1121,7 @@ drm_atomic_add_affected_planes(struct drm_atomic_state *state,
 
 	DRM_DEBUG_ATOMIC("Adding all current planes for [CRTC:%d:%s] to %p\n",
 			 crtc->base.id, crtc->name, state);
+	drm_trace(crtc, add_affected_planes, old_crtc_state);
 
 	drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) {
 		struct drm_plane_state *plane_state =
@@ -1165,6 +1176,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		if (ret) {
 			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
 					 crtc->base.id, crtc->name);
+			drm_trace_err(crtc, check_failed, new_crtc_state);
 			return ret;
 		}
 	}
@@ -1194,6 +1206,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 			if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
 				DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n",
 						 crtc->base.id, crtc->name);
+				drm_trace_err(crtc, check_fail_modeset_required,
+					      new_crtc_state);
 				return -EINVAL;
 			}
 		}
drivers/gpu/drm/drm_trace.h +109 -0

127 lines not on this page · raw message

Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#5 lore raw

PATCH 5/6 drm: trace: Add connector state tracing

In reply to Sean Paul

From: Sean Paul <[email protected]>

Add tracing which tracks important connector_state events through the atomic core.

---
 drivers/gpu/drm/drm_atomic.c |  12 ++++-
 drivers/gpu/drm/drm_trace.h  | 101 +++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +11 -1
index 955650729115d..5dcaf145f22ff 100644
@@ -422,12 +422,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
 	if (connector->max_bpc_property)
 		state->max_bpc = min(state->max_bpc, state->max_requested_bpc);
 
-	if ((connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) || !writeback_job)
+	if ((connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) || !writeback_job) {
+		drm_trace(connector, check_passed, state);
 		return 0;
+	}
 
 	if (writeback_job->fb && !state->crtc) {
 		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] framebuffer without CRTC\n",
 				 connector->base.id, connector->name);
+		drm_trace_err(connector, check_fail_writeback_no_crtc, state);
 		return -EINVAL;
 	}
 
@@ -439,6 +442,8 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
 		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] has framebuffer, but [CRTC:%d] is off\n",
 				 connector->base.id, connector->name,
 				 state->crtc->base.id);
+		drm_trace_err(connector, check_fail_writeback_not_active,
+			      state);
 		return -EINVAL;
 	}
 
@@ -446,6 +451,8 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
 		if (writeback_job->out_fence) {
 			DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
 					 connector->base.id, connector->name);
+			drm_trace_err(connector,
+				      check_fail_writeback_fence_no_fb, state);
 			return -EINVAL;
 		}
 
@@ -453,6 +460,7 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
 		state->writeback_job = NULL;
 	}
 
+	drm_trace(connector, check_passed, state);
 	return 0;
 }
 
@@ -996,6 +1004,7 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 	DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d:%s] %p state to %p\n",
 			 connector->base.id, connector->name,
 			 connector_state, state);
+	drm_trace(connector, add, connector_state);
 
 	if (connector_state->crtc) {
 		struct drm_crtc_state *crtc_state;
@@ -1186,6 +1195,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		if (ret) {
 			DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] atomic core check failed\n",
 					 conn->base.id, conn->name);
+			drm_trace_err(connector, check_failed, conn_state);
 			return ret;
 		}
 	}
drivers/gpu/drm/drm_trace.h +101 -0

120 lines not on this page · raw message

Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw

PATCH 6/6 drm: trace: Add plane state tracing

In reply to Sean Paul

From: Sean Paul <[email protected]>

Add tracing which tracks important plane_state events through the atomic core.

---
 drivers/gpu/drm/drm_atomic.c |  16 +++-
 drivers/gpu/drm/drm_trace.h  | 143 +++++++++++++++++++++++++++++++++++
 2 files changed, 158 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +15 -1
index 5dcaf145f22ff..f68240d1d9ecf 100644
@@ -513,6 +513,7 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 
 	DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
 			 plane->base.id, plane->name, plane_state, state);
+	drm_trace(plane, add, plane_state);
 
 	if (plane_state->crtc) {
 		struct drm_crtc_state *crtc_state;
@@ -570,22 +571,27 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 	if (crtc && !fb) {
 		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] CRTC set but no FB\n",
 				 plane->base.id, plane->name);
+		drm_trace_err(plane, check_fail_crtc_no_fb, new_plane_state);
 		return -EINVAL;
 	} else if (fb && !crtc) {
 		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] FB set but no CRTC\n",
 				 plane->base.id, plane->name);
+		drm_trace_err(plane, check_fail_fb_no_crtc, new_plane_state);
 		return -EINVAL;
 	}
 
 	/* if disabled, we don't care about the rest of the state: */
-	if (!crtc)
+	if (!crtc) {
+		drm_trace(plane, check_passed, new_plane_state);
 		return 0;
+	}
 
 	/* Check whether this plane is usable on this CRTC */
 	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
 		DRM_DEBUG_ATOMIC("Invalid [CRTC:%d:%s] for [PLANE:%d:%s]\n",
 				 crtc->base.id, crtc->name,
 				 plane->base.id, plane->name);
+		drm_trace_err(plane, check_fail_crtc_impossible, new_plane_state);
 		return -EINVAL;
 	}
 
@@ -599,6 +605,7 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 				 drm_get_format_name(fb->format->format,
 						     &format_name),
 				 fb->modifier);
+		drm_trace_err(plane, check_fail_format, new_plane_state);
 		return ret;
 	}
 
@@ -611,6 +618,7 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 				 plane->base.id, plane->name,
 				 new_plane_state->crtc_w, new_plane_state->crtc_h,
 				 new_plane_state->crtc_x, new_plane_state->crtc_y);
+		drm_trace_err(plane, check_fail_crtc_coords, new_plane_state);
 		return -ERANGE;
 	}
 
@@ -634,6 +642,7 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 				 new_plane_state->src_y >> 16,
 				 ((new_plane_state->src_y & 0xffff) * 15625) >> 10,
 				 fb->width, fb->height);
+		drm_trace_err(plane, check_fail_src_coords, new_plane_state);
 		return -ENOSPC;
 	}
 
@@ -651,6 +660,7 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] invalid damage clip %d %d %d %d\n",
 					 plane->base.id, plane->name, clips->x1,
 					 clips->y1, clips->x2, clips->y2);
+			drm_trace_err(plane, check_fail_damage_clip, new_plane_state);
 			return -EINVAL;
 		}
 		clips++;
@@ -660,9 +670,12 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
 	if (plane_switching_crtc(old_plane_state, new_plane_state)) {
 		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] switching CRTC directly\n",
 				 plane->base.id, plane->name);
+		drm_trace_err(plane, check_fail_switch_old, old_plane_state);
+		drm_trace_err(plane, check_fail_switch_new, new_plane_state);
 		return -EINVAL;
 	}
 
+	drm_trace(plane, check_passed, new_plane_state);
 	return 0;
 }
 
@@ -1176,6 +1189,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		if (ret) {
 			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n",
 					 plane->base.id, plane->name);
+			drm_trace_err(plane, check_failed, new_plane_state);
 			return ret;
 		}
 	}
drivers/gpu/drm/drm_trace.h +143 -0

161 lines not on this page · raw message

Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
In reply to Sean Paul
Quoted 16 lines · On Thu, 7 Nov 2019 16:02:59 -0500 Sean Paul <[email protected]> wrote:

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

Quoted 3 lines

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Hi Sean,

thanks for working on this. I'm not at all familiar with the trace infrastructure, so I'd like to know how flight recorder type of behaviour (a continuously written fixed size ring buffer) can be achieved. Let us have a display server in userspace which in production hits an unexpected condition with DRM and needs to record information for post-mortem debugging. What should it do to have a trace log after the fact to attach with a bug report?

I assume that is a major use case for this new feature. Is performance profiling another use case?

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Thanks,
pq

Quoted 11 lines

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

Quoted 6 lines
 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 25 lines · Pekka Paalanen
Quoted 16 lines · On Thu, 7 Nov 2019 16:02:59 -0500 Sean Paul <[email protected]> wrote:

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

Quoted 3 lines

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Hi Sean,

Quoted 7 lines

thanks for working on this. I'm not at all familiar with the trace infrastructure, so I'd like to know how flight recorder type of behaviour (a continuously written fixed size ring buffer) can be achieved. Let us have a display server in userspace which in production hits an unexpected condition with DRM and needs to record information for post-mortem debugging. What should it do to have a trace log after the fact to attach with a bug report?

Yeah I think this has the uapi smell, so would need the userspace side too, once we agree on something.

Quoted 5 lines

I assume that is a major use case for this new feature. Is performance profiling another use case?

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Yeah I'm kinda freaked out about this. In the old thread we discussed the question of whether dumping dmesg into tracepoints would make them uapi, but no conclusion was reached.

Now instead we're going to duplicate a lot of these debug outputs, with specific trace events, which is going to make them even more uapi. And a lot of these are very much implementation details (drivers might change their opinion on which other states they need for check/commit, e.g. if they move a bunch of global state from crtcs into a new driver private internal object). Explicit tracepoints with symbol value imo will have a much higher chance that someone starts relying on them.

Also, dmesg is uapi too. Except there's a gentlemen's agreement that you should depend upon it because it will make kernel engineers really pissed if they can't change/move a specific string. So from that point I think just dumping the existing debug strings as unstructured strings into trace buffers is a much better idea. Plus no need to have the same information duplicated in both a debug output and a tracepoint.

I think even slightly structured debug tracepoints (e.g. a simple (drm_object_id, string) pair) would be too structured since then userspace could start watching for events on specific things and maybe use that for their retry loops after TEST_ONLY failures. Even though we have a lot of debug output strings where that bit of structure is essentially there already.

Aside from this a question on process ... I re-read the old thread and I'm not sure how you concluded we've reached consensus on this here, seemed all pretty inconclusive on the details and discussions died out? -Daniel

Quoted 24 lines

Thanks,
pq

Quoted 17 lines

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw
Quoted 69 lines · Daniel Vetter
Quoted 25 lines · Pekka Paalanen
Quoted 16 lines · On Thu, 7 Nov 2019 16:02:59 -0500 Sean Paul <[email protected]> wrote:

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

Quoted 3 lines

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Hi Sean,

Quoted 7 lines

thanks for working on this. I'm not at all familiar with the trace infrastructure, so I'd like to know how flight recorder type of behaviour (a continuously written fixed size ring buffer) can be achieved. Let us have a display server in userspace which in production hits an unexpected condition with DRM and needs to record information for post-mortem debugging. What should it do to have a trace log after the fact to attach with a bug report?

Yeah I think this has the uapi smell, so would need the userspace side too, once we agree on something.

Quoted 5 lines

I assume that is a major use case for this new feature. Is performance profiling another use case?

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Yeah I'm kinda freaked out about this. In the old thread we discussed the question of whether dumping dmesg into tracepoints would make them uapi, but no conclusion was reached.

Now instead we're going to duplicate a lot of these debug outputs, with specific trace events, which is going to make them even more uapi. And a lot of these are very much implementation details (drivers might change their opinion on which other states they need for check/commit, e.g. if they move a bunch of global state from crtcs into a new driver private internal object). Explicit tracepoints with symbol value imo will have a much higher chance that someone starts relying on them.

Also, dmesg is uapi too. Except there's a gentlemen's agreement that you should depend upon it because it will make kernel engineers really pissed if they can't change/move a specific string. So from that point I think just dumping the existing debug strings as unstructured strings into trace buffers is a much better idea. Plus no need to have the same information duplicated in both a debug output and a tracepoint.

I think even slightly structured debug tracepoints (e.g. a simple (drm_object_id, string) pair) would be too structured since then userspace could start watching for events on specific things and maybe use that for their retry loops after TEST_ONLY failures. Even though we have a lot of debug output strings where that bit of structure is essentially there already.

Quoted 3 lines

Aside from this a question on process ... I re-read the old thread and I'm not sure how you concluded we've reached consensus on this here, seemed all pretty inconclusive on the details and discussions died out?

Reading the thread again I guess it was Joonas comment that tracepoints are also uapi, and you concluded we can't do this at all.

The trouble is, _everything_ that's observeable from userspace is uapi. So dmesg, timing of the code, ... For a real funky example of this look at the ext4 regression, where better code resulted in less entropy generated and the system hung at boot-up.

But on the flip side, it's only uapi we can't change if someone depends upon it. For dmesg most people understand that parsing dmesg is bad taste, so generally not a big problem. For tracepoints, especially if they come with lots of structured uapi, it's a lot more "this is baked in forever". But it doesn't have to be, with changed them quite a few times. But as a rule of thumb, the more structured the data is you present to userspace, the more likely they'll use it in actual control flow, and the more likely a change will break userspace in a meaningful way.

Hence for debugging I think least amount of structure is best, plus huge warnings that you really shouldn't use this for anything else than debug logs. Anything more that leaks all these implementation details gives me the chillies. And Pekka's question right off the bat with "can I use this for tuning timers" kinda proves my point. If it loosk like intentional uapi userspace will treat it like intentional uapi. -Daniel

Quoted 34 lines

-Daniel

Quoted 24 lines

Thanks,
pq

Quoted 17 lines

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#10 lore raw
Quoted 35 lines · Daniel Vetter
Quoted 34 lines · Daniel Vetter
Quoted 32 lines · Pekka Paalanen
Quoted 16 lines · On Thu, 7 Nov 2019 16:02:59 -0500 Sean Paul <[email protected]> wrote:

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

Quoted 3 lines

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Hi Sean,

thanks for working on this. I'm not at all familiar with the trace infrastructure, so I'd like to know how flight recorder type of behaviour (a continuously written fixed size ring buffer) can be achieved. Let us have a display server in userspace which in production hits an unexpected condition with DRM and needs to record information for post-mortem debugging. What should it do to have a trace log after the fact to attach with a bug report?

Quoted 3 lines
Quoted 3 lines

Yeah I think this has the uapi smell, so would need the userspace side too, once we agree on something.

For our (Chrome OS) use, the uapi is pretty simple:

#! /usr/bin/env

mask=$1

pushd /sys/kernel/tracing
echo "event_class & $mask" > events/drm/filter
echo 1 > events/drm/enable
echo 1 > tracing_on
popd

Then when we need to log something:

cat /sys/kernel/tracing/trace_pipe

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I assume that is a major use case for this new feature. Is performance profiling another use case?

Not at the present.

Quoted 51 lines
Quoted 30 lines
Quoted 3 lines

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Yeah I'm kinda freaked out about this. In the old thread we discussed the question of whether dumping dmesg into tracepoints would make them uapi, but no conclusion was reached.

Now instead we're going to duplicate a lot of these debug outputs, with specific trace events, which is going to make them even more uapi. And a lot of these are very much implementation details (drivers might change their opinion on which other states they need for check/commit, e.g. if they move a bunch of global state from crtcs into a new driver private internal object). Explicit tracepoints with symbol value imo will have a much higher chance that someone starts relying on them.

Also, dmesg is uapi too. Except there's a gentlemen's agreement that you should depend upon it because it will make kernel engineers really pissed if they can't change/move a specific string. So from that point I think just dumping the existing debug strings as unstructured strings into trace buffers is a much better idea. Plus no need to have the same information duplicated in both a debug output and a tracepoint.

I think even slightly structured debug tracepoints (e.g. a simple (drm_object_id, string) pair) would be too structured since then userspace could start watching for events on specific things and maybe use that for their retry loops after TEST_ONLY failures. Even though we have a lot of debug output strings where that bit of structure is essentially there already.

Quoted 3 lines

Aside from this a question on process ... I re-read the old thread and I'm not sure how you concluded we've reached consensus on this here, seemed all pretty inconclusive on the details and discussions died out?

Reading the thread again I guess it was Joonas comment that tracepoints are also uapi, and you concluded we can't do this at all.

The trouble is, _everything_ that's observeable from userspace is uapi. So dmesg, timing of the code, ... For a real funky example of this look at the ext4 regression, where better code resulted in less entropy generated and the system hung at boot-up.

But on the flip side, it's only uapi we can't change if someone depends upon it. For dmesg most people understand that parsing dmesg is bad taste, so generally not a big problem. For tracepoints, especially if they come with lots of structured uapi, it's a lot more "this is baked in forever". But it doesn't have to be, with changed them quite a few times. But as a rule of thumb, the more structured the data is you present to userspace, the more likely they'll use it in actual control flow, and the more likely a change will break userspace in a meaningful way.

Quoted 6 lines

Hence for debugging I think least amount of structure is best, plus huge warnings that you really shouldn't use this for anything else than debug logs. Anything more that leaks all these implementation details gives me the chillies. And Pekka's question right off the bat with "can I use this for tuning timers" kinda proves my point. If it loosk like intentional uapi userspace will treat it like intentional uapi.

So the more useful the data, the less desirable it is to surface :-)

Playing devil's advocate for a second (and probably exposing my naivity), would it be _so_ bad if userspace inspected the traces for check failure cause? If we remove a check in the core, the trace event just never fires (no u/s breakage), if we change a check, we introduce a new trace event to reflect reality and the old event goes quiet.

We could accrue some debt if a state variable changes since we'd have to keep the structure of the trace event and tack on the end. To combat this we could scrutinize the information exposed for each state and make sure that we're choosing stable values (in the extreme we could limit the info to only property-backed values). Additionally, we can always expose new trace events if things change too dramatically and lean on the event classes/filtering for versioning.

Sean

Quoted 42 lines

-Daniel

Quoted 34 lines

-Daniel

Quoted 24 lines

Thanks,
pq

Quoted 17 lines

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw
Quoted 123 lines · Sean Paul
Quoted 35 lines · Daniel Vetter
Quoted 34 lines · Daniel Vetter
Quoted 32 lines · Pekka Paalanen
Quoted 16 lines · On Thu, 7 Nov 2019 16:02:59 -0500 Sean Paul <[email protected]> wrote:

From: Sean Paul <[email protected]>

Hey all,
I'm back with another trace events patchset. My first attempt [1] went better than expected, with enthusiasm for the idea and distain for the implementation.

As promised, I went through and added proper trace events.

Before I get _too_ far, I wanted to post this set to get feedback on the direction I'm going. I've gone back and forth on whether to introduce a bunch of trace systems vs using the trace class enum. I've settled on the trace class enum since it seems more extensible and easier to use in production that just having the blunt "enable this system", or the tedious "enable each event I'm interested in individually" methods.

Quoted 3 lines

So, consider this one an RFC unless we're all in agreement, in which case we should apply it :)

Hi Sean,

thanks for working on this. I'm not at all familiar with the trace infrastructure, so I'd like to know how flight recorder type of behaviour (a continuously written fixed size ring buffer) can be achieved. Let us have a display server in userspace which in production hits an unexpected condition with DRM and needs to record information for post-mortem debugging. What should it do to have a trace log after the fact to attach with a bug report?

Quoted 3 lines
Quoted 3 lines

Yeah I think this has the uapi smell, so would need the userspace side too, once we agree on something.

For our (Chrome OS) use, the uapi is pretty simple:

#! /usr/bin/env

mask=$1

pushd /sys/kernel/tracing
echo "event_class & $mask" > events/drm/filter
echo 1 > events/drm/enable
echo 1 > tracing_on
popd

Then when we need to log something:

cat /sys/kernel/tracing/trace_pipe

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I assume that is a major use case for this new feature. Is performance profiling another use case?

Not at the present.

Quoted 51 lines
Quoted 30 lines
Quoted 3 lines

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Yeah I'm kinda freaked out about this. In the old thread we discussed the question of whether dumping dmesg into tracepoints would make them uapi, but no conclusion was reached.

Now instead we're going to duplicate a lot of these debug outputs, with specific trace events, which is going to make them even more uapi. And a lot of these are very much implementation details (drivers might change their opinion on which other states they need for check/commit, e.g. if they move a bunch of global state from crtcs into a new driver private internal object). Explicit tracepoints with symbol value imo will have a much higher chance that someone starts relying on them.

Also, dmesg is uapi too. Except there's a gentlemen's agreement that you should depend upon it because it will make kernel engineers really pissed if they can't change/move a specific string. So from that point I think just dumping the existing debug strings as unstructured strings into trace buffers is a much better idea. Plus no need to have the same information duplicated in both a debug output and a tracepoint.

I think even slightly structured debug tracepoints (e.g. a simple (drm_object_id, string) pair) would be too structured since then userspace could start watching for events on specific things and maybe use that for their retry loops after TEST_ONLY failures. Even though we have a lot of debug output strings where that bit of structure is essentially there already.

Quoted 3 lines

Aside from this a question on process ... I re-read the old thread and I'm not sure how you concluded we've reached consensus on this here, seemed all pretty inconclusive on the details and discussions died out?

Reading the thread again I guess it was Joonas comment that tracepoints are also uapi, and you concluded we can't do this at all.

The trouble is, _everything_ that's observeable from userspace is uapi. So dmesg, timing of the code, ... For a real funky example of this look at the ext4 regression, where better code resulted in less entropy generated and the system hung at boot-up.

But on the flip side, it's only uapi we can't change if someone depends upon it. For dmesg most people understand that parsing dmesg is bad taste, so generally not a big problem. For tracepoints, especially if they come with lots of structured uapi, it's a lot more "this is baked in forever". But it doesn't have to be, with changed them quite a few times. But as a rule of thumb, the more structured the data is you present to userspace, the more likely they'll use it in actual control flow, and the more likely a change will break userspace in a meaningful way.

Quoted 6 lines

Hence for debugging I think least amount of structure is best, plus huge warnings that you really shouldn't use this for anything else than debug logs. Anything more that leaks all these implementation details gives me the chillies. And Pekka's question right off the bat with "can I use this for tuning timers" kinda proves my point. If it loosk like intentional uapi userspace will treat it like intentional uapi.

Quoted 7 lines

So the more useful the data, the less desirable it is to surface :-)

Playing devil's advocate for a second (and probably exposing my naivity), would it be _so_ bad if userspace inspected the traces for check failure cause? If we remove a check in the core, the trace event just never fires (no u/s breakage), if we change a check, we introduce a new trace event to reflect reality and the old event goes quiet.

At that point you've broken userspace if you're unlucky. Scenario.

1. userspace does a TEST_ONLY
2. it fails, but userspace sees the magic trace event, and does a Magic Fallback (tm)
3. everyone is happy

2a. it still fails, but now the exact tracepoint is gone, or move sufficiently that userspace doesn't spot it anymore.
3. userspace falls back to something dumb, maybe single fullscreen untiled plane, resulting in a slide show
4. user is seriously pissed at the slideshow
5. one grumpy kernel maintainer gets to apply a few reverts

So yeah if we create a few nicely structured tracepoints "for debugging" and compositor people spot then and go all "oh cool, I can use this", we're screwed.

Quoted 7 lines

We could accrue some debt if a state variable changes since we'd have to keep the structure of the trace event and tack on the end. To combat this we could scrutinize the information exposed for each state and make sure that we're choosing stable values (in the extreme we could limit the info to only property-backed values). Additionally, we can always expose new trace events if things change too dramatically and lean on the event classes/filtering for versioning.

You can't just expose new trace events, if userspace relies on the old ones they have to keep working. Some subsystems are sufficiently paranoid about that that the answer is "no tracepoint, sry". Which then results in people doing dynamic tracing, which ofc is even worse from a "will it break?" pov.

It's all a tradeoff, and at least personally I figured the debug dump without any structure at all seemed like the least risky. Most reasonable people already agree that enabling debugging and parsing dmesg is not a good idea. Hopefully they'll have the same feeling about unstructured debug crap dumped into tracepoints.

The only part that _will_ become uapi for that is the exact name of the tracepoint, since userspace will need to know that one to be able to enable it.
-Daniel

Quoted 49 lines

Sean

Quoted 42 lines

-Daniel

Quoted 34 lines

-Daniel

Quoted 24 lines

Thanks,
pq

Quoted 17 lines

[1]- https://patchwork.freedesktop.org/patch/335350/

Sean Paul (6):
drm: trace: Make the vblank queued/delivered events classed
drm: trace: Introduce drm_trace() and trace event classes
drm: trace: Add trace events for atomic state lifetime
drm: trace: Add crtc state trace events
drm: trace: Add connector state tracing
drm: trace: Add plane state tracing

 Documentation/gpu/drm-internals.rst |   9 +
 drivers/gpu/drm/drm_atomic.c        |  61 ++-
 drivers/gpu/drm/drm_trace.h         | 563 ++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c        |   8 +-
 4 files changed, 609 insertions(+), 32 deletions(-)
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw
In reply to Pekka Paalanen
Quoted 2 lines · Pekka Paalanen

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Aside discussion on this: If we add this (I think userspace might want some information about the point of no return and why we missed it) then I think we should expose that with an improved drm_event and clear semantics.

If we start to encourage compositors to use tracepoints to figure out why the kernel doesn't behave (TEST_ONLY failure, or missed flip target), and use that for behaviour, we've baked implementation details into the uapi. And then we're screwed.

So if you have any need for timing information that you see solved with a tracepoint, pls bring this up so we can add proper uapi. And yes I know that if someone doesn't we still need to keep that tracepoint working, but with all things uapi the question isn't whether we'll screw up (we will), but how often. And less often is massively better :-)
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw
Quoted 14 lines · On Fri, 8 Nov 2019 09:50:30 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Pekka Paalanen

Is it ok to build userspace to rely on these trace events during normal operations, e.g. for continuous adjustment of timings/timers?

Aside discussion on this: If we add this (I think userspace might want some information about the point of no return and why we missed it) then I think we should expose that with an improved drm_event and clear semantics.

If we start to encourage compositors to use tracepoints to figure out why the kernel doesn't behave (TEST_ONLY failure, or missed flip target), and use that for behaviour, we've baked implementation details into the uapi. And then we're screwed.

Quoted 5 lines

So if you have any need for timing information that you see solved with a tracepoint, pls bring this up so we can add proper uapi. And yes I know that if someone doesn't we still need to keep that tracepoint working, but with all things uapi the question isn't whether we'll screw up (we will), but how often. And less often is massively better :-)

Haha, sorry, that particular question was practically trolling, but OTOH something I can well imagine someone doing. Trying to fish out reasons for TEST_ONLY failing is a much better example.

On third hand, profiling tools probably would depend on some trace points specifically.

As for the uapi for a DRM flight recorder, I'd be happy to have that in Weston as my time permits. Alas, it needs two people and I can be only
one: either the reviewer or the author. :-)

I can see two ways to use a DRM flight recorder:
- a file you grab as a whole after the fact, or
- a stream you subscribe to and store the results in your own ring buffer

The former is simpler, the latter would allow interleaving DRM and app notes as they happen rather than trying to rebuild a log from timestamps afterwards.

Thanks,
pq

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel