[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7D78A0E7-9CA7-4E04-AD55-11254DF66ED8@collabora.com>
Date: Wed, 25 Jun 2025 16:16:36 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>
Cc: linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org,
Asahi Lina <lina+kernel@...hilina.net>
Subject: Re: [PATCH] rust: drm: mm: Add DRM MM Range Allocator abstraction
Hmm, this has an issue
[..]
>
> +impl<A: AllocInner<T>, T> Drop for MmInner<A, T> {
> + fn drop(&mut self) {
> + // SAFETY: If the MmInner is dropped then all nodes are gone (since they hold references),
> + // so it is safe to tear down the allocator.
> + unsafe {
> + bindings::drm_mm_takedown(self.0.get());
> + }
> + }
> +}
> +
>
Where the docs for drm_mm_takedown states:
/**
* drm_mm_takedown - clean up a drm_mm allocator
* @mm: drm_mm allocator to clean up
*
* Note that it is a bug to call this function on an allocator which is not
* clean.
*/
void drm_mm_takedown(struct drm_mm *mm)
{
if (WARN(!drm_mm_clean(mm),
"Memory manager not clean during takedown.\n"))
show_leaks(mm);
}
EXPORT_SYMBOL(drm_mm_takedown);
So perhaps we should remove all nodes before takedown?
This covers the error path, i.e.: something failed somewhere else and the allocator is dirty.
— Daniel
Powered by blists - more mailing lists