On Tue, Feb 27, 2024 at 6:39 AM Thomas Zimmermann wrote:
>
> Acquire the reservation lock directly in GEM pin callback. Same for
> unpin. Prepares for further changes.
>
> Dma-buf locking semantics require callers to hold the buffer's
> reservation lock when invoking the pin and unpin callbacks. P
m_gem_object *obj)
> {
> - vmw_gem_pin_private(obj, false);
> + struct vmw_bo *vbo = to_vmw_bo(obj);
> +
> + vmw_bo_pin_reserved(vbo, false);
> }
>
> static struct sg_table *vmw_gem_object_get_sg_table(struct drm_gem_object
> *obj)
> diff --git a/include/drm/drm_gem_shmem_helper.h
> b/include/drm/drm_gem_shmem_helper.h
> index eb12aa9a8c556..efbc9f27312b5 100644
> --- a/include/drm/drm_gem_shmem_helper.h
> +++ b/include/drm/drm_gem_shmem_helper.h
> @@ -175,15 +175,8 @@ static inline void
> drm_gem_shmem_object_print_info(struct drm_printer *p, unsign
> static inline int drm_gem_shmem_object_pin(struct drm_gem_object *obj)
> {
> struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
> - int ret;
>
> - ret = dma_resv_lock_interruptible(shmem->base.resv, NULL);
> - if (ret)
> - return ret;
> - ret = drm_gem_shmem_pin_locked(shmem);
> - dma_resv_unlock(shmem->base.resv);
> -
> - return ret;
> + return drm_gem_shmem_pin_locked(shmem);
> }
>
> /**
> @@ -197,9 +190,7 @@ static inline void drm_gem_shmem_object_unpin(struct
> drm_gem_object *obj)
> {
> struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
>
> - dma_resv_lock(shmem->base.resv, NULL);
> drm_gem_shmem_unpin_locked(shmem);
> - dma_resv_unlock(shmem->base.resv);
> }
>
>
Ah, I see. Looks great.
Reviewed-by: Zack Rusin
1f4a62d64
> prerequisite-patch-id: f5d4bf16dc45334254527c2e31ee21ba4582761c
> prerequisite-patch-id: 734c87e610747779aa41be12eb9e4c984bdfa743
> prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
> prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
> prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36
> --
> 2.43.2
>
That's a really nice cleanup! I already gave a r-b for 9/13. For the rest:
Acked-by: Zack Rusin
z
; (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
> functions).
>
> As found with Coccinelle[1], add __counted_by for struct vmw_surface_dirty.
>
> [1]
> https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Zack Ru