Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp802206imd; Thu, 1 Nov 2018 05:57:42 -0700 (PDT) X-Google-Smtp-Source: AJdET5efUzwIr7W3GGTgMwGd27FtVpbnwIXXgvdwRzFXPk1V9RBqVmbZCEbo2TZOaBn39zGmABg0 X-Received: by 2002:a62:7e93:: with SMTP id z141-v6mr7820138pfc.241.1541077061980; Thu, 01 Nov 2018 05:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541077061; cv=none; d=google.com; s=arc-20160816; b=VCCmBrtVOYQy1aTONvx05Cza92ynptYhGffZO0LgLCMh/kCbiTKU5ENsRGOCOCD4Qw HWVizNTQn8sA3vQ3HC162715MInePWNykVIUrGstJ/02z05vsTXO0eWHSXtAZfES8DZ3 0NfKHrlbBVJK3R9pwmZ/5nH+DuPhtNdEKUxLn5Q8dmTF6tJHSfUK3bksyYgvIxim3YKR y4PjTkb3vqojOs99XAxP/pMNqFBxSi7bfZ4K0x9yvNWr6Fc4ycabu1bNO3IjZJD7wa0/ aa5+IJKrAcT9apu/tamVVxvI4VzqwQGSsu2P7h0yk1LZqEcMIx3ZaziGJoKe2q+lN8Fg OWDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wwC9guWWXkgSc6UAj0fmfJBuPcRStHnBLcCPuvVeEb0=; b=Es9C7OYGrTBDLlfwUilXXnXDPXRGA3zjMClC/nQgGz+UGMI4flWxTQVOF6TSI5adec XWIFhMX/koW2/r4cROzx9zr2pzYLbewaQ2kwYfuUg14b5sTWrbEgz8XPAUosYjY1ZCyd o0BjQIUTSo3vGPR77S8IJ7WcSprSvD0Wpk2wtwnjxkmkvuEHfSamteu5RCE1n0zL6S+0 iuJLcR1LYM6hnbQfDzOD0vSDS4JiQHgfPPE7BxAryG4SC/zMSxhAYAWijPfQLQknjTQv ydGxWw4b/OEeL5KCJvninbPi668ak6cuwQ7NqTT36K+Anbu4xQARPZkOndc5mUEZwCGR 8/Hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i128-v6si32017013pfb.256.2018.11.01.05.57.23; Thu, 01 Nov 2018 05:57:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbeKAV7c (ORCPT + 99 others); Thu, 1 Nov 2018 17:59:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:56730 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727966AbeKAV7c (ORCPT ); Thu, 1 Nov 2018 17:59:32 -0400 Received: from [IPv6:2a02:8109:92c0:207d:3d24:60ad:a75d:194d] (unknown [IPv6:2a02:8109:92c0:207d:3d24:60ad:a75d:194d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: robertfoss) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id E61A526398E; Thu, 1 Nov 2018 12:56:38 +0000 (GMT) Subject: Re: [PATCH 2/5] drm/virtio: add uapi for in and out explicit fences To: Emil Velikov Cc: David Airlie , Gerd Hoffmann , ML dri-devel , "open list:VIRTIO GPU DRIVER" , "Linux-Kernel@Vger. Kernel. Org" , Rob Herring , Gustavo Padovan , Emil Velikov References: <20181025183739.9375-1-robert.foss@collabora.com> <20181025183739.9375-3-robert.foss@collabora.com> From: Robert Foss Message-ID: <3a8a03d6-a544-b9f3-15a2-f6a2411bdb28@collabora.com> Date: Thu, 1 Nov 2018 13:56:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-10-31 10:38, Emil Velikov wrote: > Hi Rob, > > On Thu, 25 Oct 2018 at 19:38, Robert Foss wrote: >> >> Add a new field called fence_fd that will be used by userspace to send >> in-fences to the kernel and receive out-fences created by the kernel. >> >> This uapi enables virtio to take advantage of explicit synchronization of >> dma-bufs. >> >> There are two new flags: >> >> * VIRTGPU_EXECBUF_FENCE_FD_IN to be used when passing an in-fence fd. >> * VIRTGPU_EXECBUF_FENCE_FD_OUT to be used when requesting an out-fence fd >> >> The execbuffer IOCTL is now read-write to allow the userspace to read the >> out-fence. >> >> On error -1 should be returned in the fence_fd field. >> >> Signed-off-by: Gustavo Padovan >> Signed-off-by: Robert Foss >> --- >> Changes since v2: >> - Since exbuf-flags is a new flag, check that unsupported >> flags aren't set. >> >> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++ >> include/uapi/drm/virtgpu_drm.h | 13 ++++++++++--- >> 2 files changed, 15 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c >> index d01a9ed100d1..1af289b28fc4 100644 >> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c >> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c >> @@ -116,9 +116,14 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, >> struct ww_acquire_ctx ticket; >> void *buf; >> >> + exbuf->fence_fd = -1; >> + > Move this after the sanity checking. Agreed. Fixed in v4 > >> if (vgdev->has_virgl_3d == false) >> return -ENOSYS; >> >> + if ((exbuf->flags & ~VIRTGPU_EXECBUF_FLAGS)) >> + return -EINVAL; >> + > I assume this did this trigger when using old userspace? No, not as far as I'm aware. This check is there to prevent userspace from polluting the bitspace of flag, so that all free bits can be used for new flags. As far as I understand this is pointed out by a drm driver development document written by danvet, which I unfortunately can't seem to find the link for at the moment. > > With those the patch is > Reviewed-by: Emil Velikov > > Thanks > Emil >