On Wed, Jan 15, 2020 at 02:01:19PM +0000, Chris Wilson wrote: > Quoting Sean Paul (2020-01-15 13:41:58) > > On Wed, Jan 15, 2020 at 10:36:36AM +0000, Chris Wilson wrote: > > > Quoting Sean Paul (2020-01-14 17:21:43) > > > > From: Sean Paul <seanpaul@xxxxxxxxxxxx> > > > > > > > > This patch uses a ring_buffer to keep a "flight recorder" (name credit Weston) > > > > of DRM logs for a specified set of debug categories. The user writes a > > > > bitmask of debug categories to the "trace_mask" node and can read log > > > > messages from the "trace" node. > > > > > > > > These nodes currently exist in debugfs under the dri directory. I > > > > intended on exposing all of this through tracefs originally, but the > > > > tracefs entry points are not exposed, so there's no way to create > > > > tracefs files from drivers at the moment. I think it would be a > > > > worthwhile endeavour, but one requiring more time and conversation to > > > > ensure the drm traces fit somewhere sensible. > > > > > > Fwiw, I have a need for client orientated debug message store, with > > > the primary purpose of figuring out -EINVAL. We need per-client so we can > > > put sensitive information about the potentially buggy client behaviour, > > > and of course it needs to be accessible by the non-privileged client. > > > > > > On the execution side, it's easy to keep track of the client so we could > > > trace execution flow per client, within reason. And we could do > > > similarly for kms clients. > > > > Could you build such a thing with drm_trace underpinning it, just put the > > pertinent information in the message? > > Not as is. The global has to go, and there's no use for debugfs. So we > are just left with a sprintf() around a ring_buffer. I am left in the > same position as just wanting to generalise tracek to take the ringbuffer > as a parameter. > Ah, I think I see what you're getting at now. I think it would be reasonable to split out a drm_trace_buffer from the current code for this purpose. We could have an interface like: struct drm_trace_buffer *drm_trace_buffer_init(unsigned int num_pages); int drm_trace_buffer_resize(struct drm_trace_buffer *buf, unsigned int num_pages); int drm_trace_buffer_printf(struct drm_trace_buffer *buf, const char *format, ...); int drm_trace_buffer_output(struct seq_file *seq); void drm_trace_buffer_cleanup(struct drm_trace_buffer *buf); Then to Joonas' point, we could have drm_trace_log which uses this interface to mirror the logs with a debugfs interface. Would that work for your purpose? > > > Just chiming to say, I don't think a duplicate of dmesg hidden inside > > > debugfs achieves much. But a generic tracek-esque ringbuf would be very > > > useful -- even if only so we can separate our GEM_TRACE from the global > > > tracek. > > > > I think that's essentially what we've got, I've just narrowly focused on > > surfacing debug logs. If drm_trace_printf were exported, replacing > > GEM_TRACE would be as simple as s/trace_printk/drm_trace_printf/. Initially I > > thought exporting it to drivers would be a bad idea, but I'm open to changing my > > mind on this as long as drivers are using it responsibly. > > I definitely can't make the mistake of flooding kms tracing with > overwhelming execution traces -- we can't go back to mixing kms traces > with execution traces. Yeah, I assumed this wouldn't be enabled during normal operation, just for debugging (as it is used now). Sean > -Chris -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel