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

2023-05-08 Thread Dmitry Osipenko
On 5/3/23 09:51, Gerd Hoffmann wrote: > On Mon, May 01, 2023 at 06:38:45PM +0300, 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 t

Re: [PATCH v2 6/7] dma-buf: Change locking policy for mmap()

2023-05-01 Thread Dmitry Osipenko
On 4/6/23 19:06, Dmitry Osipenko wrote: > Change locking policy of mmap() callback, making exporters responsible > for handling dma-buf reservation locking. Previous locking policy stated > that dma-buf is locked for both importers and exporters by the dma-buf > core, which cause

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

2023-05-01 Thread Dmitry Osipenko
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 VirtIO-GPU kernel driver: > > 1. Venus context > 2. Native contexts (virtio-freedreno, virtio-intel, virtio-amdgpu)

Re: [PATCH v6 3/3] drm/virtio: Support sync objects

2023-05-01 Thread Dmitry Osipenko
On 4/16/23 14:52, Dmitry Osipenko wrote: > Add sync object DRM UAPI support to VirtIO-GPU driver. Sync objects > support is needed by native context VirtIO-GPU Mesa drivers, it also will > be used by Venus and Virgl contexts. > > Reviewed-by; Emil Velikov > Signed-off-b

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

2023-04-19 Thread Dmitry Osipenko
Hello Gurchetan, On 4/18/23 02:17, Gurchetan Singh wrote: > On Sun, Apr 16, 2023 at 4:53 AM Dmitry Osipenko < > dmitry.osipe...@collabora.com> wrote: > >> We have multiple Vulkan context types that are awaiting for the addition >> of the sync object DRM UAPI suppo

[PATCH v6 1/3] drm/virtio: Refactor and optimize job submission code path

2023-04-16 Thread Dmitry Osipenko
ioctl to the point of pushing job to virtio queue. Job's initialization is now performed before in-fence is awaited and out-fence setup is made after sending out job to virtio. Reviewed-by: Rob Clark Reviewed-by; Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virti

[PATCH v6 3/3] drm/virtio: Support sync objects

2023-04-16 Thread Dmitry Osipenko
Add sync object DRM UAPI support to VirtIO-GPU driver. Sync objects support is needed by native context VirtIO-GPU Mesa drivers, it also will be used by Venus and Virgl contexts. Reviewed-by; Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.c| 3

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

2023-04-16 Thread Dmitry Osipenko
to add a new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (3): drm/virtio: Refactor and optimize job submission code path drm/virtio: Wait for each dma-fence of in-fenc

[PATCH v6 2/3] drm/virtio: Wait for each dma-fence of in-fence array individually

2023-04-16 Thread Dmitry Osipenko
Rob Clark Reviewed-by; Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_submit.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c index 84

Re: [PATCH v5 3/3] drm/virtio: Support sync objects

