Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Christian König" <christian.koenig@amd.com>,
	daniel@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
	maarten.lankhorst@linux.intel.com, sumit.semwal@linaro.org,
	dmitry.osipenko@collabora.com, robdclark@gmail.com,
	quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org,
	sean@poorly.run, marijn.suijten@somainline.org,
	suijingfeng@loongson.cn, kherbst@redhat.com, lyude@redhat.com,
	dakr@redhat.com, airlied@redhat.com, kraxel@redhat.com,
	alexander.deucher@amd.com, Xinhui.Pan@amd.com,
	zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com
Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	virtualization@lists.linux.dev,
	spice-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 00/13] drm: Fix reservation locking for pin/unpin and console
Date: Tue, 27 Feb 2024 16:42:19 +0100	[thread overview]
Message-ID: <a95795f7-779a-4468-a3bc-d41ea5ebfaf6@suse.de> (raw)
In-Reply-To: <86907cb5-553e-469c-b23e-52ef2e5e22ba@amd.com>

Hi

Am 27.02.24 um 15:03 schrieb Christian König:
> Nice, looks totally valid to me.
>
> Feel free to add to patch #2, #9, #10, #11 and #12 Reviewed-by: 
> Christian König <christian.koenig@amd.com>
>
> And Acked-by: Christian König <christian.koenig@amd.com> to the rest.

Oh, wow. That was quick! Thanks a lot.

Best regards
Thomas

>
> Regards,
> Christian.
>
> Am 27.02.24 um 11:14 schrieb Thomas Zimmermann:
>> Dma-buf locking semantics require the caller of pin and unpin to hold
>> the buffer's reservation lock. Fix DRM to adhere to the specs. This
>> enables to fix the locking in DRM's console emulation. Similar changes
>> for vmap and mmap have been posted at [1][2]
>>
>> Most DRM drivers and memory managers acquire the buffer object's
>> reservation lock within their GEM pin and unpin callbacks. This
>> violates dma-buf locking semantics. We get away with it because PRIME
>> does not provide pin/unpin, but attach/detach, for which the locking
>> semantics is correct.
>>
>> Patches 1 to 8 rework DRM GEM code in various implementations to
>> acquire the reservation lock when entering the pin and unpin callbacks.
>> This prepares them for the next patch. Drivers that are not affected
>> by these patches either don't acquire the reservation lock (amdgpu)
>> or don't need preparation (loongson).
>>
>> Patch 9 moves reservation locking from the GEM pin/unpin callbacks
>> into drm_gem_pin() and drm_gem_unpin(). As PRIME uses these functions
>> internally it still gets the reservation lock.
>>
>> With the updated GEM callbacks, the rest of the patchset fixes the
>> fbdev emulation's buffer locking. Fbdev emulation needs to keep its
>> GEM buffer object inplace while updating its content. This required
>> a implicit pinning and apparently amdgpu didn't do this at all.
>>
>> Patch 10 introduces drm_client_buffer_vmap_local() and _vunmap_local().
>> The former function map a GEM buffer into the kernel's address space
>> with regular vmap operations, but keeps holding the reservation lock.
>> The _vunmap_local() helper undoes the vmap and releases the lock. The
>> updated GEM callbacks make this possible. Between the two calls, the
>> fbdev emulation can update the buffer content without have the buffer
>> moved or evicted. Update fbdev-generic to use vmap_local helpers,
>> which fix amdgpu. The idea of adding a "local vmap" has previously been
>> attempted at [3] in a different form.
>>
>> Patch 11 adds implicit pinning to the DRM client's regular vmap
>> helper so that long-term vmap'ed buffers won't be evicted. This only
>> affects fbdev-dma, but GEM DMA helpers don't require pinning. So
>> there are no practical changes.
>>
>> Patches 12 and 13 remove implicit pinning from the vmap and vunmap
>> operations in gem-vram and qxl. These pin operations are not supposed
>> to be part of vmap code, but were required to keep the buffers in place
>> for fbdev emulation. With the conversion o ffbdev-generic to to
>> vmap_local helpers, that code can finally be removed.
>>
>> Tested with amdgpu, nouveau, radeon, simpledrm and vc4.
>>
>> [1] https://patchwork.freedesktop.org/series/106371/
>> [2] https://patchwork.freedesktop.org/series/116001/
>> [3] https://patchwork.freedesktop.org/series/84732/
>>
>> Thomas Zimmermann (13):
>>    drm/gem-shmem: Acquire reservation lock in GEM pin/unpin callbacks
>>    drm/gem-vram: Acquire reservation lock in GEM pin/unpin callbacks
>>    drm/msm: Provide msm_gem_get_pages_locked()
>>    drm/msm: Acquire reservation lock in GEM pin/unpin callback
>>    drm/nouveau: Provide nouveau_bo_{pin,unpin}_locked()
>>    drm/nouveau: Acquire reservation lock in GEM pin/unpin callbacks
>>    drm/qxl: Provide qxl_bo_{pin,unpin}_locked()
>>    drm/qxl: Acquire reservation lock in GEM pin/unpin callbacks
>>    drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}()
>>    drm/fbdev-generic: Fix locking with drm_client_buffer_vmap_local()
>>    drm/client: Pin vmap'ed GEM buffers
>>    drm/gem-vram: Do not pin buffer objects for vmap
>>    drm/qxl: Do not pin buffer objects for vmap
>>
>>   drivers/gpu/drm/drm_client.c            |  92 ++++++++++++++++++---
>>   drivers/gpu/drm/drm_fbdev_generic.c     |   4 +-
>>   drivers/gpu/drm/drm_gem.c               |  34 +++++++-
>>   drivers/gpu/drm/drm_gem_shmem_helper.c  |   6 +-
>>   drivers/gpu/drm/drm_gem_vram_helper.c   | 101 ++++++++++--------------
>>   drivers/gpu/drm/drm_internal.h          |   2 +
>>   drivers/gpu/drm/loongson/lsdc_gem.c     |  13 +--
>>   drivers/gpu/drm/msm/msm_gem.c           |  20 ++---
>>   drivers/gpu/drm/msm/msm_gem.h           |   4 +-
>>   drivers/gpu/drm/msm/msm_gem_prime.c     |  20 +++--
>>   drivers/gpu/drm/nouveau/nouveau_bo.c    |  43 +++++++---
>>   drivers/gpu/drm/nouveau/nouveau_bo.h    |   2 +
>>   drivers/gpu/drm/nouveau/nouveau_prime.c |   8 +-
>>   drivers/gpu/drm/qxl/qxl_object.c        |  26 +++---
>>   drivers/gpu/drm/qxl/qxl_object.h        |   2 +
>>   drivers/gpu/drm/qxl/qxl_prime.c         |   4 +-
>>   drivers/gpu/drm/radeon/radeon_prime.c   |  11 ---
>>   drivers/gpu/drm/vmwgfx/vmwgfx_gem.c     |  25 ++----
>>   include/drm/drm_client.h                |  10 +++
>>   include/drm/drm_gem.h                   |   3 +
>>   include/drm/drm_gem_shmem_helper.h      |   7 +-
>>   21 files changed, 265 insertions(+), 172 deletions(-)
>>
>>
>> base-commit: 7291e2e67dff0ff573900266382c9c9248a7dea5
>> prerequisite-patch-id: bdfa0e6341b30cc9d7647172760b3473007c1216
>> prerequisite-patch-id: bc27ac702099f481890ae2c7c4a9c531f4a62d64
>> prerequisite-patch-id: f5d4bf16dc45334254527c2e31ee21ba4582761c
>> prerequisite-patch-id: 734c87e610747779aa41be12eb9e4c984bdfa743
>> prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
>> prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
>> prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


  reply	other threads:[~2024-02-27 15:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 10:14 [PATCH 00/13] drm: Fix reservation locking for pin/unpin and console Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 01/13] drm/gem-shmem: Acquire reservation lock in GEM pin/unpin callbacks Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 02/13] drm/gem-vram: " Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 03/13] drm/msm: Provide msm_gem_get_pages_locked() Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 04/13] drm/msm: Acquire reservation lock in GEM pin/unpin callback Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 05/13] drm/nouveau: Provide nouveau_bo_{pin,unpin}_locked() Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 06/13] drm/nouveau: Acquire reservation lock in GEM pin/unpin callbacks Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 07/13] drm/qxl: Provide qxl_bo_{pin,unpin}_locked() Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 08/13] drm/qxl: Acquire reservation lock in GEM pin/unpin callbacks Thomas Zimmermann
