mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Janne Grunau <j@jannau.net>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>, "Janne Grunau" <j@jananu.net>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Lyude Paul" <lyude@redhat.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev,
	stable+noautosel@kernel.org
Subject: Re: [PATCH 0/3] Fix import of dma-buf buffers as DRM GEM shmem objects
Date: Mon, 16 Nov 2026 16:01:08 -0700	[thread overview]
Message-ID: <avuLNHy3bNAUpzNv@um790> (raw)
In-Reply-To: <20261026-rust-drm-gem-shmem-imported-sgt-v1-0-36f15ace04b1@jannau.net>

On Mon, Oct 26, 2026 at 12:14:07PM +0100, Janne Grunau wrote:
> Hej,
> 
> this is triggered by the discussion of gem/shmem.rs SGTableMap issues
> in [1] which has an additional issue with imported object.
> Imported objects are supported since GEM shmem's AllocOps use
> drm_gem_shmem_prime_import_sg_table() as gem_prime_import_sg_table which
> sets the same function pointer field in struct drm_driver.
> 
> The code is broken in two ways. SGTableMap::drop() calls
> __drm_gem_shmem_free_sgt_locked() uncondiftionally which it must not do
> for imported objects as the object does not own `sgt`.
> The second issue is that the imported object is allocated by
> __drm_gem_shmem_create() with sizeof(struct drm_gem_shmem_object) as
> size instead of the size of Rust's Object<T>.
> 
> The second issue is already fixed in tyr's downstream driver by adding a
> `gem_create_object` callback which is used instead of the minimal
> allocation in the C helper.
> The first issue is fixed in the Asahi downstream driver together with a
> drm_gem_is_imported() wrapper change taken from the tyr downstream
> driver.
> 
> All three patches are tested in the Asahi downstream driver. As this is
> unused code in-tree I marked the fixes as not suitable for stable
> backports. The known downstream users of the code are aware of the
> issues and carry fixes downstream. I don't expect new Rust DRM drivers
> to be based on the (old) stable trees.

Thank you Janne for this. The second issue was recently flagged
by sashiko [1] as a critical memory bug that needs to be addressed
before we upstream tyr's ioctl series [2]. I checked that this series
on my Rock5B with the proposed ioctl series and igt-gpu-tools
tests that exercise some of the panthor uapi and everything looks good.

For the whole series:
Tested-by: Deborah Brouwer <deborah.brouwer@collabora.com>

[1] https://sashiko.dev/#/patchset/20261109-tyr-ioctls-v6-0-b2896bf2b3c9%40kylinos.cn
[2] https://lore.kernel.org/rust-for-linux/20261109-tyr-ioctls-v6-0-b2896bf2b3c9@kylinos.cn/

> 
> Link: https://lore.kernel.org/rust-for-linux/20261019-rust-shmem-fixes-v1-1-3f7f6de5b5e7@google.com/ [1]
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> Janne Grunau (1):
>       rust: drm: gem: shmem: Do not free SG table of imported objects
> 
> Sami Tolvanen (2):
>       rust: drm: gem: shmem: implement gem_create_object for prime imports
>       rust: drm: gem: add an is_imported() accessor
> 
>  drivers/gpu/drm/nova/gem.rs  |  4 +++
>  drivers/gpu/drm/tyr/gem.rs   |  4 +++
>  rust/helpers/drm.c           |  6 +++++
>  rust/kernel/drm/gem/mod.rs   | 16 ++++++++++++
>  rust/kernel/drm/gem/shmem.rs | 62 +++++++++++++++++++++++++++++++++++++++++++-
>  5 files changed, 91 insertions(+), 1 deletion(-)
> ---
> base-commit: 3497a403264b094ebd61b8b755165d56e7d9dc37
> change-id: 20261026-rust-drm-gem-shmem-imported-sgt-85c4a45be283
> 
> Best regards,
> -- 
> Janne Grunau <j@jannau.net>
> 

      parent reply	other threads:[~2026-11-16 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 11:14 Janne Grunau
2026-10-26 11:14 ` [PATCH 1/3] rust: drm: gem: shmem: implement gem_create_object for prime imports Janne Grunau
2026-10-26 11:14 ` [PATCH 2/3] rust: drm: gem: add an is_imported() accessor Janne Grunau
2026-10-26 11:14 ` [PATCH 3/3] rust: drm: gem: shmem: Do not free SG table of imported objects Janne Grunau
2026-11-16 23:01 ` Deborah Brouwer [this message]

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=avuLNHy3bNAUpzNv@um790 \
    --to=deborah.brouwer@collabora.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=j@jananu.net \
    --cc=j@jannau.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=simona@ffwll.ch \
    --cc=stable+noautosel@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®