* Re: [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
2026-05-22 18:54 [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds Shivam Kalra via B4 Relay
@ 2026-05-26 11:46 ` Alice Ryhl
2026-05-26 13:40 ` Miguel Ojeda
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2026-05-26 11:46 UTC (permalink / raw)
To: shivamkalra98
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
Greg Kroah-Hartman, rust-for-linux, linux-kernel,
kernel test robot
On Fri, May 22, 2026 at 8:54 PM Shivam Kalra via B4 Relay
<devnull+shivamkalra98.zohomail.in@kernel.org> wrote:
>
> From: Shivam Kalra <shivamkalra98@zohomail.in>
>
> Commit 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> introduced a call to bindings::is_vmalloc_addr(). However, this
> fails to compile on architectures where CONFIG_MMU is disabled,
> resulting in the following build error:
>
> error[E0425]: cannot find function is_vmalloc_addr in crate bindings
>
> When CONFIG_MMU is not set, is_vmalloc_addr() is defined as a
> static inline function in <linux/mm.h> that unconditionally
> returns false. Because bindgen skips static inline functions
> when generating bindings, the symbol is completely missing from
> the Rust bindings crate.
>
> Fix this by providing a C helper wrapper, rust_helper_is_vmalloc_addr(),
> in rust/helpers/vmalloc.c. This ensures the function is reliably
> exposed to Rust regardless of the MMU configuration. On NOMMU builds,
> this allows KVVec::shrink_to() to successfully compile and correctly
> route all allocations through the kmalloc realloc path.
>
> Fixes: 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605220811.LRplxeBR-lkp@intel.com/
> Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
2026-05-22 18:54 [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds Shivam Kalra via B4 Relay
2026-05-26 11:46 ` Alice Ryhl
@ 2026-05-26 13:40 ` Miguel Ojeda
2026-05-26 15:01 ` Danilo Krummrich
2026-05-28 7:22 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-05-26 13:40 UTC (permalink / raw)
To: shivamkalra98, Andrew Morton, Lorenzo Stoakes, Liam R. Howlett
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
linux-kernel, kernel test robot, Linux-MM
On Fri, May 22, 2026 at 8:54 PM Shivam Kalra via B4 Relay
<devnull+shivamkalra98.zohomail.in@kernel.org> wrote:
>
> From: Shivam Kalra <shivamkalra98@zohomail.in>
>
> Commit 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> introduced a call to bindings::is_vmalloc_addr(). However, this
> fails to compile on architectures where CONFIG_MMU is disabled,
> resulting in the following build error:
>
> error[E0425]: cannot find function is_vmalloc_addr in crate bindings
>
> When CONFIG_MMU is not set, is_vmalloc_addr() is defined as a
> static inline function in <linux/mm.h> that unconditionally
> returns false. Because bindgen skips static inline functions
> when generating bindings, the symbol is completely missing from
> the Rust bindings crate.
>
> Fix this by providing a C helper wrapper, rust_helper_is_vmalloc_addr(),
> in rust/helpers/vmalloc.c. This ensures the function is reliably
> exposed to Rust regardless of the MMU configuration. On NOMMU builds,
> this allows KVVec::shrink_to() to successfully compile and correctly
> route all allocations through the kmalloc realloc path.
>
> Fixes: 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605220811.LRplxeBR-lkp@intel.com/
> Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
I can take this in my `rust-fixes` PR unless mm/akpm plans to do so.
Cc'ing akpm, Lorenzo, Liam and linux-mm, by the way.
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
2026-05-22 18:54 [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds Shivam Kalra via B4 Relay
2026-05-26 11:46 ` Alice Ryhl
2026-05-26 13:40 ` Miguel Ojeda
@ 2026-05-26 15:01 ` Danilo Krummrich
2026-05-28 7:22 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2026-05-26 15:01 UTC (permalink / raw)
To: shivamkalra98
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Greg Kroah-Hartman, rust-for-linux, linux-kernel,
kernel test robot
On 5/22/26 8:54 PM, Shivam Kalra via B4 Relay wrote:
> From: Shivam Kalra <shivamkalra98@zohomail.in>
>
> Commit 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> introduced a call to bindings::is_vmalloc_addr(). However, this
> fails to compile on architectures where CONFIG_MMU is disabled,
> resulting in the following build error:
>
> error[E0425]: cannot find function is_vmalloc_addr in crate bindings
>
> When CONFIG_MMU is not set, is_vmalloc_addr() is defined as a
> static inline function in <linux/mm.h> that unconditionally
> returns false. Because bindgen skips static inline functions
> when generating bindings, the symbol is completely missing from
> the Rust bindings crate.
>
> Fix this by providing a C helper wrapper, rust_helper_is_vmalloc_addr(),
> in rust/helpers/vmalloc.c. This ensures the function is reliably
> exposed to Rust regardless of the MMU configuration. On NOMMU builds,
> this allows KVVec::shrink_to() to successfully compile and correctly
> route all allocations through the kmalloc realloc path.
>
> Fixes: 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605220811.LRplxeBR-lkp@intel.com/
> Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
2026-05-22 18:54 [PATCH] rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds Shivam Kalra via B4 Relay
` (2 preceding siblings ...)
2026-05-26 15:01 ` Danilo Krummrich
@ 2026-05-28 7:22 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-05-28 7:22 UTC (permalink / raw)
To: shivamkalra98, Andrew Morton, Lorenzo Stoakes, Liam R. Howlett, Linux-MM
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
linux-kernel, kernel test robot
On Fri, May 22, 2026 at 8:54 PM Shivam Kalra via B4 Relay
<devnull+shivamkalra98.zohomail.in@kernel.org> wrote:
>
> From: Shivam Kalra <shivamkalra98@zohomail.in>
>
> Commit 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> introduced a call to bindings::is_vmalloc_addr(). However, this
> fails to compile on architectures where CONFIG_MMU is disabled,
> resulting in the following build error:
>
> error[E0425]: cannot find function is_vmalloc_addr in crate bindings
>
> When CONFIG_MMU is not set, is_vmalloc_addr() is defined as a
> static inline function in <linux/mm.h> that unconditionally
> returns false. Because bindgen skips static inline functions
> when generating bindings, the symbol is completely missing from
> the Rust bindings crate.
>
> Fix this by providing a C helper wrapper, rust_helper_is_vmalloc_addr(),
> in rust/helpers/vmalloc.c. This ensures the function is reliably
> exposed to Rust regardless of the MMU configuration. On NOMMU builds,
> this allows KVVec::shrink_to() to successfully compile and correctly
> route all allocations through the kmalloc realloc path.
>
> Fixes: 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605220811.LRplxeBR-lkp@intel.com/
> Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
Applied to `rust-fixes` -- thanks everyone!
[ Pasted exact compiler output and expanded it. - Miguel ]
The compiler output did not seem to be an exact copy paste for some
reason (at least from my testing when reproducing the issue), so I
updated the compiler output.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread