Rust for Linux List
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>, "Rong Xu" <xur@google.com>,
	"Han Shen" <shenhan@google.com>,
	"Nicolas Schier" <nsc@kernel.org>,
	linux-kbuild@vger.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>,
	"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>,
	rust-for-linux@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] kbuild: rust: support stabilized flag `-Cprofile-sample-use` for Rust >= 1.100
Date: Fri, 6 Nov 2026 13:53:56 -0700	[thread overview]
Message-ID: <20261106205356.GA21490@ax162> (raw)
In-Reply-To: <CANiq72kSG61mTC3_0pPokoLbbE87oFrKHcNUZhxhbxpg24USYw@mail.gmail.com>

On Fri, Nov 06, 2026 at 12:04:08PM +0100, Miguel Ojeda wrote:
> On Fri, Nov 6, 2026 at 11:45 AM Alice Ryhl <aliceryhl@google.com> wrote:
> >
> > Could we check for `-Cprofile-sample-use` directly using `rustc-option`
> > instead of checking the rustc version (e.g. testing
> > `-Cprofile-sample-use=/dev/null` or using `$(call rustc-option,...)`)?
> > That way toolchains that cherry-pick the stabilization (or older 1.100
> > nightlies from before the flag was stabilized) are also handled
> > properly.
> 
> It is definitely an option, as usual, but this file uses the version
> elsewhere, and we have preferred so far the version one where
> possible, because it is way simpler and spawns fewer processes
> (especially so in newer Make), which Kbuild has usually appreciated.

Yeah, there is always a fine line between deciding whether or not to do
a dynamic versus version check. Obviously the cost of querying the
compiler is not that high in the grand scheme of the total build time,
so I don't think we should be scared of doing dynamic tests, However, I
do think doing plain version checks is simpler to support, especially
since it makes cleaning up these changes as the minimum version is
bumped.

> Regarding old nightlies, those are not supported by upstream nor by
> us, and we intentionally never attempted to make flags work for
> particular binaries out there. I think the fact that we support even
> nightlies from Rust is already quite a success :)

Yeah, for clang, we have done our best to support prerelease versions
but once the toolchain stabilizes, we don't care about those old
versions. I generally try to do version checks against the stable
version (i.e., x.1.0, instead of x.0.0) to avoid breaking compiler
bisects but I guess Rust doesn't have such a scheme? That is the only
area where I feel friction with version checks.

> Same for custom `rustc` forks, if you mean "cherry-picking the
> stabilization". We can't really test those, and if someone really
> needs that properly working and can make a case, then we would need to
> take a look at all the version tests we do (and not just for Rust).
> Perhaps some folks only customize 1 or 2 flags and thus only care
> about those working, but we wouldn't know which ones.

To be honest, I would avoid supporting franken-toolchains if you have
the option not to. Presumably if a vendor has customized or vendored
their toolchain, they are likely working with a downstream kernel as
well, in which case they can just adjust the check in their tree as
needed. You could obviously deal with exceptions on a case-by-case basis
but reasoning about all the different options and their first supported
version is hard enough as it is.

-- 
Cheers,
Nathan

  parent reply	other threads:[~2026-11-06 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  7:35 [PATCH] kbuild: rust: support stabilized flag `-Cprofile-sample-use` for Rust >= 1.100 Miguel Ojeda
2026-11-06 10:45 ` Alice Ryhl
2026-11-06 11:04   ` Miguel Ojeda
2026-11-06 12:21     ` Gary Guo
2026-11-06 20:53     ` Nathan Chancellor [this message]
2026-11-07 13:21 ` Nicolas Schier

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=20261106205356.GA21490@ax162 \
    --to=nathan@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=shenhan@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --cc=xur@google.com \
    /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