[PATCH v15 17/23] drm/shmem-helper: Add and use drm_gem_shmem_resv_assert_held() helper

2023-08-27 Thread Dmitry Osipenko
that it's impossible to have locking contention with the fs_reclam at this special time. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 37 +- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b

[PATCH v15 14/23] drm/shmem-helper: Add and use lockless drm_gem_shmem_get_pages()

2023-08-27 Thread Dmitry Osipenko
Add lockless drm_gem_shmem_get_pages() helper that skips taking reservation lock if pages_use_count is non-zero, leveraging from atomicity of the kref counter. Make drm_gem_shmem_mmap() to utilize the new helper. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm

[PATCH v15 06/23] drm/virtio: Replace drm_gem_shmem_free() with drm_gem_object_put()

2023-08-27 Thread Dmitry Osipenko
in order to prevent spurious lockdep warning about resv lock ordering vs fs_reclaim code paths. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm

[PATCH v15 05/23] drm/v3d: Replace open-coded drm_gem_shmem_free() with drm_gem_object_put()

2023-08-27 Thread Dmitry Osipenko
code paths. Replace open-coded drm_gem_shmem_free() with drm_gem_object_put() that drops kref to zero before freeing GEM. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/v3d/v3d_bo.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm

[PATCH v15 03/23] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names

2023-08-27 Thread Dmitry Osipenko
Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_client.c | 6 +++--- drivers/gpu/drm/drm_gem.c| 20 ++-- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++--- drivers/gpu/drm/drm_internal.h | 4 ++-- drivers/gpu/drm

[PATCH v15 04/23] drm/gem: Add _locked postfix to functions that have unlocked counterpart

2023-08-27 Thread Dmitry Osipenko
Add _locked postfix to drm_gem functions that have unlocked counterpart functions to make GEM functions naming more consistent and intuitive in regards to the locking requirements. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 6 +++--- include

[PATCH v15 01/23] drm/shmem-helper: Fix UAF in error path when freeing SGT of imported GEM

2023-08-27 Thread Dmitry Osipenko
t;) Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- include/drm/drm_gem_shmem_helper.h | 7 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index a7

[PATCH v15 02/23] drm/shmem-helper: Use flag for tracking page count bumped by get_pages_sgt()

2023-08-27 Thread Dmitry Osipenko
emoves the ambiguity. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- drivers/gpu/drm/lima/lima_gem.c| 1 + include/drm/drm_gem_shmem_helper.h | 7 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helpe

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

2023-08-27 Thread Dmitry Osipenko
85e9-51bb40a8b...@collabora.com/T/ Dmitry Osipenko (23): drm/shmem-helper: Fix UAF in error path when freeing SGT of imported GEM drm/shmem-helper: Use flag for tracking page count bumped by get_pages_sgt() drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function nam

Re: [RFC PATCH 3/3] drm/virtio: drm_gem_plane_helper_prepare_fb for obj synchronization

2023-08-23 Thread Dmitry Osipenko
On 8/20/23 23:58, Kim, Dongwon wrote: > On 8/17/2023 7:33 PM, Dmitry Osipenko wrote: >> On 7/13/23 01:44, Dongwon Kim wrote: >>> This helper is needed for framebuffer synchronization. Old >>> framebuffer data >>> is often displayed on the guest display w

[PATCH v2] MAINTAINERS: Add Boris Brezillon as Panfrost driver maintainer

2023-08-21 Thread Dmitry Osipenko
. Acked-by: Boris Brezillon Acked-by: Tomeu Vizoso Acked-by: Alyssa Rosenzweig Signed-off-by: Dmitry Osipenko --- Changelog: v2: - Added acks from Boris, Alyssa and Tomeu. Tomeu answered with ack to the v1 email, though he answered to me only and not "to all", so it's n

Re: [PATCH v2 01/15] drm/shmem-helper: Make pages_use_count an atomic_t

