Rust for Linux List
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Miguel Ojeda <ojeda@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	". Boqun Feng" <boqun@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: rant on Rust in kernel
Date: Thu, 12 Nov 2026 14:42:40 -0700	[thread overview]
Message-ID: <20261112214240.GF4107043@ax162> (raw)
In-Reply-To: <avXdJyqNNqopuH2_@ashevche-desk.local>

Hi Andy,

On Thu, Nov 12, 2026 at 05:37:11PM +0200, Andy Shevchenko wrote:
> (Cc'ed to Rust and Kbuild people)
> 
> I have two quite annoying things that lately Rust brought to kernel
> (in some way).
> 
> First of all, it broke the old and nice kernel feature to build a subset with
> allmodconfig or allyesconfig. For instance,
> 
>   make LLVM=-22 O=... W=1 C=1 CF=-D__CHECK_ENDIAN__ -j64 allyesconfig -- fs/pstore/
> 
> Now this makes a very good fireworks out of some rust.
> 
> Ex.:
> 
> error[E0609]: no field `disconnect` on type `usb_driver`
>   --> .../rust/kernel/usb.rs:57:27
>    |
> 57 |             (*udrv.get()).disconnect = Some(Self::disconnect_callback);
>    |                           ^^^^^^^^^^ unknown field
>    |
>    = note: available field is: `_address`
> 
> Second one, is that now with the above feature the build is finished like
> a minute (sic!) later than it was before on a good server with 24 modern
> CPU cores. It started happening somewhat a release ago.

You are probably seeing this behavior within the last release or so
because of

  2625480a1bf7 ("hardening: Default randstruct off with rust for better allmodconfig support")

which allows Rust to be enabled with all{mod,yes}config to make -next
testing easier.

As for that particular error, is it a -next regression?

> I have no clue what is there, but I will appreciate if it gets fixed ASAP!
> I rely on the above feature to save my time when doing test builds.

Note: The following is my understanding, Miguel or other Rust folks
might correct me.

You are noticing the face that certain Rust crates like kernel are built
in the prepare target, which will run for pretty much every build; it
has been this way since Rust has been merged, you are just noticing it
now because Rust is enabled in your configuration. I believe this was
done to ensure the kernel crate is built and available before drivers
were built via recursive make since they consume it. However, as you
have noticed, this implementation bogs down the build and the same
problem exists for Rust drivers that depend on other Rust abstractions
and such.

Miguel and I chatted about this at Plumbers and we absolutely want to
get it resolved but I am just not sure how quickly that will happen. In
the meantime, you could just use KCONFIG_ALLCONFIG to disable
CONFIG_RUST during configuration time so you can still use a single
command:

  make ... KCONFIG_ALLCONFIG=<(echo CONFIG_RUST=n) allyesconfig -- ...

-- 
Cheers,
Nathan

  reply	other threads:[~2026-11-12 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 15:37 rant on Rust in kernel Andy Shevchenko
2026-11-12 21:42 ` Nathan Chancellor [this message]
2026-11-12 21:59 ` Miguel Ojeda

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=20261112214240.GF4107043@ax162 \
    --to=nathan@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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