From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: "Steven Price" <steven.price@arm.com>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v6 5/5] drm/panthor: add sysfs knob for enabling job profiling
Date: Fri, 13 Sep 2024 16:15:57 +0200 [thread overview]
Message-ID: <20240913161557.6fee852c@collabora.com> (raw)
In-Reply-To: <20240913124857.389630-6-adrian.larumbe@collabora.com>
On Fri, 13 Sep 2024 13:42:13 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> This commit introduces a DRM device sysfs attribute that lets UM control
> the job accounting status in the device. The knob variable had been brought
> in as part of a previous commit, but now we're able to fix it manually.
>
> As sysfs files are part of a driver's uAPI, describe its legitimate input
> values and output format in a documentation file.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> .../testing/sysfs-driver-panthor-profiling | 10 ++++
> Documentation/gpu/panthor.rst | 46 +++++++++++++++++++
> drivers/gpu/drm/panthor/panthor_drv.c | 39 ++++++++++++++++
> 3 files changed, 95 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-driver-panthor-profiling
> create mode 100644 Documentation/gpu/panthor.rst
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-panthor-profiling b/Documentation/ABI/testing/sysfs-driver-panthor-profiling
> new file mode 100644
> index 000000000000..af05fccedc15
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-panthor-profiling
> @@ -0,0 +1,10 @@
> +What: /sys/bus/platform/drivers/panthor/.../profiling
> +Date: September 2024
> +KernelVersion: 6.11.0
> +Contact: Adrian Larumbe <adrian.larumbe@collabora.com>
> +Description:
> + Bitmask to enable drm fdinfo's job profiling measurements.
> + Valid values are:
> + 0: Don't enable fdinfo job profiling sources.
> + 1: Enable GPU cycle measurements for running jobs.
> + 2: Enable GPU timestamp sampling for running jobs.
> diff --git a/Documentation/gpu/panthor.rst b/Documentation/gpu/panthor.rst
> new file mode 100644
> index 000000000000..cbf5c4429a2d
> --- /dev/null
> +++ b/Documentation/gpu/panthor.rst
> @@ -0,0 +1,46 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +
> +=========================
> + drm/Panthor CSF driver
> +=========================
> +
> +.. _panfrost-usage-stats:
> +
> +Panthor DRM client usage stats implementation
> +==============================================
> +
> +The drm/Panthor driver implements the DRM client usage stats specification as
> +documented in :ref:`drm-client-usage-stats`.
> +
> +Example of the output showing the implemented key value pairs and entirety of
> +the currently possible format options:
> +
> +::
> + pos: 0
> + flags: 02400002
> + mnt_id: 29
> + ino: 491
> + drm-driver: panthor
> + drm-client-id: 10
> + drm-engine-panthor: 111110952750 ns
> + drm-cycles-panthor: 94439687187
> + drm-maxfreq-panthor: 1000000000 Hz
> + drm-curfreq-panthor: 1000000000 Hz
> + drm-total-memory: 16480 KiB
> + drm-shared-memory: 0
> + drm-active-memory: 16200 KiB
> + drm-resident-memory: 16480 KiB
> + drm-purgeable-memory: 0
> +
> +Possible `drm-engine-` key names are: `panthor`.
> +`drm-curfreq-` values convey the current operating frequency for that engine.
> +
> +Users must bear in mind that engine and cycle sampling are disabled by default,
> +because of power saving concerns. `fdinfo` users and benchmark applications which
> +query the fdinfo file must make sure to toggle the job profiling status of the
> +driver by writing into the appropriate sysfs node::
> +
> + echo <N> > /sys/bus/platform/drivers/panthor/[a-f0-9]*.gpu/profiling
> +
> +Where `N` is a bit mask where cycle and timestamp sampling are respectively
> +enabled by the first and second bits.
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 233b265c0819..6f47d9d1d86a 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1513,6 +1513,44 @@ static void panthor_remove(struct platform_device *pdev)
> panthor_device_unplug(ptdev);
> }
>
> +static ssize_t profiling_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct panthor_device *ptdev = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d\n", ptdev->profile_mask);
> +}
> +
> +static ssize_t profiling_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t len)
> +{
> + struct panthor_device *ptdev = dev_get_drvdata(dev);
> + u32 value;
> + int err;
> +
> + err = kstrtou32(buf, 0, &value);
> + if (err)
> + return err;
> +
> + if ((value & ~PANTHOR_DEVICE_PROFILING_ALL) != 0)
> + return -EINVAL;
> +
> + ptdev->profile_mask = value;
> +
> + return len;
> +}
> +
> +static DEVICE_ATTR_RW(profiling);
> +
> +static struct attribute *panthor_attrs[] = {
> + &dev_attr_profiling.attr,
> + NULL,
> +};
> +
> +ATTRIBUTE_GROUPS(panthor);
> +
> static const struct of_device_id dt_match[] = {
> { .compatible = "rockchip,rk3588-mali" },
> { .compatible = "arm,mali-valhall-csf" },
> @@ -1532,6 +1570,7 @@ static struct platform_driver panthor_driver = {
> .name = "panthor",
> .pm = pm_ptr(&panthor_pm_ops),
> .of_match_table = dt_match,
> + .dev_groups = panthor_groups,
> },
> };
>
prev parent reply other threads:[~2024-09-13 14:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 12:42 [PATCH v6 0/5] Support fdinfo runtime and memory stats on Panthor Adrián Larumbe
2024-09-13 12:42 ` [PATCH v6 1/5] drm/panthor: introduce job cycle and timestamp accounting Adrián Larumbe
2024-09-13 21:53 ` kernel test robot
2024-09-15 15:22 ` kernel test robot
2024-09-15 16:43 ` kernel test robot
2024-09-16 11:15 ` Steven Price
2024-09-20 22:36 ` Adrián Larumbe
2024-09-23 8:55 ` Steven Price
2024-09-23 20:43 ` Adrián Larumbe
2024-09-25 9:56 ` Steven Price
2024-09-27 14:53 ` Adrián Larumbe
2024-09-30 11:28 ` Steven Price
2024-09-13 12:42 ` [PATCH v6 2/5] drm/panthor: record current and maximum device clock frequencies Adrián Larumbe
2024-09-13 14:14 ` Boris Brezillon
2024-09-16 11:19 ` Steven Price
2024-09-13 12:42 ` [PATCH v6 3/5] drm/panthor: add DRM fdinfo support Adrián Larumbe
2024-09-13 14:15 ` Boris Brezillon
2024-09-13 12:42 ` [PATCH v6 4/5] drm/panthor: enable fdinfo for memory stats Adrián Larumbe
2024-09-13 12:42 ` [PATCH v6 5/5] drm/panthor: add sysfs knob for enabling job profiling Adrián Larumbe
2024-09-13 14:15 ` Boris Brezillon [this message]
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=20240913161557.6fee852c@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.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: 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