2024-02-28  3:47   ` Zack Rusin
2024-02-27 10:14 ` [PATCH 09/13] drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}() Thomas Zimmermann
2024-02-28  3:52   ` Zack Rusin
2024-03-11 21:51   ` [09/13] " Sui Jingfeng
2024-02-27 10:14 ` [PATCH 10/13] drm/fbdev-generic: Fix locking with drm_client_buffer_vmap_local() Thomas Zimmermann
2024-03-11 22:36   ` [10/13] " Sui Jingfeng
2024-02-27 10:14 ` [PATCH 11/13] drm/client: Pin vmap'ed GEM buffers Thomas Zimmermann
2024-02-27 10:14 ` [PATCH 12/13] drm/gem-vram: Do not pin buffer objects for vmap Thomas Zimmermann
2024-02-27 10:15 ` [PATCH 13/13] drm/qxl: " Thomas Zimmermann
2024-02-27 14:03 ` [PATCH 00/13] drm: Fix reservation locking for pin/unpin and console Christian König
2024-02-27 15:42   ` Thomas Zimmermann [this message]
2024-02-27 18:14 ` Dmitry Osipenko
2024-02-27 18:33   ` Christian König
2024-02-28  8:19   ` Thomas Zimmermann
2024-03-01 16:44     ` Dmitry Osipenko
2024-02-28  3:54 ` Zack Rusin
2024-03-05 21:58 ` Dmitry Osipenko
2024-03-06 14:44   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a95795f7-779a-4468-a3bc-d41ea5ebfaf6@suse.de \
    --to=tzimmermann@suse.de \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=spice-devel@lists.freedesktop.org \
    --cc=suijingfeng@loongson.cn \
    --cc=sumit.semwal@linaro.org \
    --cc=virtualization@lists.linux.dev \
    --cc=zack.rusin@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox