From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9570C4332F for ; Mon, 13 Nov 2023 17:04:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3700010E3CE; Mon, 13 Nov 2023 17:04:29 +0000 (UTC) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0807210E3CE for ; Mon, 13 Nov 2023 17:04:27 +0000 (UTC) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso689197666b.1 for ; Mon, 13 Nov 2023 09:04:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699895065; x=1700499865; darn=lists.freedesktop.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zJsbUoh16G9SmdzYCkBZG3ak7oJNsZTLFRqgDM/pl7c=; b=U/6k+A4eX9gOniQaY2iRajvnDzPK+oAzsnuxtwSIGdiXE06UVvsx/fUnRnVxhYRIEl /FpLPcxarOlusniZMD9eCQDj5vZkup6LzahlapQYYpfKJmWpFy15iCjKDs0UY6sTmN0s vNkrEI4uxDVWxlfzdYUvUpaMlytesZ6JRu/uE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699895065; x=1700499865; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zJsbUoh16G9SmdzYCkBZG3ak7oJNsZTLFRqgDM/pl7c=; b=aqRRetSvkA7pOYh2AkCsREpIcmrPGlpA+ykLfEmtyVEbt/9jeTEEwZ2raBYCY/uL+D PrZAx57K7Zpg0rAg+/BArrQ36yhrBvaLCVha+i83pzVbCaYkAIOr4G49ylS5MgcDTS7c RDKz+0csrP8Vj3gOwRzycTMtWuDY29nMOmPpwro+FZpii8YuHvqFB+sIk9Z6t0KygKYv fQZAySmc6vxY3ZRnHHv18CNcp4N7fplg4Yx9A5lmuGbBjaiqMItmSxuLGbVpXNmfcYGr yrVR2xWRjnjy9E5m2B2C6G3vGRV7FqWT4luNqIQU+W0n2IRpFmEArl3Kw+KdVUhRtxBz nwJg== X-Gm-Message-State: AOJu0Yz40/oPkwWEF8J/PFr5zqOrzdMxKnHmNKGgIVFNgXXu/Z75oRUx OhpLKegRN+gf0Q8l+hyV4NVa7nt6ClkaVStIQI1qAw== X-Google-Smtp-Source: AGHT+IEQ82d/2CUhBNsNx/zNVphgzDfzDDY4PZbed7RkZ63KAxF9WkSgHgcBBrmqwM/Gd/Ofl5rvmA== X-Received: by 2002:a17:906:cb95:b0:9bf:30e8:5bf9 with SMTP id mf21-20020a170906cb9500b009bf30e85bf9mr5730635ejb.4.1699895064876; Mon, 13 Nov 2023 09:04:24 -0800 (PST) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com. [209.85.208.45]) by smtp.gmail.com with ESMTPSA id y26-20020a170906471a00b009dd8debf9d8sm4287024ejq.157.2023.11.13.09.04.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Nov 2023 09:04:24 -0800 (PST) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-54744e66d27so11273a12.0 for ; Mon, 13 Nov 2023 09:04:24 -0800 (PST) X-Received: by 2002:aa7:d503:0:b0:544:e37e:d597 with SMTP id y3-20020aa7d503000000b00544e37ed597mr162244edq.7.1699895064416; Mon, 13 Nov 2023 09:04:24 -0800 (PST) MIME-Version: 1.0 References: <20231018181727.772-1-gurchetansingh@chromium.org> <20231018181727.772-2-gurchetansingh@chromium.org> <9b2f45e1-ea49-97ae-e359-3f9c0996394f@collabora.com> In-Reply-To: <9b2f45e1-ea49-97ae-e359-3f9c0996394f@collabora.com> From: Gurchetan Singh Date: Mon, 13 Nov 2023 09:04:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 2/2] drm/uapi: add explicit virtgpu context debug name To: Dmitry Osipenko Content-Type: multipart/alternative; boundary="00000000000078fb0a060a0ba9a8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: josh.simonot@gmail.com, kraxel@redhat.com, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --00000000000078fb0a060a0ba9a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 11, 2023 at 2:37=E2=80=AFPM Dmitry Osipenko < dmitry.osipenko@collabora.com> wrote: > On 10/18/23 21:17, Gurchetan Singh wrote: > > + case VIRTGPU_CONTEXT_PARAM_DEBUG_NAME: > > + if (vfpriv->explicit_debug_name) { > > + ret =3D -EINVAL; > > + goto out_unlock; > > + } > > + > > + ret =3D strncpy_from_user(vfpriv->debug_name, > > + u64_to_user_ptr(value), > > + DEBUG_NAME_MAX_LEN - 1); > > + > > + if (ret < 0) { > > + ret =3D -EFAULT; > > + goto out_unlock; > > + } > > + > > + vfpriv->explicit_debug_name =3D true; > > + break; > > Spotted a problem here. The ret needs to be set to zero on success. I'll > send the fix shortly. Gurchetan you should've been getting the > DRM_IOCTL_VIRTGPU_CONTEXT_INIT failure from gfxstream when you tested > this patch, haven't you? > To accommodate older kernels/QEMU, gfxstream doesn't fail if CONTEXT_INIT fails. So the guest thought it failed and didn't react, but the value was propagated to the host. > > Also noticed that the patch title says "drm/uapi" instead of > "drm/virtio". My bad for not noticing it earlier. Please be more careful > next time too :) > > -- > Best regards, > Dmitry > > --00000000000078fb0a060a0ba9a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Nov 11, 2023 at 2:37=E2=80=AF= PM Dmitry Osipenko <dmi= try.osipenko@collabora.com> wrote:
On 10/18/23 21:17, Gurchetan Singh wrote:
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case VIRTGPU_CONTEXT_= PARAM_DEBUG_NAME:
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (vfpriv->explicit_debug_name) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D -EINVAL;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out_unlock;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0ret =3D strncpy_from_user(vfpriv->debug_name,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0u64_to_user_ptr(value),
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0DEBUG_NAME_MAX_LEN - 1);
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (ret < 0) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D -EFAULT;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out_unlock;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0vfpriv->explicit_debug_name =3D true;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0break;

Spotted a problem here. The ret needs to be set to zero on success. I'l= l
send the fix shortly. Gurchetan you should've been getting the
DRM_IOCTL_VIRTGPU_CONTEXT_INIT failure from gfxstream when you tested
this patch, haven't you?

To accommo= date older kernels/QEMU, gfxstream doesn't fail if CONTEXT_INIT fails.= =C2=A0 So the guest thought it failed and didn't react, but the value w= as propagated to the host.
=C2=A0

Also noticed that the patch title says "drm/uapi" instead of
"drm/virtio". My bad for not noticing it earlier. Please be more = careful
next time too :)

--
Best regards,
Dmitry

--00000000000078fb0a060a0ba9a8--