mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER
@ 2026-09-09 20:23 Edwin Peer
  2026-09-10  7:17 ` Philipp Stanner
  2026-09-10 13:36 ` Danilo Krummrich
  0 siblings, 2 replies; 3+ messages in thread
From: Edwin Peer @ 2026-09-09 20:23 UTC (permalink / raw)
  To: dakr, aliceryhl, phasta, sumit.semwal, christian.koenig
  Cc: jhubbard, rust-for-linux, dri-devel, linux-media, linaro-mm-sig,
	linux-kernel, Edwin Peer

The dma_fence abstractions added by commit 3282d5916019 ("rust: Add
dma_fence abstractions") are compiled unconditionally, but the C
`dma_fence_*` symbols they reference live in
drivers/dma-buf/dma-fence.c, which is only built when
CONFIG_DMA_SHARED_BUFFER=y. Kernels with CONFIG_RUST=y and
CONFIG_RUST_KERNEL_DOCTESTS=y but CONFIG_DMA_SHARED_BUFFER=n fail
to link:

  ld.lld: error: undefined symbol: dma_fence_release
  >>> referenced by usercopy_64.c
  >>>               vmlinux.o:(rust_helper_dma_fence_put)
  ... dma_fence_signal{,_locked}, dma_fence_context_alloc,
      dma_fence_init, dma_fence_{add,remove}_callback ...

Wrap the dma_fence.c helper include in the same
`pub mod dma_buf;` in rust/kernel/lib.rs with a matching #[cfg].

Fixes: 3282d5916019 ("rust: Add dma_fence abstractions")
Signed-off-by: Edwin Peer <epeer@nvidia.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
---
 rust/helpers/helpers.c | 2 +-
 rust/kernel/lib.rs     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 609689fba3dd..2c5eecc091c4 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -57,8 +57,8 @@
 #include "cred.c"
 #include "device.c"
 #include "dma.c"
-#include "dma_fence.c"
 #ifdef CONFIG_DMA_SHARED_BUFFER
+#include "dma_fence.c"
 #include "dma-resv.c"
 #endif
 #include "drm.c"
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 72f5527ba66c..f9ef36217bb5 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -67,6 +67,7 @@
 pub mod device_id;
 pub mod devres;
 pub mod dma;
+#[cfg(CONFIG_DMA_SHARED_BUFFER)]
 pub mod dma_buf;
 pub mod driver;
 #[cfg(CONFIG_DRM = "y")]
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER
  2026-09-09 20:23 [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER Edwin Peer
@ 2026-09-10  7:17 ` Philipp Stanner
  2026-09-10 13:36 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Philipp Stanner @ 2026-09-10  7:17 UTC (permalink / raw)
  To: Edwin Peer, dakr, aliceryhl, phasta, sumit.semwal, christian.koenig
  Cc: jhubbard, rust-for-linux, dri-devel, linux-media, linaro-mm-sig,
	linux-kernel

On Wed, 2026-09-09 at 13:23 -0700, Edwin Peer wrote:
> The dma_fence abstractions added by commit 3282d5916019 ("rust: Add
> dma_fence abstractions") are compiled unconditionally, but the C
> `dma_fence_*` symbols they reference live in
> drivers/dma-buf/dma-fence.c, which is only built when
> CONFIG_DMA_SHARED_BUFFER=y. Kernels with CONFIG_RUST=y and
> CONFIG_RUST_KERNEL_DOCTESTS=y but CONFIG_DMA_SHARED_BUFFER=n fail
> to link:
> 
>   ld.lld: error: undefined symbol: dma_fence_release
>   >>> referenced by usercopy_64.c
>   >>>               vmlinux.o:(rust_helper_dma_fence_put)
>   ... dma_fence_signal{,_locked}, dma_fence_context_alloc,
>       dma_fence_init, dma_fence_{add,remove}_callback ...
> 
> Wrap the dma_fence.c helper include in the same
> `pub mod dma_buf;` in rust/kernel/lib.rs with a matching #[cfg].

Oh dear, yes. Sorry about that, thx for fixing!

> 
> Fixes: 3282d5916019 ("rust: Add dma_fence abstractions")
> Signed-off-by: Edwin Peer <epeer@nvidia.com>
> Reviewed-by: John Hubbard <jhubbard@nvidia.com>

Reviewed-by: Philipp Stanner <phasta@kernel.org>

> ---
>  rust/helpers/helpers.c | 2 +-
>  rust/kernel/lib.rs     | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
> index 609689fba3dd..2c5eecc091c4 100644
> --- a/rust/helpers/helpers.c
> +++ b/rust/helpers/helpers.c
> @@ -57,8 +57,8 @@
>  #include "cred.c"
>  #include "device.c"
>  #include "dma.c"
> -#include "dma_fence.c"
>  #ifdef CONFIG_DMA_SHARED_BUFFER
> +#include "dma_fence.c"
>  #include "dma-resv.c"
>  #endif
>  #include "drm.c"
> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> index 72f5527ba66c..f9ef36217bb5 100644
> --- a/rust/kernel/lib.rs
> +++ b/rust/kernel/lib.rs
> @@ -67,6 +67,7 @@
>  pub mod device_id;
>  pub mod devres;
>  pub mod dma;
> +#[cfg(CONFIG_DMA_SHARED_BUFFER)]
>  pub mod dma_buf;
>  pub mod driver;
>  #[cfg(CONFIG_DRM = "y")]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER
  2026-09-09 20:23 [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER Edwin Peer
  2026-09-10  7:17 ` Philipp Stanner
@ 2026-09-10 13:36 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-09-10 13:36 UTC (permalink / raw)
  To: Edwin Peer
  Cc: dakr, aliceryhl, phasta, sumit.semwal, christian.koenig,
	jhubbard, rust-for-linux, dri-devel, linux-media, linaro-mm-sig,
	linux-kernel

On Wed,  9 Sep 2026 13:23:27 -0700, Edwin Peer wrote:
> [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER

Applied, thanks!

  Branch: drm-rust-next
  Tree:   https://gitlab.freedesktop.org/drm/rust/kernel.git

[1/1] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER
      commit: 73e5616f3d19

The patch will appear in the next linux-next integration (typically within 24
hours on weekdays).

The patch is queued up for the upcoming merge window for the next major kernel
release.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-10 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 20:23 [PATCH drm-rust-next] rust: dma_fence: gate abstractions on CONFIG_DMA_SHARED_BUFFER Edwin Peer
2026-09-10  7:17 ` Philipp Stanner
2026-09-10 13:36 ` Danilo Krummrich

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®