From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Gurchetan Singh <gurchetansingh@chromium.org>,
dri-devel@lists.freedesktop.org, kraxel@redhat.com
Cc: josh.simonot@gmail.com
Subject: Re: [PATCH v3 2/2] drm/uapi: add explicit virtgpu context debug name
Date: Sat, 11 Nov 2023 21:40:22 +0300 [thread overview]
Message-ID: <77316c81-df8b-19f0-04a1-feca42f3943f@collabora.com> (raw)
In-Reply-To: <20231018181727.772-2-gurchetansingh@chromium.org>
On 10/18/23 21:17, Gurchetan Singh wrote:
> There are two problems with the current method of determining the
> virtio-gpu debug name.
>
> 1) TASK_COMM_LEN is defined to be 16 bytes only, and this is a
> Linux kernel idiom (see PR_SET_NAME + PR_GET_NAME). Though,
> Android/FreeBSD get around this via setprogname(..)/getprogname(..)
> in libc.
>
> On Android, names longer than 16 bytes are common. For example,
> one often encounters a program like "com.android.systemui".
>
> The virtio-gpu spec allows the debug name to be up to 64 bytes, so
> ideally userspace should be able to set debug names up to 64 bytes.
>
> 2) The current implementation determines the debug name using whatever
> task initiated virtgpu. This is could be a "RenderThread" of a
> larger program, when we actually want to propagate the debug name
> of the program.
>
> To fix these issues, add a new CONTEXT_INIT param that allows userspace
> to set the debug name when creating a context.
>
> It takes a null-terminated C-string as the param value. The length of the
> string (excluding the terminator) **should** be <= 64 bytes. Otherwise,
> the debug_name will be truncated to 64 bytes.
>
> Link to open-source userspace:
> https://android-review.googlesource.com/c/platform/hardware/google/gfxstream/+/2787176
>
> Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Reviewed-by: Josh Simonot <josh.simonot@gmail.com>
> ---
> Fixes suggested by Dmitry Osipenko
> v2:
> - Squash implementation and UAPI change into one commit
> - Avoid unnecessary casts
> - Use bool when necessary
> v3:
> - Use DEBUG_NAME_MAX_LEN - 1 when copying string
>
> drivers/gpu/drm/virtio/virtgpu_drv.h | 5 ++++
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 39 ++++++++++++++++++++++----
> include/uapi/drm/virtgpu_drm.h | 2 ++
> 3 files changed, 40 insertions(+), 6 deletions(-)
...
> + ret = strncpy_from_user(vfpriv->debug_name,
> + u64_to_user_ptr(value),
> + DEBUG_NAME_MAX_LEN - 1);
> +
> + if (ret < 0) {
> + ret = -EFAULT;
> + goto out_unlock;
> + }
The strncpy_from_user() itself returns -EFAULT. I changed code to return
the "ret" directly and applied to misc-next.
Gerd, let us know if have any objections to this patch.
--
Best regards,
Dmitry
next prev parent reply other threads:[~2023-11-11 18:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 18:17 [PATCH v3 1/2] drm/virtio: use uint64_t more in virtio_gpu_context_init_ioctl Gurchetan Singh
2023-10-18 18:17 ` [PATCH v3 2/2] drm/uapi: add explicit virtgpu context debug name Gurchetan Singh
2023-10-18 22:59 ` Dmitry Osipenko
2023-10-22 23:50 ` Dmitry Osipenko
2023-10-31 15:55 ` Gurchetan Singh
2023-11-10 17:26 ` Gurchetan Singh
2023-11-11 18:40 ` Dmitry Osipenko [this message]
2023-11-11 22:37 ` Dmitry Osipenko
2023-11-13 17:04 ` Gurchetan Singh
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=77316c81-df8b-19f0-04a1-feca42f3943f@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=josh.simonot@gmail.com \
--cc=kraxel@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).