From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
Rob Clark <robdclark@chromium.org>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Jonathan Corbet <corbet@lwn.net>, Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Sean Paul <sean@poorly.run>,
linux-doc@vger.kernel.org (open list:DOCUMENTATION),
linux-kernel@vger.kernel.org (open list),
linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM
ADRENO GPU),
freedreno@lists.freedesktop.org (open list:DRM DRIVER FOR MSM
ADRENO GPU)
Subject: [RFC 3/3] drm/msm: Add comm/cmdline fields
Date: Mon, 17 Apr 2023 13:12:12 -0700 [thread overview]
Message-ID: <20230417201215.448099-4-robdclark@gmail.com> (raw)
In-Reply-To: <20230417201215.448099-1-robdclark@gmail.com>
From: Rob Clark <robdclark@chromium.org>
Normally this would be the same information that can be obtained in
other ways. But in some cases the process opening the drm fd is merely
a sort of proxy for the actual process using the GPU. This is the case
for guest VM processes using the GPU via virglrenderer, in which case
the msm native-context renderer in virglrenderer overrides the comm/
cmdline to be the guest process's values.
Exposing this via fdinfo allows tools like gputop to show something more
meaningful than just a bunch of "pcivirtio-gpu" users.
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
Documentation/gpu/drm-usage-stats.rst | 8 ++++++++
drivers/gpu/drm/msm/msm_gpu.c | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst
index 8e00d53231e0..bc90bed455e3 100644
--- a/Documentation/gpu/drm-usage-stats.rst
+++ b/Documentation/gpu/drm-usage-stats.rst
@@ -148,6 +148,14 @@ percentage utilization of the engine, whereas drm-engine-<keystr> only reflects
time active without considering what frequency the engine is operating as a
percentage of it's maximum frequency.
+- drm-comm: <valstr>
+
+Returns the clients executable path.
+
+- drm-cmdline: <valstr>
+
+Returns the clients cmdline.
+
Implementation Details
======================
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index f0f4f845c32d..1150dcbf28aa 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -148,12 +148,26 @@ int msm_gpu_pm_suspend(struct msm_gpu *gpu)
return 0;
}
+static void get_comm_cmdline(struct msm_file_private *ctx, char **comm, char **cmd);
+
void msm_gpu_show_fdinfo(struct msm_gpu *gpu, struct msm_file_private *ctx,
struct drm_printer *p)
{
+ char *comm, *cmdline;
+
+ get_comm_cmdline(ctx, &comm, &cmdline);
+
drm_printf(p, "drm-engine-gpu:\t%llu ns\n", ctx->elapsed_ns);
drm_printf(p, "drm-cycles-gpu:\t%llu\n", ctx->cycles);
drm_printf(p, "drm-maxfreq-gpu:\t%u Hz\n", gpu->fast_rate);
+
+ if (comm)
+ drm_printf(p, "drm-comm:\t%s\n", comm);
+ if (cmdline)
+ drm_printf(p, "drm-cmdline:\t%s\n", cmdline);
+
+ kfree(comm);
+ kfree(cmdline);
}
int msm_gpu_hw_init(struct msm_gpu *gpu)
--
2.39.2
next prev parent reply other threads:[~2023-04-17 20:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 20:12 [RFC 0/3] drm: Add comm/cmdline fdinfo fields Rob Clark
2023-04-17 20:12 ` [RFC 1/3] drm/doc: Relax fdinfo string constraints Rob Clark
2023-04-18 8:19 ` Tvrtko Ursulin
2023-04-17 20:12 ` [RFC 2/3] drm/msm: Rework get_comm_cmdline() helper Rob Clark
2023-04-18 8:27 ` Tvrtko Ursulin
2023-04-18 8:34 ` Daniel Vetter
2023-04-18 14:31 ` Rob Clark
2023-04-21 9:33 ` Emil Velikov
2023-04-21 14:47 ` Rob Clark
2023-04-27 9:39 ` Daniel Vetter
2023-04-27 14:31 ` Rob Clark
2023-04-17 20:12 ` Rob Clark [this message]
2023-04-18 8:53 ` [RFC 3/3] drm/msm: Add comm/cmdline fields Tvrtko Ursulin
2023-04-18 14:56 ` Rob Clark
2023-04-19 13:36 ` Tvrtko Ursulin
2023-04-19 15:00 ` Rob Clark
2023-04-17 20:45 ` [RFC 0/3] drm: Add comm/cmdline fdinfo fields Rob Clark
2023-04-18 9:33 ` Konrad Dybcio
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=20230417201215.448099-4-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=airlied@gmail.com \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@chromium.org \
--cc=sean@poorly.run \
--cc=tvrtko.ursulin@linux.intel.com \
--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: 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