From: Sean Paul <sean@poorly.run> To: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <sean@poorly.run>, dri-devel@lists.freedesktop.org, Jonathan Corbet <corbet@lwn.net>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel.vetter@ffwll.ch>, linux-doc@vger.kernel.org, Sean Paul <seanpaul@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Zimmermann <tzimmermann@suse.de> Subject: Re: [PATCH v4] drm/trace: Buffer DRM logs in a ringbuffer accessible via debugfs Date: Wed, 15 Jan 2020 13:29:43 -0500 [thread overview] Message-ID: <20200115182943.GE25564@art_vandelay> (raw) In-Reply-To: <157910989392.14122.11828997592074603326@skylake-alporthouse-com> On Wed, Jan 15, 2020 at 05:38:13PM +0000, Chris Wilson wrote: > Quoting Sean Paul (2020-01-15 14:21:18) > > 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@chromium.org> > > > > > > > > > > > > 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? > > The seq_file doesn't marry with the anticipated uAPI, I'll probably need > a raw file_ops (thinking along the lines of return an fd to userspace, > that is read ala /dev/kmsg). Agree, that should have been struct file_operations *drm_trace_buffer_file_ops(struct drm_trace_buffer *buf); or something like that.. > > I would be tempted to drop the drm_ and put it straight in lib/ I think if we wanted to share this more broadly, we'd probably look at adding it in kernel/trace/ and enabling subsystems to add their own traces to tracefs. Sean > -Chris -- Sean Paul, Software Engineer, Google / Chromium OS
WARNING: multiple messages have this Message-ID (diff)
From: Sean Paul <sean@poorly.run> To: Chris Wilson <chris@chris-wilson.co.uk> Cc: linux-doc@vger.kernel.org, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel.vetter@ffwll.ch>, Jonathan Corbet <corbet@lwn.net>, dri-devel@lists.freedesktop.org, Sean Paul <seanpaul@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Zimmermann <tzimmermann@suse.de>, Sean Paul <sean@poorly.run> Subject: Re: [PATCH v4] drm/trace: Buffer DRM logs in a ringbuffer accessible via debugfs Date: Wed, 15 Jan 2020 13:29:43 -0500 [thread overview] Message-ID: <20200115182943.GE25564@art_vandelay> (raw) In-Reply-To: <157910989392.14122.11828997592074603326@skylake-alporthouse-com> On Wed, Jan 15, 2020 at 05:38:13PM +0000, Chris Wilson wrote: > Quoting Sean Paul (2020-01-15 14:21:18) > > 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@chromium.org> > > > > > > > > > > > > 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? > > The seq_file doesn't marry with the anticipated uAPI, I'll probably need > a raw file_ops (thinking along the lines of return an fd to userspace, > that is read ala /dev/kmsg). Agree, that should have been struct file_operations *drm_trace_buffer_file_ops(struct drm_trace_buffer *buf); or something like that.. > > I would be tempted to drop the drm_ and put it straight in lib/ I think if we wanted to share this more broadly, we'd probably look at adding it in kernel/trace/ and enabling subsystems to add their own traces to tracefs. Sean > -Chris -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-01-15 18:29 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-14 17:21 [PATCH v4] drm/trace: Buffer DRM logs in a ringbuffer accessible via debugfs Sean Paul 2020-01-14 17:21 ` Sean Paul 2020-01-14 17:30 ` Steven Rostedt 2020-01-14 17:30 ` Steven Rostedt 2020-01-15 9:25 ` Joonas Lahtinen 2020-01-15 10:14 ` Pekka Paalanen 2020-01-15 10:14 ` Pekka Paalanen 2020-01-15 13:31 ` Sean Paul 2020-01-15 13:31 ` Sean Paul 2020-01-15 10:28 ` Jani Nikula 2020-01-15 10:28 ` Jani Nikula 2020-01-15 13:34 ` Sean Paul 2020-01-15 13:34 ` Sean Paul 2020-01-15 10:36 ` Chris Wilson 2020-01-15 10:36 ` Chris Wilson 2020-01-15 13:41 ` Sean Paul 2020-01-15 13:41 ` Sean Paul 2020-01-15 14:01 ` Chris Wilson 2020-01-15 14:01 ` Chris Wilson 2020-01-15 14:21 ` Sean Paul 2020-01-15 14:21 ` Sean Paul 2020-01-15 17:38 ` Chris Wilson 2020-01-15 17:38 ` Chris Wilson 2020-01-15 18:29 ` Sean Paul [this message] 2020-01-15 18:29 ` Sean Paul 2020-01-16 6:27 ` Daniel Vetter 2020-01-16 6:27 ` Daniel Vetter 2020-01-20 18:56 ` Steven Rostedt 2020-01-20 18:56 ` Steven Rostedt 2020-01-22 8:06 ` Daniel Vetter 2020-01-22 8:06 ` Daniel Vetter 2020-01-22 15:39 ` Sean Paul 2020-01-22 15:39 ` Sean Paul 2020-01-27 8:58 ` Daniel Vetter 2020-01-27 8:58 ` Daniel Vetter
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=20200115182943.GE25564@art_vandelay \ --to=sean@poorly.run \ --cc=airlied@linux.ie \ --cc=chris@chris-wilson.co.uk \ --cc=corbet@lwn.net \ --cc=daniel.vetter@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-doc@vger.kernel.org \ --cc=rostedt@goodmis.org \ --cc=seanpaul@chromium.org \ --cc=tzimmermann@suse.de \ /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: linkBe 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.