2023-04-12 Thread Dmitry Osipenko
Hello, On 4/11/23 14:07, Emil Velikov wrote: > Hi Dmitry, > > On Sun, 9 Apr 2023 at 13:40, Dmitry Osipenko > wrote: > >> +static void virtio_gpu_free_syncobjs(struct drm_syncobj **syncobjs, >> +uint32_t nr_syncobjs) >> +{ &g

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

2023-04-09 Thread Dmitry Osipenko
y difficult to add a new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (3): drm/virtio: Refactor and optimize job submission code path drm/virtio: Wait for each dma-fence

[PATCH v5 2/3] drm/virtio: Wait for each dma-fence of in-fence array individually

2023-04-09 Thread Dmitry Osipenko
Rob Clark Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_submit.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c index 902734778d1b..b60dea077240 10

[PATCH v5 3/3] drm/virtio: Support sync objects

2023-04-09 Thread Dmitry Osipenko
Add sync object DRM UAPI support to VirtIO-GPU driver. Sync objects support is needed by native context VirtIO-GPU Mesa drivers, it also will be used by Venus and Virgl contexts. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.c| 3 +- drivers/gpu/drm/virtio

[PATCH v5 1/3] drm/virtio: Refactor and optimize job submission code path

2023-04-09 Thread Dmitry Osipenko
ioctl to the point of pushing job to virtio queue. Job's initialization is now performed before in-fence is awaited and out-fence setup is made after sending out job to virtio. Reviewed-by: Rob Clark Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/Makefile | 2 +- drive

[PATCH v2 6/7] dma-buf: Change locking policy for mmap()

2023-04-06 Thread Dmitry Osipenko
dma-bufs which required to take the lock from the DRM exporter side. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/dma-buf.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c

[PATCH v2 7/7] drm/shmem-helper: Switch to reservation lock

2023-04-06 Thread Dmitry Osipenko
: Daniel Vetter Acked-by: Thomas Zimmermann Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 208 -- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +- .../gpu

[PATCH v2 5/7] drm: Don't assert held reservation lock for dma-buf mmapping

2023-04-06 Thread Dmitry Osipenko
once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares DRM drivers for the locking policy update. Reviewed-by: Emil Velikov Acked-by: Christian König Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/d

[PATCH v2 2/7] dma-buf/heaps: Don't assert held reservation lock for dma-buf mmapping

2023-04-06 Thread Dmitry Osipenko
once these drivers are moved to use reservation lock universally. The problem solved by moving the lock down to exporters. This patch prepares dma-buf heaps for the locking policy update. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/heaps/cma_heap.c| 3 --- d

[PATCH v2 4/7] fastrpc: Don't assert held reservation lock for dma-buf mmapping

2023-04-06 Thread Dmitry Osipenko
once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares fastrpc for the locking policy update. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/misc/fastrpc.c | 3 --- 1 file changed, 3

[PATCH v2 3/7] udmabuf: Don't assert held reservation lock for dma-buf mmapping

2023-04-06 Thread Dmitry Osipenko
once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares udmabuf for the locking policy update. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/udmabuf.c | 2 -- 1 file

[PATCH v2 1/7] media: videobuf2: Don't assert held reservation lock for dma-buf mmapping

2023-04-06 Thread Dmitry Osipenko
once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares videobuf2 for the locking policy update. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/media/common/videobuf2/videobuf2-dma-co

[PATCH v2 0/7] Move dma-buf mmap() reservation locking down to exporters

2023-04-06 Thread Dmitry Osipenko
. - Added r-b from Emil Velikov and placed the drm_WARN in the drm-shmem patch like he suggested in a comment to v1. - Corrected drm-shmem patch dma_resv_lock(obj->resv) inconsistently used with dma_resv_unlock(shmem->base.resv). Now shmem->base.resv variant i

Re: [PATCH v1 5/7] Revert "drm: Assert held reservation lock for dma-buf mmapping"

2023-04-04 Thread Dmitry Osipenko
On 4/3/23 18:17, Christian König wrote: > Am 02.04.23 um 18:48 schrieb Dmitry Osipenko: >> Don't assert held dma-buf reservation lock on memory mapping of exported >> buffer. >> >> We're going to change dma-buf mmap() locking policy such that exporters >>

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

2023-04-03 Thread Dmitry Osipenko
On 3/30/23 18:32, Emil Velikov wrote: >> +static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, >> + struct dma_fence *fence) >> +{ >> +struct dma_fence_unwrap itr; >> +struct dma_fence *f; >> +int err; >> + >> +dma_fence_unwrap_for_e

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

2023-04-03 Thread Dmitry Osipenko
On 4/3/23 16:22, Emil Velikov wrote: > On Mon, 3 Apr 2023 at 14:00, Emil Velikov wrote: > I think we should zero num_(in|out)_syncobjs when the respective parse fails. Otherwise we get one "cleanup" within the parse function itself and a second during the cleanup_submit. Haven't lo

Re: [PATCH v1 0/7] Move dma-buf mmap() reservation locking down to exporters

2023-04-03 Thread Dmitry Osipenko
On 4/2/23 19:48, Dmitry Osipenko wrote: > This patchset makes dma-buf exporters responisble for taking care of > the reservation lock. I also included patch that moves drm-shmem to use > reservation lock, to let CI test the whole set. I'm going to take all > the patches via

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

2023-04-02 Thread Dmitry Osipenko
On 3/30/23 20:24, Emil Velikov wrote: > Hi Dmitry, > > Have you considered creating a few DRM helpers for this functionality? > > AFAICT this is the third driver which supports syncobj timelines and > looking at one of the implementations ... it is not great. Note that > this suggestion is _not_

[PATCH v1 7/7] drm/shmem-helper: Switch to reservation lock

2023-04-02 Thread Dmitry Osipenko
: Daniel Vetter Acked-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 217 -- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +- .../gpu/drm/panfrost

[PATCH v1 6/7] dma-buf: Change locking policy for mmap()

2023-04-02 Thread Dmitry Osipenko
dma-bufs which required to take the lock from the DRM exporter side. Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/dma-buf.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index aa4ea8530cb3

[PATCH v1 3/7] Revert "udmabuf: Assert held reservation lock for dma-buf mmapping"

2023-04-02 Thread Dmitry Osipenko
bufs, it's solved by moving the lock down to exporters. Fixes: aa3f99896443 ("udmabuf: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/udmabuf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/

[PATCH v1 5/7] Revert "drm: Assert held reservation lock for dma-buf mmapping"

2023-04-02 Thread Dmitry Osipenko
bufs, it's solved by moving the lock down to exporters. Fixes: 39ce25291871 ("drm: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_prime.c| 2 -- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 2 --

[PATCH v1 4/7] Revert "fastrpc: Assert held reservation lock for dma-buf mmapping"

2023-04-02 Thread Dmitry Osipenko
bufs, it's solved by moving the lock down to exporters. Fixes: 265751a513ad ("fastrpc: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/misc/fastrpc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/misc/fastrpc.c b/dri

[PATCH v1 2/7] Revert "dma-buf/heaps: Assert held reservation lock for dma-buf mmapping"

2023-04-02 Thread Dmitry Osipenko
bufs, it's solved by moving the lock down to exporters. Fixes: 27f3733a1049 ("dma-buf/heaps: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/heaps/cma_heap.c| 3 --- drivers/dma-buf/heaps/system_heap.c | 3 --- 2 files chan

[PATCH v1 1/7] Revert "media: videobuf2: Assert held reservation lock for dma-buf mmapping"

2023-04-02 Thread Dmitry Osipenko
bufs, it's solved by moving the lock down to exporters. Fixes: 3a6ca1810f77 ("media: videobuf2: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 --- drivers/media/common/videobuf2/v

[PATCH v1 0/7] Move dma-buf mmap() reservation locking down to exporters

2023-04-02 Thread Dmitry Osipenko
exporters. [1] https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114671v2/shard-snb5/igt@prime_vgem@s...@rcs0.html [2] https://elixir.bootlin.com/linux/v6.3-rc4/source/drivers/gpu/drm/drm_prime.c#L924 Dmitry Osipenko (7): Revert "media: videobuf2: Assert held reservation lock for dma-buf

Re: [PATCH v13 01/10] drm/shmem-helper: Switch to reservation lock

2023-04-02 Thread Dmitry Osipenko
On 3/26/23 12:19, Christian König wrote: > Am 25.03.23 um 15:58 schrieb Dmitry Osipenko: >> On 3/15/23 16:46, Dmitry Osipenko wrote: >>> On 3/14/23 05:26, Dmitry Osipenko wrote: >>>> @@ -633,7 +605,10 @@ int drm_gem_shmem_mmap(struct >>>> drm_gem_

Re: [PATCH v13 01/10] drm/shmem-helper: Switch to reservation lock

2023-03-25 Thread Dmitry Osipenko
On 3/15/23 16:46, Dmitry Osipenko wrote: > On 3/14/23 05:26, Dmitry Osipenko wrote: >> @@ -633,7 +605,10 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object >> *shmem, struct vm_area_struct >> return ret; >> } >> >> +dma_resv_lo

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

2023-03-23 Thread Dmitry Osipenko
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. Reviewed-by: Rob Clark Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/Makefile | 2 +- drivers/gpu/drm/virtio

[PATCH v4 2/2] drm/virtio: Support sync objects

2023-03-23 Thread Dmitry Osipenko
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/virtgpu_drv.c| 3 +- drivers/gpu/drm/virtio/virtgpu_sub

[PATCH v4 0/2] Add sync object UAPI support to VirtIO-GPU driver

2023-03-23 Thread Dmitry Osipenko
- Added new patch that refactors job submission code path. I found that it was very difficult to add a new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (2): drm/vi

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

2023-03-23 Thread Dmitry Osipenko
On 3/24/23 00:51, Dmitry Osipenko wrote: > On 3/24/23 00:18, Rob Clark wrote: > ... >>> +static int >>> +virtio_gpu_parse_deps(struct virtio_gpu_submit *submit) >>> +{ >>> + struct drm_virtgpu_execbuffer *exbuf = submit->exbuf; >>> +

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

2023-03-23 Thread Dmitry Osipenko
On 3/23/23 22:03, Dmitry Osipenko wrote: > struct virtio_gpu_submit { > + struct virtio_gpu_submit_post_dep *post_deps; > + unsigned int num_out_syncobjs; > + > + struct drm_syncobj **in_syncobjs; > + unsigned int num_in_syncobjs; > + uint64_t *in_fence_

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

2023-03-23 Thread Dmitry Osipenko
On 3/24/23 00:18, Rob Clark wrote: ... >> +static int >> +virtio_gpu_parse_deps(struct virtio_gpu_submit *submit) >> +{ >> + struct drm_virtgpu_execbuffer *exbuf = submit->exbuf; >> + struct drm_virtgpu_execbuffer_syncobj syncobj_desc; >> + size_t syncobj_stride = exbuf->syncobj_s

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

2023-03-23 Thread Dmitry Osipenko
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/virtgpu_drv.c| 3 +- drivers/gpu/drm/virtio/virtgpu_sub

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

2023-03-23 Thread Dmitry Osipenko
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 | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h| 4 + drivers

[PATCH v3 0/2] Add sync object UAPI support to VirtIO-GPU driver

2023-03-23 Thread Dmitry Osipenko
new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (2): drm/virtio: Refactor job submission code path drm/virtio: Support sync objects drivers/gpu/drm/virtio/Makefile

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

2023-03-22 Thread Dmitry Osipenko
On 3/23/23 00:25, Rob Clark wrote: ... >> +static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, >> +struct dma_fence *fence) >> +{ >> + struct dma_fence *itr; >> + int idx, err; >> + >> + dma_fence_array_for_each(itr, idx, fenc

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

2023-03-19 Thread Dmitry Osipenko
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 | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h| 4 + drivers

[PATCH v2 2/2] drm/virtio: Support sync objects

2023-03-19 Thread Dmitry Osipenko
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/virtgpu_drv.c| 3 +- drivers/gpu/drm/virtio/virtgpu_sub

[PATCH v2 0/2] Add sync object UAPI support to VirtIO-GPU driver

2023-03-19 Thread Dmitry Osipenko
difficult to add a new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (2): drm/virtio: Refactor job submission code path drm/virtio: Support sync objects drivers/gpu/drm/virtio

Re: [PATCH v13 01/10] drm/shmem-helper: Switch to reservation lock

2023-03-15 Thread Dmitry Osipenko
On 3/14/23 05:26, Dmitry Osipenko wrote: > @@ -633,7 +605,10 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object > *shmem, struct vm_area_struct > return ret; > } > > + dma_resv_lock(shmem->base.resv, NULL); > ret = drm_g

[PATCH v13 08/10] drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked()

2023-03-13 Thread Dmitry Osipenko
Export drm_gem_shmem_get_pages_sgt_locked() that will be used by virtio-gpu shrinker during GEM swap-in operation done under the held reservation lock. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- include/drm/drm_gem_shmem_helper.h | 1 + 2 files

[PATCH v13 10/10] drm/panfrost: Switch to generic memory shrinker

2023-03-13 Thread Dmitry Osipenko
Replace Panfrost's custom memory shrinker with a common drm-shmem memory shrinker. Tested-by: Steven Price # Firefly-RK3288 Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h

[PATCH v13 09/10] drm/virtio: Support memory shrinking

2023-03-13 Thread Dmitry Osipenko
memory if guest supports SWAP file or partition. Acked-by: Gerd Hoffmann Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h| 20 +++- drivers/gpu/drm/virtio/virtgpu_gem.c| 68 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 +

[PATCH v13 06/10] drm/shmem-helper: Add memory shrinker

2023-03-13 Thread Dmitry Osipenko
. Initialize drm-shmem internals using drmm_gem_shmem_init(drm_device), which will register drm-shmem shrinker 3. Implement madvise IOCTL that will use drm_gem_shmem_madvise() Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 351

[PATCH v13 07/10] drm/shmem-helper: Remove obsoleted is_iomem test

2023-03-13 Thread Dmitry Osipenko
ted-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index a02377a5131b..9e94652a141c 100644 --- a/d

[PATCH v13 05/10] drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge()

2023-03-13 Thread Dmitry Osipenko
Factor out pages unpinning code from drm_gem_shmem_purge() into new drm_gem_shmem_unpin_pages(). This prepares code for addition of memory shrinker support. The new common function will be used by shrinker for eviction of shmem pages. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm

[PATCH v13 03/10] drm/shmem-helper: Add pages_pin_count field

2023-03-13 Thread Dmitry Osipenko
: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 +++ include/drm/drm_gem_shmem_helper.h | 9 + 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 4da9c9c39b9a..81d61791f874 100644 --- a

[PATCH v13 04/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2023-03-13 Thread Dmitry Osipenko
do that. Switch the vmap/vunmap to use pin/unpin functions in a preparation of addition of the memory shrinker support. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers

[PATCH v13 01/10] drm/shmem-helper: Switch to reservation lock

2023-03-13 Thread Dmitry Osipenko
: Daniel Vetter Acked-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 217 -- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +- .../gpu/drm/panfrost

[PATCH v13 02/10] drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages()

2023-03-13 Thread Dmitry Osipenko
-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 67 +- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 8fc2a3277486..4da9c9c39b9a 100644 --- a/drivers/gpu/

[PATCH v13 00/10] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2023-03-13 Thread Dmitry Osipenko
s://lore.kernel.org/dri-devel/6c16f303-81df-7ebe-85e9-51bb40a8b...@collabora.com/T/ Dmitry Osipenko (10): drm/shmem-helper: Switch to reservation lock drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages() drm/shmem-helper: Add pages_pin_count field drm/shmem-helper

Re: [PATCH v12 10/11] drm/virtio: Support memory shrinking

2023-03-07 Thread Dmitry Osipenko
On 3/7/23 21:25, Dmitry Osipenko wrote: >> Not really a problem with this patchset, but having such branches looks >> like a bug in the driver's GEM design. Whatever your GEM object needs or >> does, it should be hidden in the implementation. Why is virtio doing this? &

Re: [PATCH v12 10/11] drm/virtio: Support memory shrinking

2023-03-07 Thread Dmitry Osipenko
On 3/7/23 13:42, Thomas Zimmermann wrote: > Hi > > Am 05.03.23 um 23:10 schrieb Dmitry Osipenko: > [...] >>     *bo_ptr = bo; >> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c >> b/drivers/gpu/drm/virtio/virtgpu_plane.c >> index 4c09e313bebc..3f21512f

Re: [PATCH v3] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option

2023-03-06 Thread Dmitry Osipenko
On 3/6/23 19:39, Dmitry Osipenko wrote: > VirtIO-GPU got a new config option for disabling KMS. There were two > problems left unnoticed during review when the new option was added: > > 1. The IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS) check in the code was > inverted, hence KMS was d

[PATCH v3] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option

2023-03-06 Thread Dmitry Osipenko
Hoffmann Fixes: 72122c69d717 ("drm/virtio: Add option to disable KMS support") Signed-off-by: Dmitry Osipenko --- Changelog: v3: - Moved another similar "has_edid" occurence under the "num_scanouts" condition in virtio_gpu_init(), like was suggested by Emil

Re: [PATCH v2] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option

2023-03-06 Thread Dmitry Osipenko
On 3/6/23 18:02, Emil Velikov wrote: > On 2023/03/06, Dmitry Osipenko wrote: >> VirtIO-GPU got a new config option for disabling KMS. There were two >> problems left unnoticed during review when the new option was added: >> >> 1. The IS_ENABLED(CONFIG_DRM_VIRTIO_GPU

[PATCH v2] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option

2023-03-06 Thread Dmitry Osipenko
: 72122c69d717 ("drm/virtio: Add option to disable KMS support") Signed-off-by: Dmitry Osipenko --- Changelog: v2: - Moved the "has_edid" under the "num_scanouts" condition, like was suggested by Gerd Hoffmann. drivers/gpu/drm/virtio/virtgpu_kms.c | 14 --

[PATCH v12 11/11] drm/panfrost: Switch to generic memory shrinker

2023-03-05 Thread Dmitry Osipenko
Replace Panfrost's custom memory shrinker with a common drm-shmem memory shrinker. Tested-by: Steven Price # Firefly-RK3288 Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h

[PATCH v12 10/11] drm/virtio: Support memory shrinking

2023-03-05 Thread Dmitry Osipenko
memory if guest supports SWAP file or partition. Acked-by: Gerd Hoffmann Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h| 18 +++- drivers/gpu/drm/virtio/virtgpu_gem.c| 52 + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 +

[PATCH v12 09/11] drm/gem: Export drm_gem_pin/unpin()

2023-03-05 Thread Dmitry Osipenko
Export drm_gem_un/pin() functions. They will be used by VirtIO-GPU driver for pinning of an active framebuffer, preventing it from swapping out by memory shrinker. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 2 ++ drivers/gpu/drm/drm_internal.h | 2 -- include/drm

[PATCH v12 08/11] drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked()

2023-03-05 Thread Dmitry Osipenko
Export drm_gem_shmem_get_pages_sgt_locked() that will be used by virtio-gpu shrinker during GEM swap-in operation done under the held reservation lock. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- include/drm/drm_gem_shmem_helper.h | 1 + 2 files

[PATCH v12 07/11] drm/shmem-helper: Remove obsoleted is_iomem test

2023-03-05 Thread Dmitry Osipenko
ted-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index e47cc45f39a1..b814352aae33 100644 --- a/d

[PATCH v12 06/11] drm/shmem-helper: Add memory shrinker

2023-03-05 Thread Dmitry Osipenko
. Initialize drm-shmem internals using drmm_gem_shmem_init(drm_device), which will register drm-shmem shrinker 3. Implement madvise IOCTL that will use drm_gem_shmem_madvise() Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 351

[PATCH v12 03/11] drm/shmem-helper: Add pages_pin_count field

2023-03-05 Thread Dmitry Osipenko
: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 +++ include/drm/drm_gem_shmem_helper.h | 9 + 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index a62c41336a7f..0c3abb0c2ea2 100644 --- a

[PATCH v12 02/11] drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages()

2023-03-05 Thread Dmitry Osipenko
-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 67 +- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 651ca7f380a2..a62c41336a7f 100644 --- a/drivers/gpu/

[PATCH v12 05/11] drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge()

2023-03-05 Thread Dmitry Osipenko
Factor out pages unpinning code from drm_gem_shmem_purge() into new drm_gem_shmem_unpin_pages(). This prepares code for addition of memory shrinker support. The new common function will be used by shrinker for eviction of shmem pages. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm

[PATCH v12 04/11] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2023-03-05 Thread Dmitry Osipenko
do that. Switch the vmap/vunmap to use pin/unpin functions in a preparation of addition of the memory shrinker support. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers

[PATCH v12 01/11] drm/shmem-helper: Switch to reservation lock

2023-03-05 Thread Dmitry Osipenko
: Daniel Vetter Acked-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 217 -- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +- .../gpu/drm/panfrost

[PATCH v12 00/11] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2023-03-05 Thread Dmitry Osipenko
v10:- Was partially applied to misc-fixes/next. https://lore.kernel.org/dri-devel/6c16f303-81df-7ebe-85e9-51bb40a8b...@collabora.com/T/ Dmitry Osipenko (11): drm/shmem-helper: Switch to reservation lock drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages()

[PATCH v1] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option

2023-03-04 Thread Dmitry Osipenko
: 72122c69d717 ("drm/virtio: Add option to disable KMS support") Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_kms.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_k

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

2023-03-04 Thread Dmitry Osipenko
On 3/3/23 02:35, Rob Clark wrote: > @@ -223,12 +223,15 @@ int virtio_gpu_init(struct virtio_device *vdev, struct > drm_device *dev) > num_scanouts, &num_scanouts); > vgdev->num_scanouts = min_t(uint32_t, num_scanouts, > VIRTIO_GPU_MAX_S

Re: [PATCH] drm/etnaviv: fix reference leak when mmaping imported buffer

2023-03-04 Thread Dmitry Osipenko
On 2/28/23 19:55, Lucas Stach wrote: > drm_gem_prime_mmap() takes a reference on the GEM object, but before that > drm_gem_mmap_obj() already takes a reference, which will be leaked as only > one reference is dropped when the mapping is closed. Drop the extra > reference when dma_buf_mmap() succeed

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

2023-03-03 Thread Dmitry Osipenko
it's init/fini fxns instead > > Signed-off-by: Rob Clark > Reviewed-by: Dmitry Osipenko > Reviewed-by: Javier Martinez Canillas > --- Applied to misc-next -- Best regards, Dmitry

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

2023-03-01 Thread Dmitry Osipenko
On 3/1/23 21:54, Rob Clark wrote: > /* virtgpu_display.c */ > +#if defined(CONFIG_DRM_VIRTIO_GPU_KMS) > int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev); > void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev); > +#else > +static inline int virtio_gpu_modeset_init(struct virt

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

2023-02-28 Thread Dmitry Osipenko
gitimate purpose. > > v2: Use more if (IS_ENABLED(...)) > v3: Also permit the host to advertise no scanouts > v4: Spiff out commit msg > > Signed-off-by: Rob Clark > Reviewed-by: Dmitry Osipenko > --- Gerd, to give you some context on the v4.. we've chatted a bit more on

Re: [PATCH] Revert "drm/shmem-helper: Switch to reservation lock"

2023-02-28 Thread Dmitry Osipenko
967 at drivers/gpu/drm/drm_gem_shmem_helper.c:243 > drm_gem_shmem_pin+0x42/0x90 [drm_shmem_helper] > > Signed-off-by: Thomas Zimmermann > --- Thanks Thomas, Acked-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH] drm/shmem-helper: Fix compile error

2023-02-28 Thread Dmitry Osipenko
On 2/28/23 17:40, Jani Nikula wrote: ... >>> And the build is indeed currently broken. >>> >>> Moreover, when the build was fine for a while, apparently the changes in >>> shmem broke a bunch of machines in Intel CI. And due to this, we aren't >>> getting any CI results for incoming patches right n

Re: [PATCH] drm/shmem-helper: Fix compile error

2023-02-28 Thread Dmitry Osipenko
Hi, On 2/28/23 15:50, Andi Shyti wrote: > Commit 67b7836d4458 ("drm/shmem-helper: Switch to reservation > lock") removes the drm_gem_shmem_get_pages_locked() and > drm_gem_shmem_put_pages_locked(). > > But then commit edaa0db9 ("drm/shmem-helper: Fix locking for > drm_gem_shmem_get_pages_sgt(

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

2023-02-28 Thread Dmitry Osipenko
On 2/28/23 12:19, Javier Martinez Canillas wrote: > Gerd Hoffmann writes: > > Hello Gerd, > >> On Mon, Feb 27, 2023 at 07:40:11AM -0800, Rob Clark wrote: >>> 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 Cla

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

2023-02-27 Thread Dmitry Osipenko
with `#if IS_ENABLED()`, for consistency. Maybe won't hurt to expand the commit message a tad, emphasizing the security aspect and telling about the new num_scanouts=0 behaviour. I can change it all while applying, if Gerd is okay with this patch. Othwerise, good to me: Reviewed-by: D

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

2023-02-27 Thread Dmitry Osipenko
On 2/27/23 20:38, Rob Clark wrote: ... > + if (IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS)) { > + /* get display info */ > + virtio_cread_le(vgdev->vdev, struct virtio_gpu_config, > + num_scanouts, &num_scanouts); > + vgdev->num_scanouts

Re: [PATCH v11 05/10] drm/shmem-helper: Add memory shrinker

2023-02-27 Thread Dmitry Osipenko
On 2/27/23 11:25, kernel test robot wrote: > All errors (new ones prefixed by >>): > >drivers/gpu/drm/drm_gem_shmem_helper.c:832:18: warning: no previous > prototype for function 'drm_gem_shmem_get_pages_sgt_locked' > [-Wmissing-prototypes] >struct sg_table *drm_gem_shmem_get_pages_sgt_l

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

2023-02-27 Thread Dmitry Osipenko
On 2/27/23 13:37, Jani Nikula wrote: > On Mon, 27 Feb 2023, Dmitry Osipenko wrote: >> On 2/17/23 16:41, Dmitry Osipenko wrote: >>> On 2/17/23 16:28, Thomas Zimmermann wrote: >>>> Hi, >>>> >>>> I looked through the series. Most of the patches

[PATCH v11 10/10] drm/panfrost: Switch to generic memory shrinker

2023-02-26 Thread Dmitry Osipenko
Replace Panfrost's custom memory shrinker with a common drm-shmem memory shrinker. Tested-by: Steven Price # Firefly-RK3288 Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h

[PATCH v11 08/10] drm/gem: Add drm_gem_pin_unlocked()

2023-02-26 Thread Dmitry Osipenko
: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 29 + include/drm/drm_gem.h | 3 +++ 2 files changed, 32 insertions(+) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index e5b2c077b314..3b16026e47f8 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b

[PATCH v11 09/10] drm/virtio: Support memory shrinking

2023-02-26 Thread Dmitry Osipenko
memory if guest supports SWAP file or partition. Acked-by: Gerd Hoffmann Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_drv.h| 18 +++- drivers/gpu/drm/virtio/virtgpu_gem.c| 52 + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 +

[PATCH v11 02/10] drm/shmem-helper: Add pages_pin_count field

2023-02-26 Thread Dmitry Osipenko
: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 12 +++- include/drm/drm_gem_shmem_helper.h | 9 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 49ab49454783

[PATCH v11 05/10] drm/shmem-helper: Add memory shrinker

2023-02-26 Thread Dmitry Osipenko
. Initialize drm-shmem internals using drmm_gem_shmem_init(drm_device), which will register drm-shmem shrinker 3. Implement madvise IOCTL that will use drm_gem_shmem_madvise() Signed-off-by: Daniel Almeida Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 353

[PATCH v11 06/10] drm/shmem-helper: Remove obsoleted is_iomem test

2023-02-26 Thread Dmitry Osipenko
ted-by: Thomas Zimmermann Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 56de12bb28b1..ba1db7c5659c 100644 --- a/d

<    1   2   3   4   5   6   7   8   9   10   >