From: Boris Brezillon <boris.brezillon@collabora.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Qiang Yu" <yuq825@gmail.com>,
"Steven Price" <steven.price@arm.com>,
"Frank Binns" <frank.binns@imgtec.com>,
"Matt Coster" <matt.coster@imgtec.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin
Date: Mon, 7 Apr 2025 11:56:54 +0200 [thread overview]
Message-ID: <20250407115654.761ddaa6@collabora.com> (raw)
In-Reply-To: <edf93bc7-3289-4b1c-9698-e5e2cc5a6910@suse.de>
On Fri, 4 Apr 2025 16:58:20 +0200
Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 04.04.25 um 16:52 schrieb Boris Brezillon:
> > On Fri, 4 Apr 2025 10:01:50 +0200
> > Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >
> >>>> In your case, vmap an pin both intent to hold the shmem pages in memory.
> >>>> They might be build on top of the same implementation, but one should
> >>>> not be implemented with the other because of their different meanings.
> >>> But that's not what we do, is it? Sure, in drm_gem_shmem_vmap_locked(),
> >>> we call drm_gem_shmem_pin_locked(), but that's an internal function to
> >>> make sure the pages are allocated and stay around until
> >>> drm_gem_shmem_vunmap_locked() is called.
> >>>
> >>> I guess we could rename pin_count into hard_refcount or
> >>> page_residency_count or xxx_count, and change the pin/unpin_locked()
> >>> function names accordingly, but that's just a naming detail, it doesn't
> >>> force you to call drm_gem_pin() to vmap() your GEM, it's something we
> >>> do internally.
> >> Such a rename would be much appreciated. page_residency_count seems
> >> appropriate.
> > On a second thought, I think I prefer
> > 'unevictable_count/inc_unevictable()/dec_unevictable()'. But looking at
>
> Ok
>
> > the gem-vram changes you just posted, it looks like gem-shmem is not the
> > only one to use the term 'pin' for this page pinning thing, so if we go
> > and plan for a rename, I'd rather make it DRM-wide than gem-shmem being
> > the outlier yet again :-).
>
> Which one do you mean?
>
> - The code in gem-vram does pinning in the TTM sense of the term.
Sorry, but I still don't see why pinning should be a TTM only thing. If
I read the doc of drm_gem_vram_pin():
"
Pinning a buffer object ensures that it is not evicted from a memory
region. A pinned buffer object has to be unpinned before it can be
pinned to another region. If the pl_flag argument is 0, the buffer is
pinned at its current location (video RAM or system memory).
"
And this pinning is not so different from the pinning we have in
gem-shmem: making buffer object memory unevictable/unmovable.
>
> - From the client code, the pinning got removed.
>
> - The GEM pin/unpin callbacks are still there, but the long-term plan is
> to go to dma-buf pin callbacks AFAICT.
>
> - Renaming the dma-buf pin/unpin would be a kernel-wide change. Not
> likely to happen.
Again, I'm not sure why we'd want to do that anyway. Just because the
TTM pinning semantics might be slightly different from the
GEM/dma-buf ones doesn't mean the pinning term should be
prohibited outside the TTM scope. The concept of pinning is pretty
generic and applies to system memory too AFAICT.
next prev parent reply other threads:[~2025-04-07 9:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-22 21:25 [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Dmitry Osipenko
2025-03-22 21:25 ` [PATCH v20 01/10] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names Dmitry Osipenko
2025-03-24 13:05 ` Christian König
2025-03-25 13:15 ` Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 02/10] drm/gem: Add _locked postfix to functions that have unlocked counterpart Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 03/10] drm/gem: Document locking rule of vmap and evict callbacks Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 04/10] drm/shmem-helper: Make all exported symbols GPL Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 05/10] drm/shmem-helper: Refactor locked/unlocked functions Dmitry Osipenko
2025-03-27 11:25 ` Jani Nikula
2025-03-27 11:27 ` Jani Nikula
2025-03-27 11:29 ` Jani Nikula
2025-03-22 21:26 ` [PATCH v20 06/10] drm/shmem-helper: Remove obsoleted is_iomem test Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 07/10] drm/shmem-helper: Add and use pages_pin_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 08/10] drm/shmem-helper: Use refcount_t for pages_use_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin Dmitry Osipenko
2025-04-02 12:47 ` Thomas Zimmermann
2025-04-02 12:58 ` Dmitry Osipenko
2025-04-02 13:21 ` Boris Brezillon
2025-04-03 7:20 ` Thomas Zimmermann
2025-04-03 8:50 ` Boris Brezillon
2025-04-04 8:01 ` Thomas Zimmermann
2025-04-04 14:52 ` Boris Brezillon
2025-04-04 14:58 ` Thomas Zimmermann
2025-04-07 9:56 ` Boris Brezillon [this message]
2025-03-22 21:26 ` [PATCH v20 10/10] drm/shmem-helper: Use refcount_t for vmap_use_count Dmitry Osipenko
2025-03-25 14:17 ` [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Thomas Zimmermann
2025-03-26 20:08 ` Dmitry Osipenko
2025-03-27 10:45 ` Boris Brezillon
2025-03-27 10:47 ` Dmitry Osipenko
2025-04-03 0:37 ` Lucas De Marchi
2025-04-03 7:03 ` Thomas Zimmermann
2025-04-03 14:10 ` Dmitry Osipenko
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=20250407115654.761ddaa6@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=frank.binns@imgtec.com \
--cc=kernel@collabora.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matt.coster@imgtec.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
--cc=yuq825@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.