2023-08-18 Thread Dmitry Osipenko
On 8/11/23 16:08, Steven Price wrote: > On 09/08/2023 17:53, Boris Brezillon wrote: >> This way we can grab a pages ref without acquiring the resv lock when >> pages_use_count > 0. Need to implement asynchronous map using the > > NIT: s/Need/This is needed/ > >> drm_gpuva_mgr when the map/unmap

Re: [RFC PATCH 3/3] drm/virtio: drm_gem_plane_helper_prepare_fb for obj synchronization

2023-08-17 Thread Dmitry Osipenko
On 7/13/23 01:44, Dongwon Kim wrote: > This helper is needed for framebuffer synchronization. Old framebuffer data > is often displayed on the guest display without this helper. > > Cc: Gerd Hoffmann > Cc: Vivek Kasireddy > Signed-off-by: Dongwon Kim > --- >

Re: [RFC PATCH 2/3] drm/virtio: new fence for every plane update

2023-08-17 Thread Dmitry Osipenko
... > +static struct > +drm_plane_state *virtio_gpu_plane_duplicate_state(struct drm_plane *plane) > +{ > + struct virtio_gpu_plane_state *new; > + > + if (WARN_ON(!plane->state)) > + return NULL; When plane->state can be NULL? > + new = kzalloc(sizeof(*new), GFP_KERNEL);

Re: [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release

2023-08-17 Thread Dmitry Osipenko
On 8/17/23 08:25, Kim, Dongwon wrote: ... > Yeah, I know it frees 'struct dma_fence *f' but what about 'struct > virtio_gpu_fence *fence'? This is a device specific fence that contains > struct dma_fence *f. But hold on... so when fence->ops->release is > called then dma_fence_free won't be called

Re: [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release

2023-08-16 Thread Dmitry Osipenko
On 8/16/23 21:10, Kim, Dongwon wrote: > Hi, > > On 8/14/2023 9:18 PM, Dmitry Osipenko wrote: >> On 7/13/23 01:44, Dongwon Kim wrote: >>> virtio_gpu_fence_release is added to free virtio-gpu-fence >>> upon release of dma_fence. >>> >>> Cc: Ger

Re: [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release

2023-08-14 Thread Dmitry Osipenko
On 7/13/23 01:44, Dongwon Kim wrote: > virtio_gpu_fence_release is added to free virtio-gpu-fence > upon release of dma_fence. > > Cc: Gerd Hoffmann > Cc: Vivek Kasireddy > Signed-off-by: Dongwon Kim > --- > drivers/gpu/drm/virtio/virtgpu_fence.c | 8 > 1 file changed, 8

Re: [PATCH v1] MAINTAINERS: Add Boris Brezillon as Panfrost driver maintainer

2023-08-14 Thread Dmitry Osipenko
On 7/17/23 11:15, Dmitry Osipenko wrote: > Add Boris Brezillon as Panfrost driver maintainer. Boris is a new lead > developer of the Panfrost Mesa driver and main developer behind the > upcoming Panthor kernel driver that will serve next-gen Mali GPUs. > > Remove Tomeu and A

Re: [PATCH -next 5/7] drm/virtio: Remove an unnecessary NULL value

2023-08-12 Thread Dmitry Osipenko
) > { > - struct virtio_gpu_fence_event *e = NULL; > + struct virtio_gpu_fence_event *e; > int ret; > > e = kzalloc(sizeof(*e), GFP_KERNEL); Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH -next] drm/virtio: Remove unused function declarations

2023-08-12 Thread Dmitry Osipenko
ime_import(struct drm_device *dev, > struct dma_buf *buf); > -int virtgpu_gem_prime_get_uuid(struct drm_gem_object *obj, > -uuid_t *uuid); > struct drm_gem_object *virtgpu_gem_prime_import_sg_table( > struct drm_device *dev, struct dma_buf_attachment *attach, > struct sg_table *sgt); Reviewed-by: Dmitry Osipenko -- Best regards, Dmitry

[PATCH v4] drm/panfrost: Sync IRQ by job's timeout handler

2023-08-06 Thread Dmitry Osipenko
job timeouts due to a slow IRQ processing. Reviewed-by: Steven Price Reviewed-by: Boris Brezillon Reviewed-by: AngeloGioacchino Del Regno Tested-by: AngeloGioacchino Del Regno # MediaTek MT8192 and MT8195 Chromebooks Signed-off-by: Dmitry Osipenko --- Changelog: v4: - Improved comment like

[PATCH v3] drm/panfrost: Sync IRQ by job's timeout handler

2023-07-31 Thread Dmitry Osipenko
job timeouts due to a slow IRQ processing. Reviewed-by: Steven Price Reviewed-by: AngeloGioacchino Del Regno Tested-by: AngeloGioacchino Del Regno # MediaTek MT8192 and MT8195 Chromebooks: Signed-off-by: Dmitry Osipenko --- Changelog: v3: - Added comment to the code as was suggested by Boris

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

2023-07-31 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-07-31 Thread Dmitry Osipenko
On 7/29/23 01:03, Gurchetan Singh wrote: > On Wed, Jul 19, 2023 at 11:58 AM Dmitry Osipenko < > dmitry.osipe...@collabora.com> wrote: > >> 27.06.2023 20:16, Rob Clark пишет: >> ... >>>> Now these are just suggestions, and while I think they

Re: [PATCH v14 12/12] drm/gem: Add _unlocked postfix to drm_gem_pin/unpin()

2023-07-31 Thread Dmitry Osipenko
On 7/25/23 10:53, Boris Brezillon wrote: > On Sun, 23 Jul 2023 02:47:46 +0300 > Dmitry Osipenko wrote: > >> Make clear that drm_gem_pin/unpin() functions take reservation lock by >> adding _unlocked postfix to the function names. >> >> Suggested-by: Boris Br

Re: [PATCH v14 02/12] drm/shmem-helper: Add pages_pin_count field

2023-07-31 Thread Dmitry Osipenko
On 7/31/23 15:27, Dmitry Osipenko wrote: > On 7/25/23 11:32, Boris Brezillon wrote: >>> Can we make it an atomic_t, so we can avoid taking the lock when the >>> GEM has already been pinned. That's something I need to be able to grab >>> a pin-ref in a path where the G

Re: [PATCH v14 02/12] drm/shmem-helper: Add pages_pin_count field

2023-07-31 Thread Dmitry Osipenko
On 7/25/23 11:32, Boris Brezillon wrote: >> Can we make it an atomic_t, so we can avoid taking the lock when the >> GEM has already been pinned. That's something I need to be able to grab >> a pin-ref in a path where the GEM resv lock is already held[1]. We could >> of course expose the locked

[PATCH v2] drm/panfrost: Sync IRQ by job's timeout handler

2023-07-22 Thread Dmitry Osipenko
job timeouts due to a slow IRQ processing. Signed-off-by: Dmitry Osipenko --- Changelog: v2: - Moved synchronize_irq() after first signal-check to avoid unnecessary blocking on syncing. - Added warn message about high interrupt latency. drivers/gpu/drm/panfrost/panfrost_job.c | 7

[PATCH v14 08/12] drm/virtio: Support memory shrinking

2023-07-22 Thread Dmitry Osipenko
y 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| 72 + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 33 ++ d

[PATCH v14 07/12] drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked()

2023-07-22 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 v14 06/12] drm/shmem-helper: Remove obsoleted is_iomem test

2023-07-22 Thread Dmitry Osipenko
y: 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 0b6c4f318da5..5aa85242071a 100644 --- a/driver

[PATCH v14 11/12] drm/shmem-helper: Make drm_gem_shmem_print_info() symbol GPL

2023-07-22 Thread Dmitry Osipenko
Make drm_gem_shmem_print_info() exported symbol GPL to make it consistent with the rest of drm-shmem exports. It's the only remaining drm-shmem symbol that isn't GPL. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v14 02/12] drm/shmem-helper: Add pages_pin_count field

2023-07-22 Thread Dmitry Osipenko
-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 9 + include/drm/drm_gem_shmem_helper.h | 9 + 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 267153853e2c..42ba201dda50 100644

[PATCH v14 12/12] drm/gem: Add _unlocked postfix to drm_gem_pin/unpin()

2023-07-22 Thread Dmitry Osipenko
Make clear that drm_gem_pin/unpin() functions take reservation lock by adding _unlocked postfix to the function names. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 4 ++-- drivers/gpu/drm/drm_internal.h | 4 ++-- drivers/gpu/drm/drm_prime.c

[PATCH v14 10/12] drm/shmem-helper: Refactor locked/unlocked functions

2023-07-22 Thread Dmitry Osipenko
Add locked/unlocked postfixes to drm-shmem function names to make clear where reservation lock is taken and where not. Add more common helpers to drm_gem_shmem_helper.h Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 172

[PATCH v14 09/12] drm/panfrost: Switch to generic memory shrinker

2023-07-22 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| 4

[PATCH v14 04/12] drm/shmem-helper: Factor out unpinning part from drm_gem_shmem_purge()

2023-07-22 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 v14 03/12] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2023-07-22 Thread Dmitry Osipenko
ile the new pages_pin_count will 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 --

[PATCH v14 05/12] drm/shmem-helper: Add memory shrinker

2023-07-22 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 v14 01/12] drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages()

2023-07-22 Thread Dmitry Osipenko
off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 65 -- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index a783d2245599..267153853e2c 100644 --- a/drivers/gpu/

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

2023-07-22 Thread Dmitry Osipenko
-b's that were given to v10. v10:- Was partially applied to misc-fixes/next. https://lore.kernel.org/dri-devel/6c16f303-81df-7ebe-85e9-51bb40a8b...@collabora.com/T/ Dmitry Osipenko (12): drm/shmem-helper: Factor out pages alloc/release from drm_gem_shmem_get/put_pages() drm/shmem-

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

2023-07-19 Thread Dmitry Osipenko
27.06.2023 15:01, Geert Uytterhoeven пишет: > Hi Dmitry, > > On Mon, Jun 26, 2023 at 6:11 PM Dmitry Osipenko > wrote: >> On 6/25/23 18:36, Geert Uytterhoeven wrote: >>> On Sun, Jun 25, 2023 at 2:41 PM Dmitry Osipenko >>> wrote: >>>> On 6/25/23 11

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

2023-07-19 Thread Dmitry Osipenko
27.06.2023 20:16, Rob Clark пишет: ... >> Now these are just suggestions, and while I think they are good, you can >> safely ignore them. >> >> But there's also the DRM requirements, which state "userspace side must be >> fully reviewed and tested to the standards of that user-space project.".

Re: [PATCH v1] drm/panfrost: Sync IRQ by job's timeout handler

2023-07-17 Thread Dmitry Osipenko
17.07.2023 11:59, Steven Price пишет: > On 17/07/2023 09:49, Boris Brezillon wrote: >> On Mon, 17 Jul 2023 09:06:56 +0100 >> Steven Price wrote: >> >>> On 17/07/2023 08:49, Boris Brezillon wrote: >>>> On Mon, 17 Jul 2023 10:20:02 +0300 >

[PATCH v1] MAINTAINERS: Add Boris Brezillon as Panfrost driver maintainer

2023-07-17 Thread Dmitry Osipenko
. Signed-off-by: Dmitry Osipenko --- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 5d6536fef2fc..08dc75916148 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1615,9 +1615,8 @@ F:drivers/gpu/drm/arm/display/komeda/ ARM MALI

Re: [PATCH v1] drm/panfrost: Sync IRQ by job's timeout handler

2023-07-17 Thread Dmitry Osipenko
Hi, On 7/17/23 10:05, Boris Brezillon wrote: > Hi Dmitry, > > On Mon, 17 Jul 2023 09:52:54 +0300 > Dmitry Osipenko wrote: > >> Panfrost IRQ handler may stuck for a long time, for example this happens >> when there is a bad HDMI connection and HDMI handler tak

[PATCH v1] drm/panfrost: Sync IRQ by job's timeout handler

2023-07-17 Thread Dmitry Osipenko
job timeouts due to a slow IRQ processing. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/panfrost_job.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index dbc597ab46fb..a356163da22d 100644

