Re: [PATCH v6 0/3] Add sync object UAPI support to VirtIO-GPU driver

2023-06-27 Thread Rob Clark
context fence sharing working (with the > wait pushed down to the host), that's something the current UAPI can't do > - Work iteratively (i.e, it's fine to merge Mesa/virglrenderer MRs as > "experimental") and in steps, no need to figure everything out at once > > N

Re: [PATCH v6 0/3] Add sync object UAPI support to VirtIO-GPU driver

2023-05-08 Thread Rob Clark
On Wed, May 3, 2023 at 10:07 AM Gurchetan Singh wrote: > > > > On Mon, May 1, 2023 at 8:38 AM Dmitry Osipenko > wrote: >> >> On 4/16/23 14:52, Dmitry Osipenko wrote: >> > We have multiple Vulkan context types that are awaiting for the addition >> > of the sync object DRM UAPI support to the Virt

Re: [PATCH v3 2/2] drm/virtio: Support sync objects

2023-03-23 Thread Rob Clark
On Thu, Mar 23, 2023 at 12:05 PM Dmitry Osipenko wrote: > > Add sync object DRM UAPI support to VirtIO-GPU driver. It's required > for enabling a full-featured Vulkan fencing by Venus and native context > VirtIO-GPU Mesa drivers. > > Signed-off-by: Dmitry Osipenko > --- > drivers/gpu/drm/virtio/

Re: [PATCH v3 1/2] drm/virtio: Refactor job submission code path

2023-03-23 Thread Rob Clark
On Thu, Mar 23, 2023 at 12:05 PM Dmitry Osipenko wrote: > > Move virtio_gpu_execbuffer_ioctl() into separate virtgpu_submit.c file > and refactor the code along the way to ease addition of new features to > the ioctl. > > Signed-off-by: Dmitry Osipenko Reviewed-by: Rob Clark

Re: [PATCH v2 1/2] drm/virtio: Refactor job submission code path

2023-03-22 Thread Rob Clark
On Sun, Mar 19, 2023 at 9:11 AM Dmitry Osipenko wrote: > > Move virtio_gpu_execbuffer_ioctl() into separate virtgpu_submit.c file > and refactor the code along the way to ease addition of new features to > the ioctl. > > Signed-off-by: Dmitry Osipenko > --- > drivers/gpu/drm/virtio/Makefile

[PATCH v6] drm/virtio: Add option to disable KMS support

2023-03-02 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. As the modesetting ioctls are a big surface area for

Re: [PATCH v5] drm/virtio: Add option to disable KMS support

2023-03-02 Thread Rob Clark
On Wed, Mar 1, 2023 at 11:25 PM Gerd Hoffmann wrote: > > On Thu, Mar 02, 2023 at 12:39:33AM +0300, Dmitry Osipenko wrote: > > On 3/1/23 21:54, Rob Clark wrote: > > > /* virtgpu_display.c */ > > > +#if defined(CONFIG_DRM_VIRTIO_GPU_KMS) > > > int virtio_gp

[PATCH v5] drm/virtio: Add option to disable KMS support

2023-03-01 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. As the modesetting ioctls are a big surface area for

[PATCH v4] drm/virtio: Add option to disable KMS support

2023-02-28 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. As the modesetting ioctls are a big surface area for

Re: [PATCH v3] drm/virtio: Add option to disable KMS support

2023-02-28 Thread Rob Clark
On Tue, Feb 28, 2023 at 4:34 AM Thomas Zimmermann wrote: > > Hi > > Am 27.02.23 um 19:15 schrieb Rob Clark: > > On Mon, Feb 27, 2023 at 9:57 AM Dmitry Osipenko > > wrote: > >> > >> On 2/27/23 20:38, Rob Clark wrote: > >> ... &

Re: [PATCH v3] drm/virtio: Add option to disable KMS support

2023-02-27 Thread Rob Clark
On Mon, Feb 27, 2023 at 9:57 AM Dmitry Osipenko wrote: > > On 2/27/23 20:38, Rob Clark wrote: > ... > > + if (IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS)) { > > + /* get display info */ > > + virtio_cread_le(vgdev->

[PATCH v3] drm/virtio: Add option to disable KMS support

2023-02-27 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. v2: Use more if (IS_ENABLED(...)) v3: Also permit the host

Re: [PATCH v2] drm/virtio: Add option to disable KMS support

2023-02-27 Thread Rob Clark
On Mon, Feb 27, 2023 at 8:16 AM Daniel Vetter wrote: > > On Mon, Feb 27, 2023 at 08:01:13AM -0800, Rob Clark wrote: > > From: Rob Clark > > > > Add a build option to disable modesetting support. This is useful in > > cases where the guest only needs to use

[PATCH v2] drm/virtio: Add option to disable KMS support

2023-02-27 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. v2: Use more if (IS_ENABLED(...)) Signed-off-by: Rob Clark

Re: [PATCH] drm/virtio: Add option to disable KMS support

2023-02-27 Thread Rob Clark
On Sun, Feb 26, 2023 at 10:38 PM Gerd Hoffmann wrote: > > On Fri, Feb 24, 2023 at 10:02:24AM -0800, Rob Clark wrote: > > From: Rob Clark > > > > Add a build option to disable modesetting support. This is useful in > > cases where the guest only needs to use

[PATCH] drm/virtio: Add option to disable KMS support

2023-02-24 Thread Rob Clark
From: Rob Clark Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. Signed-off-by: Rob Clark --- drivers/gpu/drm/virtio

Re: [PATCH] drm/virtio: exbuf->fence_fd unmodified on interrupted wait

2023-01-27 Thread Rob Clark
synchronization") > Signed-off-by: Ryan Neph Reviewed-by: Rob Clark > --- > > 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/v

Re: [PATCH] drm/virtio: Fix GEM handle creation UAF

2023-01-09 Thread Rob Clark
On Mon, Jan 9, 2023 at 3:28 PM Dmitry Osipenko wrote: > > On 12/17/22 02:33, Rob Clark wrote: > > From: Rob Clark > > > > Userspace can guess the handle value and try to race GEM object creation > > with handle close, resulting in a use-after-free if we dereference

[PATCH] drm/virtio: Fix GEM handle creation UAF

2022-12-16 Thread Rob Clark
From: Rob Clark Userspace can guess the handle value and try to race GEM object creation with handle close, resulting in a use-after-free if we dereference the object after dropping the handle's reference. For that reason, dropping the handle's reference must be done *after* w

[PATCH v2] drm/virtio: Spiff out cmd queue/response traces

2022-11-29 Thread Rob Clark
From: Rob Clark Add a sequence # for more easily matching up cmd/resp, and the # of free slots in the virtqueue to more easily see starvation issues. v2: Fix handling of string fields as well Signed-off-by: Rob Clark Reviewed-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH] drm/virtio: Spiff out cmd queue/response traces

2022-11-29 Thread Rob Clark
From: Rob Clark Add a sequence # for more easily matching up cmd/resp, and the # of free slots in the virtqueue to more easily see starvation issues. Signed-off-by: Rob Clark --- drivers/gpu/drm/virtio/virtgpu_drv.h | 3 +++ drivers/gpu/drm/virtio/virtgpu_trace.h | 20

Re: [PATCH v9 01/11] drm/msm/gem: Prevent blocking within shrinker loop

2022-11-29 Thread Rob Clark
m the loop. > > This problem was found during shrinker/madvise IOCTL testing of > virtio-gpu driver. The MSM driver is affected in the same way. > > Signed-off-by: Dmitry Osipenko Reviewed-by: Rob Clark > --- > drivers/gpu/drm/drm_gem.c | 9 ++

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-09-11 Thread Rob Clark
On Wed, Sep 7, 2022 at 3:25 AM Dmitry Osipenko wrote: > > On 8/23/22 19:47, Rob Clark wrote: > > On Tue, Aug 23, 2022 at 3:01 AM Christian König > > wrote: > >> > >> Am 22.08.22 um 19:26 schrieb Dmitry Osipenko: > >>> On 8/16/22 22:55, Dmitry Os

Re: [PATCH v1] drm/ttm: Refcount allocated tail pages

2022-09-08 Thread Rob Clark
iately stop this completely broken approach. We have discussed > > this multiple times now. > > Yeah we need to get this stuff closed for real by tagging them all with > VM_IO or VM_PFNMAP asap. > > It seems ot be a recurring amount of fun that people try to mmap dma-buf > and

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-23 Thread Rob Clark
On Tue, Aug 23, 2022 at 3:01 AM Christian König wrote: > > Am 22.08.22 um 19:26 schrieb Dmitry Osipenko: > > On 8/16/22 22:55, Dmitry Osipenko wrote: > >> On 8/16/22 15:03, Christian König wrote: > >>> Am 16.08.22 um 13:44 schrieb Dmitry Osipenko: > [SNIP] > > The other complication I not

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-16 Thread Rob Clark
On Tue, Aug 16, 2022 at 4:45 AM Dmitry Osipenko wrote: > > On 8/12/22 18:01, Rob Clark wrote: > > On Fri, Aug 12, 2022 at 7:57 AM Rob Clark wrote: > >> > >> On Fri, Aug 12, 2022 at 4:26 AM Dmitry Osipenko > >> wrote: > >>> > >>> On

[PATCH] drm/virtio: Fix same-context optimization

2022-08-12 Thread Rob Clark
From: Rob Clark When VIRTGPU_EXECBUF_RING_IDX is used, we should be considering the timeline that the EB if running on rather than the global driver fence context. Fixes: 85c83ea915ed ("drm/virtio: implement context init: allocate an array of fence contexts") Signed-off-by:

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-12 Thread Rob Clark
On Fri, Aug 12, 2022 at 7:57 AM Rob Clark wrote: > > On Fri, Aug 12, 2022 at 4:26 AM Dmitry Osipenko > wrote: > > > > On 8/11/22 02:19, Rob Clark wrote: > > > On Wed, Aug 10, 2022 at 3:23 PM Dmitry Osipenko > > > wrote: > > >> > > >

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-12 Thread Rob Clark
On Fri, Aug 12, 2022 at 4:26 AM Dmitry Osipenko wrote: > > On 8/11/22 02:19, Rob Clark wrote: > > On Wed, Aug 10, 2022 at 3:23 PM Dmitry Osipenko > > wrote: > >> > >> On 8/11/22 01:03, Rob Clark wrote: > >>> On Wed, Aug 10, 2022 at 12:26 PM Dmitry

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-10 Thread Rob Clark
On Wed, Aug 10, 2022 at 3:23 PM Dmitry Osipenko wrote: > > On 8/11/22 01:03, Rob Clark wrote: > > On Wed, Aug 10, 2022 at 12:26 PM Dmitry Osipenko > > wrote: > >> > >> On 8/10/22 18:08, Rob Clark wrote: > >>> On Wed, Aug 10, 2022 at 4:47 AM Da

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-10 Thread Rob Clark
On Wed, Aug 10, 2022 at 12:26 PM Dmitry Osipenko wrote: > > On 8/10/22 18:08, Rob Clark wrote: > > On Wed, Aug 10, 2022 at 4:47 AM Daniel Vetter wrote: > >> > >> On Wed, Jul 06, 2022 at 10:02:07AM +0300, Dmitry Osipenko wrote: > >>> On 7/6/22 00:48, Rob

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-08-10 Thread Rob Clark
On Wed, Aug 10, 2022 at 4:47 AM Daniel Vetter wrote: > > On Wed, Jul 06, 2022 at 10:02:07AM +0300, Dmitry Osipenko wrote: > > On 7/6/22 00:48, Rob Clark wrote: > > > On Tue, Jul 5, 2022 at 4:51 AM Christian König > > > wrote: > > >> > >

Re: [PATCH v8 2/2] drm/gem: Don't map imported GEMs

2022-07-05 Thread Rob Clark
On Tue, Jul 5, 2022 at 4:51 AM Christian König wrote: > > Am 01.07.22 um 11:02 schrieb Dmitry Osipenko: > > Drivers that use drm_gem_mmap() and drm_gem_mmap_obj() helpers don't > > handle imported dma-bufs properly, which results in mapping of something > > else than the imported dma-buf. On NVIDI

Re: [PATCH v7 7/9] drm/virtio: Improve DMA API usage for shmem BOs

2022-07-05 Thread Rob Clark
On Tue, Jul 5, 2022 at 10:02 AM Dmitry Osipenko wrote: > > On 7/5/22 18:45, Gerd Hoffmann wrote: > > Hi, > > > >>> Also note that pci is not the only virtio transport we have. > >> > >> The VirtIO indeed has other transports, but only PCI is really supported > >> in case of the VirtIO-GPU in ker

Re: [PATCH v6 00/22] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2022-06-28 Thread Rob Clark
On Tue, Jun 28, 2022 at 5:51 AM Dmitry Osipenko wrote: > > On 6/28/22 15:31, Robin Murphy wrote: > > ->8- > > [ 68.295951] == > > [ 68.295956] WARNING: possible circular locking dependency detected > > [ 68.295963] 5.19.0-rc3+ #400

Re: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker

2022-06-20 Thread Rob Clark
() On Thu, May 26, 2022 at 4:55 PM Dmitry Osipenko wrote: > > Introduce a common DRM SHMEM shrinker framework that allows to reduce > code duplication among DRM drivers by replacing theirs custom shrinker > implementations with the generic shrinker. > > In order to start using DRM SHMEM shrinker

Re: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker

2022-06-20 Thread Rob Clark
On Mon, Jun 20, 2022 at 7:09 AM Dmitry Osipenko wrote: > > On 6/19/22 20:53, Rob Clark wrote: > ... > >> +static unsigned long > >> +drm_gem_shmem_shrinker_count_objects(struct shrinker *shrinker, > >> +struct shrink_cont

Re: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker

2022-06-19 Thread Rob Clark
On Thu, May 26, 2022 at 4:55 PM Dmitry Osipenko wrote: > > Introduce a common DRM SHMEM shrinker framework that allows to reduce > code duplication among DRM drivers by replacing theirs custom shrinker > implementations with the generic shrinker. > > In order to start using DRM SHMEM shrinker driv

Re: [PATCH v4 11/15] drm/shmem-helper: Add generic memory shrinker

2022-06-19 Thread Rob Clark
ages_use_count=1 means the pages are allowed to > be evicted and purged if shrinker is enabled. Then the further > drm_gem_shmem_pin/vmap() calls will bump the pages_use_count, > disallowing the eviction and purging, like you're suggesting, and we > won't need the explicit counts.

Re: [PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker

2022-06-05 Thread Rob Clark
On Sun, Jun 5, 2022 at 9:47 AM Daniel Vetter wrote: > > On Fri, 27 May 2022 at 01:55, Dmitry Osipenko > wrote: > > > > Introduce a common DRM SHMEM shrinker framework that allows to reduce > > code duplication among DRM drivers by replacing theirs custom shrinker > > implementations with the gene

Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event

2022-04-22 Thread Rob Clark
On Tue, Apr 5, 2022 at 10:57 AM Chia-I Wu wrote: > > On Tue, Apr 5, 2022 at 10:38 AM Rob Clark wrote: > > > > From: Rob Clark > > > > It would have been cleaner to have a flag to *request* the fence event. > > But that ship has sailed. So add a flag so t

[PATCH] drm/virtio: Add execbuf flag to request no fence-event

2022-04-05 Thread Rob Clark
From: Rob Clark It would have been cleaner to have a flag to *request* the fence event. But that ship has sailed. So add a flag so that userspace which doesn't care about the events can opt-out. Signed-off-by: Rob Clark --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +--- include

Re: [PATCH v2 6/8] drm/shmem-helper: Add generic memory shrinker

2022-03-17 Thread Rob Clark
On Wed, Mar 16, 2022 at 5:13 PM Dmitry Osipenko wrote: > > On 3/16/22 23:00, Rob Clark wrote: > > On Mon, Mar 14, 2022 at 3:44 PM Dmitry Osipenko > > wrote: > >> > >> Introduce a common DRM SHMEM shrinker. It allows to reduce code > >> duplication a

Re: [PATCH v2 6/8] drm/shmem-helper: Add generic memory shrinker

2022-03-16 Thread Rob Clark
On Mon, Mar 14, 2022 at 3:44 PM Dmitry Osipenko wrote: > > Introduce a common DRM SHMEM shrinker. It allows to reduce code > duplication among DRM drivers, it also handles complicated lockings > for the drivers. This is initial version of the shrinker that covers > basic needs of GPU drivers. > >

Re: [PATCH v1 0/5] Add memory shrinker to VirtIO-GPU DRM driver

2022-03-09 Thread Rob Clark
On Wed, Mar 9, 2022 at 12:06 PM Dmitry Osipenko wrote: > > On 3/9/22 03:56, Rob Clark wrote: > >> If we really can't track madvise state in the guest for dealing with > >> host memory pressure, I think the better option is to introduce > >> MADV:WILLNEED_R

Re: [PATCH v1 5/5] drm/virtio: Add memory shrinker

2022-03-08 Thread Rob Clark
On Tue, Mar 8, 2022 at 5:17 AM Dmitry Osipenko wrote: > > Add memory shrinker and new madvise IOCTL to the VirtIO-GPU driver. > Userspace (BO cache manager of Mesa driver) will mark BOs as "don't need" > using the new IOCTL to let shrinker purge the marked BOs on OOM, thus > shrinker will lower me

Re: [PATCH v1 0/5] Add memory shrinker to VirtIO-GPU DRM driver

2022-03-08 Thread Rob Clark
On Tue, Mar 8, 2022 at 3:36 PM Dmitry Osipenko wrote: > > On 3/9/22 01:24, Rob Clark wrote: > > On Tue, Mar 8, 2022 at 11:28 AM Dmitry Osipenko > > wrote: > >> > >> On 3/8/22 19:29, Rob Clark wrote: > >>> On Tue, Mar 8, 2022 at 5:17 AM D

Re: [PATCH v1 0/5] Add memory shrinker to VirtIO-GPU DRM driver

2022-03-08 Thread Rob Clark
On Tue, Mar 8, 2022 at 11:28 AM Dmitry Osipenko wrote: > > On 3/8/22 19:29, Rob Clark wrote: > > On Tue, Mar 8, 2022 at 5:17 AM Dmitry Osipenko > > wrote: > >> > >> Hello, > >> > >> This patchset introduces memory shrinker for the VirtIO-GPU

Re: [PATCH v1 0/5] Add memory shrinker to VirtIO-GPU DRM driver

2022-03-08 Thread Rob Clark
On Tue, Mar 8, 2022 at 5:17 AM Dmitry Osipenko wrote: > > Hello, > > This patchset introduces memory shrinker for the VirtIO-GPU DRM driver. > During OOM, the shrinker will release BOs that are marked as "not needed" > by userspace using the new madvise IOCTL. The userspace in this case is > the M

[PATCH] drm/virtio: Remove restriction of non-zero blob_flags

2022-02-19 Thread Rob Clark
From: Rob Clark With native userspace drivers in guest, a lot of GEM objects need to be neither shared nor mappable. And in fact making everything mappable and/or sharable results in unreasonably high fd usage in host VMM. Signed-off-by: Rob Clark --- This is for a thing I'm working on,

Re: [PATCH] drm/virtio: Add USE_INTERNAL blob flag

2022-02-18 Thread Rob Clark
On Fri, Feb 18, 2022 at 8:42 AM Chia-I Wu wrote: > > On Fri, Feb 18, 2022 at 7:57 AM Rob Clark wrote: > > > > From: Rob Clark > > > > With native userspace drivers in guest, a lot of GEM objects need to be > > neither shared nor mappable. And in fact m

[PATCH] drm/virtio: Add USE_INTERNAL blob flag

2022-02-18 Thread Rob Clark
From: Rob Clark With native userspace drivers in guest, a lot of GEM objects need to be neither shared nor mappable. And in fact making everything mappable and/or sharable results in unreasonably high fd usage in host VMM. Signed-off-by: Rob Clark --- This is for a thing I'm working on,

[PATCH] drm/virtio: Fix capset-id query size

2022-02-15 Thread Rob Clark
From: Rob Clark The UABI was already defined for pointer to 64b value, and all the userspace users of this ioctl that I could find are already using a uint64_t (but zeroing it out to work around kernel only copying 32b). Unfortunately this ioctl doesn't have a length field, so out of paran

Re: [Freedreno] [PATCH 16/17] iommu: remove DOMAIN_ATTR_IO_PGTABLE_CFG

2021-03-04 Thread Rob Clark
On Thu, Mar 4, 2021 at 7:48 AM Robin Murphy wrote: > > On 2021-03-01 08:42, Christoph Hellwig wrote: > > Signed-off-by: Christoph Hellwig > > Moreso than the previous patch, where the feature is at least relatively > generic (note that there's a bunch of in-flight development around > DOMAIN_ATTR

[PATCH v3 2/3] drm: plumb attaching dev thru to prime_pin/unpin

2019-07-16 Thread Rob Clark
From: Rob Clark Needed in the following patch for cache operations. Signed-off-by: Rob Clark --- v3: rebased on drm-tip drivers/gpu/drm/drm_gem.c | 8 drivers/gpu/drm/drm_internal.h | 4 ++-- drivers/gpu/drm/drm_prime.c | 4

[PATCH v2 2/3] drm: plumb attaching dev thru to prime_pin/unpin

2019-07-16 Thread Rob Clark
From: Rob Clark Needed in the following patch for cache operations. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_gem.c | 10 ++ drivers/gpu/drm/drm_gem_vram_helper.c | 6 -- drivers/gpu/drm/drm_prime.c | 4 ++-- drivers/gpu/drm/etnaviv