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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41B81C636D3 for ; Wed, 1 Feb 2023 13:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbjBAN22 (ORCPT ); Wed, 1 Feb 2023 08:28:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbjBAN20 (ORCPT ); Wed, 1 Feb 2023 08:28:26 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9BA3E098 for ; Wed, 1 Feb 2023 05:28:24 -0800 (PST) Received: from [192.168.2.186] (109-252-117-89.nat.spd-mgts.ru [109.252.117.89]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id A78B56602EC6; Wed, 1 Feb 2023 13:28:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1675258102; bh=6c2RKTiReCGr7vzW6sHVvwtiojFqrg5A+45PxhcJOc4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YkgtvGRK8uTcE47F4QIAprCHvJul4yImNt4IwGc+foJi5iSEDzHB7M/Xd2F+RPw+i 2bHazY3j8uGjFQbIL3RBVHfBiXCsl9EO5k56lhDz2E8Qr9mXyN4ufYGi5aVF9qj7wk 56S2jLJxGCp4pifjrBhOTVmpr4/BAj7nsp9tDkX+pSuaSAbLwnbKtN9aWhyd2XSQWl dA7d09XJkadPX9U+IZsZwobp2DqmYb8PuxiQZBMhwp3LnI/fbOKogJ59njJcnLDHuh 3itcz/91xHM1P627OTM49rEjW0MS4LH5ooFtHwFPZ9rP1mybZ1DVfFUqBIltH8gM65 9bG0/sAtI9jag== Message-ID: Date: Wed, 1 Feb 2023 16:28:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] drm/virtio: exbuf->fence_fd unmodified on interrupted wait Content-Language: en-US To: Ryan Neph , David Airlie , Gerd Hoffmann , Daniel Vetter , Gurchetan Singh , Chia-I Wu , dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: Rob Clark , Yiwei Zhang , Gustavo Padovan , Emil Velikov References: <20230126225815.1518839-1-ryanneph@chromium.org> From: Dmitry Osipenko In-Reply-To: <20230126225815.1518839-1-ryanneph@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/27/23 01:58, Ryan Neph wrote: > An interrupted dma_fence_wait() becomes an -ERESTARTSYS returned > to userspace ioctl(DRM_IOCTL_VIRTGPU_EXECBUFFER) calls, prompting to > retry the ioctl(), but the passed exbuf->fence_fd has been reset to -1, > making the retry attempt fail at sync_file_get_fence(). > > The uapi for DRM_IOCTL_VIRTGPU_EXECBUFFER is changed to retain the > passed value for exbuf->fence_fd when returning ERESTARTSYS or EINTR. > > Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization") > Signed-off-by: Ryan Neph > --- > > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 9 ++++++--- > include/uapi/drm/virtgpu_drm.h | 3 +++ > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > index 9f4a90493aea..ffce4e2a409a 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > @@ -132,6 +132,8 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > uint64_t fence_ctx; > uint32_t ring_idx; > > + exbuf->fence_fd = -1; > + > fence_ctx = vgdev->fence_drv.context; > ring_idx = 0; > > @@ -152,8 +154,6 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > ring_idx = exbuf->ring_idx; > } > > - exbuf->fence_fd = -1; Is there any userspace relying on this -1 behaviour? Wouldn't be better to remove this offending assignment? -- Best regards, Dmitry