Re: [PATCH v4] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-09 Thread Dmitry Osipenko
08.07.2023 00:31, Gurchetan Singh пишет: > We don't want to create a fence for every command submission. It's > only necessary when userspace provides a waitable token for submission. > This could be: > > 1) bo_handles, to be used with VIRTGPU_WAIT > 2) out_fence_fd, to be used with dma_fence

Re: [PATCH v4] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-09 Thread Dmitry Osipenko
return err; > + } > } > > submit->out_fence = out_fence; Another small note for the future is that you should always start a new email thread for every new version of the patch, i.e. don't reply with new version to the old thread. This is not a problem here since it's just a single patch, nevertheless please take it into account later on. It eases patch tracking for reviewers. I tested v4, including the applied CL4605854 to Sommilier. Everything works well as before. Thank you for addressing all the issues. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko -- Best regards, Dmitry

Re: [PATCH v3] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-07 Thread Dmitry Osipenko
On 7/7/23 20:59, Gurchetan Singh wrote: /// >>> Previously, when VIRTGPU_EXECBUF_RING_IDX flag wasn't specified, the >>> fence event was created for a default ring_idx=0. Now you changed this >>> behaviour and event will never be created without >>> VIRTGPU_EXECBUF_RING_IDX flag being set. > >

Re: [PATCH v3] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-07 Thread Dmitry Osipenko
On 7/7/23 20:04, Dmitry Osipenko wrote: > On 7/7/23 18:43, Gurchetan Singh wrote: >> @@ -161,21 +157,27 @@ static int virtio_gpu_init_submit(struct >> virtio_gpu_submit *submit, >>struct drm_file *file, >>

Re: [PATCH v3] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-07 Thread Dmitry Osipenko
On 7/7/23 18:43, Gurchetan Singh wrote: > @@ -161,21 +157,27 @@ static int virtio_gpu_init_submit(struct > virtio_gpu_submit *submit, > struct drm_file *file, > u64 fence_ctx, u32 ring_idx) > { > + int err; > + struct

Re: [PATCH v2] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-06 Thread Dmitry Osipenko
On 7/7/23 05:53, Dmitry Osipenko wrote: > On 7/7/23 05:49, Dmitry Osipenko wrote: >> On 6/28/23 18:58, Gurchetan Singh wrote: >>> @@ -168,9 +168,13 @@ static int virtio_gpu_init_submit(struct >>> virtio_gpu_submit *submit, >>> >>> memset(submit,

Re: [PATCH v2] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-06 Thread Dmitry Osipenko
On 7/7/23 05:49, Dmitry Osipenko wrote: > On 6/28/23 18:58, Gurchetan Singh wrote: >> @@ -168,9 +168,13 @@ static int virtio_gpu_init_submit(struct >> virtio_gpu_submit *submit, >> >> memset(submit, 0, sizeof(*submit)); >> >> -out_fence =

Re: [PATCH v2] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-06 Thread Dmitry Osipenko
On 6/28/23 18:58, Gurchetan Singh wrote: > @@ -168,9 +168,13 @@ static int virtio_gpu_init_submit(struct > virtio_gpu_submit *submit, > > memset(submit, 0, sizeof(*submit)); > > - out_fence = virtio_gpu_fence_alloc(vgdev, fence_ctx, ring_idx); > - if (!out_fence) > -

Re: [PATCH v2] drm/virtio: conditionally allocate virtio_gpu_fence

2023-07-05 Thread Dmitry Osipenko
gt;num_bo_handles) >> + out_fence = virtio_gpu_fence_alloc(vgdev, fence_ctx, >> ring_idx); >> + else >> + out_fence = NULL; >> >> err = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx); >> if (err) { >> -- > > Ping for additional reviews or merge. I tested this patch with virgl,venus and nctx. No problems spotted. Going to apply it tomorrow if there won't be additional comments from anyone. Tested-by: Dmitry Osipenko -- Best regards, Dmitry

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

2023-06-26 Thread Dmitry Osipenko
On 6/25/23 18:36, Geert Uytterhoeven wrote: > Hi Dmitry, > > On Sun, Jun 25, 2023 at 2:41 PM Dmitry Osipenko > wrote: >> On 6/25/23 11:47, Geert Uytterhoeven wrote: >>> On Sun, Apr 16, 2023 at 1:55 PM Dmitry Osipenko >>> wrote: >>>> Add sync ob

Re: [PATCH 1/5] drm/panfrost: Stop using drm_gem_shmem_put_pages()

2023-06-26 Thread Dmitry Osipenko
On 6/26/23 18:43, Boris Brezillon wrote: > On Mon, 26 Jun 2023 16:20:53 +0300 > Dmitry Osipenko wrote: > >> On 6/26/23 15:02, Boris Brezillon wrote: >>> -err_pages: >>> - drm_gem_shmem_put_pages(>base); >>> err_unlock: >>> dma_r

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

2023-06-26 Thread Dmitry Osipenko
On 6/26/23 18:21, Boris Brezillon wrote: > On Mon, 26 Jun 2023 17:04:57 +0200 > Boris Brezillon wrote: > >> Hi Dmitry, >> >> Sorry for chiming in only now :-/. >> >> On Tue, 14 Mar 2023 05:26:52 +0300 >> Dmitry Osipenko wrote: >> >>>

Re: [PATCH 1/5] drm/panfrost: Stop using drm_gem_shmem_put_pages()

2023-06-26 Thread Dmitry Osipenko
On 6/26/23 15:02, Boris Brezillon wrote: > -err_pages: > - drm_gem_shmem_put_pages(>base); > err_unlock: > dma_resv_unlock(obj->resv); > + > + if (ret && pinned) > + drm_gem_shmem_unpin(>base); The drm_gem_shmem_unpin() was supposed to be used only in conjunction with

Re: [PATCH v4 6/6] drm/shmem-helper: Switch to reservation lock

2023-06-26 Thread Dmitry Osipenko
On 6/26/23 12:40, Boris Brezillon wrote: > I think here is the major problem I have with this patch: you've made > drm_gem_shmem_{get_pages,pin}() private, which forces me to call > drm_gem_shmem_pin() in a path where I already acquired the resv lock > (using the drm_exec infra proposed by

Re: [PATCH v4 6/6] drm/shmem-helper: Switch to reservation lock

2023-06-26 Thread Dmitry Osipenko
On 6/26/23 12:40, Boris Brezillon wrote: > Same problem with this renaming: it's confusing because this function > was previously taking care of the locking, and it's no longer the case. > That's actually true for other public functions your patching, but I > won't go over all of them. > > I know

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

2023-06-25 Thread Dmitry Osipenko
On 6/25/23 11:47, Geert Uytterhoeven wrote: > Hi Dmitry, > > On Sun, Apr 16, 2023 at 1:55 PM 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 >&

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

2023-06-21 Thread Dmitry Osipenko
On 5/30/23 01:39, 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 the d

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

2023-06-21 Thread Dmitry Osipenko
On 6/21/23 08:42, Christian König wrote: > Am 20.06.23 um 17:58 schrieb Dmitry Osipenko: >> On 5/31/23 22:58, Dmitry Osipenko wrote: >>> On 5/30/23 01:39, Dmitry Osipenko wrote: >>>> Change locking policy of mmap() callback, making exporters responsible >>

Re: [PATCH v4 2/6] dma-buf/heaps: Don't assert held reservation lock for dma-buf mmapping

2023-06-21 Thread Dmitry Osipenko
Hi, On 6/21/23 20:21, T.J. Mercier wrote: > On Mon, May 29, 2023 at 3:46 PM Dmitry Osipenko > wrote: >> >> 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 t

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

2023-06-20 Thread Dmitry Osipenko
On 5/31/23 22:58, Dmitry Osipenko wrote: > On 5/30/23 01:39, 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 im

Re: [PATCH] drm/virtio: conditionally allocate virtio_gpu_fence

2023-06-19 Thread Dmitry Osipenko
On 6/13/23 20:43, Gurchetan Singh wrote: > We don't want to create a fence for every command submission. It's > only necessary when userspace provides a waitable token for submission. > This could be: > > 1) bo_handles, to be used with VIRTGPU_WAIT > 2) out_fence_fd, to be used with dma_fence

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

2023-06-02 Thread Dmitry Osipenko
> Dmitry Osipenko (3): > drm/virtio: Refactor and optimize job submission code path > drm/virtio: Wait for each dma-fence of in-fence array individually Applied these two patches to misc-next. The syncobj patch will wait for the turnip Mesa MR. -- Best regards, Dmitry

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

2023-05-31 Thread Dmitry Osipenko
On 5/30/23 01:39, 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

[PATCH v4 6/6] drm/shmem-helper: Switch to reservation lock

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

[PATCH v4 4/6] drm: Don't assert held reservation lock for dma-buf mmapping

2023-05-29 Thread Dmitry Osipenko
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/drm_prime.c

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

2023-05-29 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 v4 2/6] dma-buf/heaps: Don't assert held reservation lock for dma-buf mmapping

2023-05-29 Thread Dmitry Osipenko
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 --- drivers/dma

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

2023-05-29 Thread Dmitry Osipenko
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 changed, 2

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

2023-05-29 Thread Dmitry Osipenko
ggested 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 is used for all locks/unlocks. Dmitry Osipenko (6): media: videobuf2: Don't assert held reservation

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

2023-05-29 Thread Dmitry Osipenko
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 Reviewed-by: Hans Verkuil Signed-off-by: Dmitry Osipenko --- drivers/media/common/videobuf2

Re: [PATCH v3 6/6] drm/shmem-helper: Switch to reservation lock

2023-05-29 Thread Dmitry Osipenko
On 5/22/23 16:02, Emil Velikov wrote: >> -void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem) >> +static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem) >> +{ >> + int ret; >> + >> + dma_resv_assert_held(shmem->base.resv); >> + >> + ret =

Re: [PATCH v3 6/6] drm/shmem-helper: Switch to reservation lock

2023-05-22 Thread Dmitry Osipenko
On 5/22/23 16:02, Emil Velikov wrote: > Hi Dmitry, > > Saw v3 fly by, so I had a quick look. Original RB still stands, > although I noticed a couple of non-blocking nitpicks. > > On Sun, 21 May 2023 at 22:00, Dmitry Osipenko > wrote: > >> -static int drm_gem

[PATCH v3 6/6] drm/shmem-helper: Switch to reservation lock

2023-05-21 Thread Dmitry Osipenko
-by: 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 v3 5/6] dma-buf: Change locking policy for mmap()

