rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: "Danilo Krummrich" <dakr@kernel.org>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	Steven Price <steven.price@arm.com>,
	 Daniel Almeida <daniel.almeida@collabora.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3 1/2] drm/gpuvm: add deferred vm_bo cleanup
Date: Mon, 6 Oct 2025 13:30:59 +0200	[thread overview]
Message-ID: <CAH5fLgipghDp3W+Gr0YfHT0HOp3vcF+mfBAbtiAiLOKRYt43Sw@mail.gmail.com> (raw)
In-Reply-To: <20251001-vmbo-defer-v3-1-a3fe6b6ae185@google.com>

On Wed, Oct 1, 2025 at 12:41 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> When using GPUVM in immediate mode, it is necessary to call
> drm_gpuvm_unlink() from the fence signalling critical path. However,
> unlink may call drm_gpuvm_bo_put(), which causes some challenges:
>
> 1. drm_gpuvm_bo_put() often requires you to take resv locks, which you
>    can't do from the fence signalling critical path.
> 2. drm_gpuvm_bo_put() calls drm_gem_object_put(), which is often going
>    to be unsafe to call from the fence signalling critical path.
>
> To solve these issues, add a deferred version of drm_gpuvm_unlink() that
> adds the vm_bo to a deferred cleanup list, and then clean it up later.
>
> The new methods take the GEMs GPUVA lock internally rather than letting
> the caller do it because it also needs to perform an operation after
> releasing the mutex again. This is to prevent freeing the GEM while
> holding the mutex (more info as comments in the patch). This means that
> the new methods can only be used with DRM_GPUVM_IMMEDIATE_MODE.
>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>

In this version, I got rid of the kref_put_mutex() usage, but I
realized that maybe we should bring it back. With the current code,
it's actually possible to observe a zombie vm_bo in the GEM's list
because we don't drop the refcount while holding the mutex.

Alice

  parent reply	other threads:[~2025-10-06 11:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01 10:41 [PATCH v3 0/2] Defer vm_bo cleanup in GPUVM with DRM_GPUVM_IMMEDIATE_MODE Alice Ryhl
2025-10-01 10:41 ` [PATCH v3 1/2] drm/gpuvm: add deferred vm_bo cleanup Alice Ryhl
2025-10-01 11:27   ` Boris Brezillon
2025-10-01 11:45     ` Alice Ryhl
2025-10-01 12:04       ` Boris Brezillon
2025-10-01 12:13         ` Boris Brezillon
2025-10-01 12:22           ` Alice Ryhl
2025-10-01 13:01             ` Boris Brezillon
2025-10-01 14:01   ` Danilo Krummrich
2025-10-01 14:42     ` Alice Ryhl
2025-10-01 15:13       ` Boris Brezillon
2025-10-06 11:31         ` Alice Ryhl
2025-10-06 11:41           ` Boris Brezillon
2025-10-06 11:49             ` Alice Ryhl
2025-10-06 11:30   ` Alice Ryhl [this message]
2025-10-06 11:38     ` Boris Brezillon
2025-10-01 10:41 ` [PATCH v3 2/2] panthor: use drm_gpuva_unlink_defer() Alice Ryhl
2025-10-01 11:31   ` Boris Brezillon

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=CAH5fLgipghDp3W+Gr0YfHT0HOp3vcF+mfBAbtiAiLOKRYt43Sw@mail.gmail.com \
    --to=aliceryhl@google.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).