Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796207358; b=l595TNmpnzpGw4Sm3PTgRG8yUchCDHpNtDjMlAkhi6sSIyEgVdYS5jHv+PuC76rbmpyp eZqrpCjrqgA+z3HdKAaqJ6tg3Cp71JzAfosuk+3C3ULjCA5j9TppSiSNXRzQiQ7nb+mAI DVOJUJOBYCJcBYVbYVlJLBG3yaHjta7eM1MrLjWZCWYZKrIdFfXiY/XvT3gXPY8Tcc/XZ 5vlUl0ssRVWtYgRA3kIKKhlqu5z8p3sd+pjzZZFL7Jfr6s0pTpkfWEEQ2LHyBrpcnQz9M W22Ix2WZOUMAaaTZKskJsbU6T3olOJOWsseQptcM3avFLpkXofv2gMleKNwkETYxUVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796207358; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=JevainWcomTflpYCQvsYgk1Hc7fP+74AVU3CqCod9+s=; b=Uu+oCwrHlw2yuYYmeRtMMo7I6fJEh2dEWcc1tROZeTBuaqbn1jy0kR5Zjif1NDAeSoP4 GUrd1LIC0ar1h1YhDbdFNPOqFDrBK4IoTZSoGc58+PlkPjpbbIFldaxHL0as3Un6M+x+7 xy94Au9l6IL5r1cXd1zFmMwwzmYW1itTkKz3rgZk2Inq83mGC+YPYk9SpybtabtNCBjwj 7fbgYr1NWHrYu3EghpaoCs6GJli4kr94prFj5uAu+qk60tAsHmepLZ3Z9M/qczXhIgAH5 TuUZeaZn4OPj4yIXmGhxIGN3doRcLWXfO2lGJQ51T/cGEIfPVZDdoEHdjzTyv9dsHlA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lCQVTcZi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4377F606A32D for ; Wed, 2 Dec 2026 10:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lCQVTcZi Received: by smtp.kernel.org (Postfix) with ESMTPSA id B787A1F0089C; Wed, 2 Dec 2026 10:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796207357; bh=JevainWcomTflpYCQvsYgk1Hc7fP+74AVU3CqCod9+s=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=lCQVTcZiqMlJPOjGwlEqIXrQivfKQ85UP7d5XFZZKvWhjSpSSDQsNS8C/kSVzPISz ma3T9XcjvHKtWFxPqQv+9HsUuthH5vgQqAAivv08FD4Bms51XIInlCZ3V1DLhVtdgK VAyenUWfbv9gMQqd1x5UZdi4QpbelFpL0DjDeRsOpK+/Tja2e4iopyP7dD81s7PYDz yU4mcjnYTMDkIp2uySopbB3ZruUiWCj4wDd7QZhXJIDm4TNAr5MyGNHoQEXMKzPzMQ dJfqmw/izNtyO/0PvwEaQZ8un9C/By6C30o2Ii2mdQCmU6OmvQzXBUwuEv2YaCY8me S9LsPXu8PLiQg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 3/4] drm/virtio: implement userptr resource support Reply-To: sashiko-reviews@lists.linux.dev To: "Honglei Huang" Cc: dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202101658.1209083-4-honghuan@amd.com> References: <20261202101658.1209083-1-honghuan@amd.com> <20261202101658.1209083-4-honghuan@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 10:29:17 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/virtio: duplicated virtio_gpu_userptr_free() and dead userptr struct fields -- commit b8bdb9c42be0c294b8ab707b39984b6a80ab6db5 Author: Honglei Huang drm/virtio: implement userptr resource support This commit introduces virtio_gpu_object_userptr to pin userspace memory pages and create blob resources backed by them, including hibernation restore support. > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virti= o/virtgpu_drv.h > index f3bbbe4468bf1..635122c68a29c 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h [ ... ] > @@ -140,12 +141,42 @@ struct virtio_gpu_object_vram { > struct drm_mm_node vram_node; > }; > =20 > +struct virtio_gpu_object_userptr; > + > +struct virtio_gpu_object_userptr_ops { > + int (*get_pages)(struct virtio_gpu_object_userptr *userptr); > + void (*put_pages)(struct virtio_gpu_object_userptr *userptr); > +}; > + > +struct virtio_gpu_object_userptr { > + struct virtio_gpu_object base; > + const struct virtio_gpu_object_userptr_ops *ops; > + /* Protects @pages, @sgt and @dma_mapped. */ > + struct mutex lock; > + > + uint64_t start; > + uint32_t npages; > + uint32_t bo_handle; > + uint32_t flags; > + > + struct virtio_gpu_device *vgdev; > + struct drm_file *file; > + struct page **pages; > + struct sg_table *sgt; > + bool dma_mapped; > + enum dma_data_direction dma_dir; > + struct mm_struct *mm; > +}; [ ... ] > diff --git a/drivers/gpu/drm/virtio/virtgpu_userptr.c b/drivers/gpu/drm/v= irtio/virtgpu_userptr.c > new file mode 100644 > index 0000000000000..eddf29bad0094 > --- /dev/null > +++ b/drivers/gpu/drm/virtio/virtgpu_userptr.c > @@ -0,0 +1,352 @@ [ ... ] > +static void virtio_gpu_userptr_free(struct drm_gem_object *obj) > +{ > + struct virtio_gpu_object *bo =3D gem_to_virtio_gpu_obj(obj); > + struct virtio_gpu_device *vgdev =3D obj->dev->dev_private; > + > + /* > + * Pages stay pinned until RESOURCE_UNREF finishes. Its callback > + * calls virtio_gpu_cleanup_object to drop them. > + */ > + if (bo->created) { > + virtio_gpu_remove_from_restore_list(bo); > + virtio_gpu_cmd_unref_resource(vgdev, bo, false); > + virtio_gpu_notify(vgdev); > + return; > + } > + > + virtio_gpu_cleanup_object(bo); > +} [Severity: Low] This isn't a bug, but virtio_gpu_userptr_free() is identical to virtio_gpu_free_object() in drivers/gpu/drm/virtio/virtgpu_object.c, which could be exported and reused instead. Also, in struct virtio_gpu_object_userptr, bo_handle is never used, file is assigned in virtio_gpu_userptr_init() (storing an unreferenced drm_file pointer on an object that can outlive the file descriptor across asynchronous RESOURCE_UNREF completion) and never read, and virtio_gpu_object_userptr_ops has only a single implementation so virtio_gpu_userptr_get_pages() and virtio_gpu_userptr_put_pages() can be called directly. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202101658.1209= 083-1-honghuan@amd.com?part=3D3