2023-05-21 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 v3 4/6] drm: Don't assert held reservation lock for dma-buf mmapping

2023-05-21 Thread Dmitry Osipenko
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/drm_prime.c

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

2023-05-21 Thread Dmitry Osipenko
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 --- drivers/dma

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

2023-05-21 Thread Dmitry Osipenko
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 changed, 2

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

2023-05-21 Thread Dmitry Osipenko
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 Reviewed-by: Hans Verkuil Signed-off-by: Dmitry Osipenko --- drivers/media/common/videobuf2

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

2023-05-21 Thread Dmitry Osipenko
esv). Now shmem->base.resv variant is used for all locks/unlocks. Dmitry Osipenko (6): media: videobuf2: Don't assert held reservation lock for dma-buf mmapping dma-buf/heaps: Don't assert held reservation lock for dma-buf mmapping udmabuf: Don't assert held reservation lock for

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

2023-05-11 Thread Dmitry Osipenko
On 5/12/23 03:17, Gurchetan Singh wrote: ... > Can we get one of the Mesa MRs reviewed first? There's currently no > virtio-intel MR AFAICT, and the amdgpu one is marked as "Draft:". > > Even for the amdgpu, Pierre suggests the feature "will be marked as > experimental both in Mesa and

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
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/virtio/Makefile

[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
pcoming 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-fence array individ

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

2023-04-16 Thread Dmitry Osipenko
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 84e7c4d9d8c7

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
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 100644

[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

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