public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Danilo Krummrich <dakr@kernel.org>,
	Matthew Maurer <mmaurer@google.com>,
	rafael@kernel.org,  ojeda@kernel.org, boqun.feng@gmail.com,
	gary@garyguo.net,  bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org,  tmgross@umich.edu,
	driver-core@lists.linux.dev,  rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] devres: export devres_node_init() and devres_node_add()
Date: Fri, 6 Feb 2026 16:31:04 +0000	[thread overview]
Message-ID: <aYYXSPtndNSPZDH-@google.com> (raw)
In-Reply-To: <aYYEFRwotF5AL_Ch@google.com>

On Fri, Feb 06, 2026 at 03:09:09PM +0000, Alice Ryhl wrote:
> On Fri, Feb 06, 2026 at 02:55:50PM +0100, Greg KH wrote:
> > On Fri, Feb 06, 2026 at 01:33:53PM +0000, Alice Ryhl wrote:
> > > On Fri, Feb 06, 2026 at 02:22:42PM +0100, Greg KH wrote:
> > > > On Fri, Feb 06, 2026 at 02:16:05PM +0100, Danilo Krummrich wrote:
> > > > > However, sprinkling "raw" EXPORT_SYMBOL_GPL() due to that is not great at all.
> > > > > Hence, we could do something like in [1] instead. I don't know if there are
> > > > > other options that may be better though.
> > > > > 
> > > > > [1] https://lore.kernel.org/all/DG7UR3WWZB4V.2MYMJJH1VDHH@kernel.org/
> > > > 
> > > > That's a start, but still messy.  There's no compiler options to prevent
> > > > this "lifting" of the code out of devres.rs?  If not, this is not going
> > > > to be the only problem that drivers run into like this in the future.
> > > 
> > > Because of how monomorphisation, as-is the code actually lives in the
> > > module to begin with.
> > 
> > Ok, but again, that is going to cause all sorts of "the symbol is
> > undefined" type of problems going forward as a developers just "assumes"
> > that the place where the symbol is exported will actually have the
> > symbol exported from it, not that this place will be copied inline into
> > somewhere else.
> > 
> > Think about the interaction between module symbol namespaces here.  This
> > isn't going to scale, and will trip people up and cause us to be forced
> > to export way more than we really want to (like this patch series shows,
> > I don't want to export any of these...)
> 
> Hmm. I don't know how to reconcile namespaces operating on symbols with
> monomorphisation.
> 
> We should probably think about what to do about ... :)

Matthew Maurer pointed out to me that behavior-wise exporting and
namespaces behave almost exactly the same as how Rust handles unstable
language features.

In the Rust standard library, all functions are marked with one of:

	#[unstable(feature = "feature_name_here")]
	#[stable]

when you use a #[stable] method, all is good. But if you use an unstable
method, then that's a compiler error unless you have

	#![feature(feature_name_here)]

at the crate root.

This seems equivalent to our situation here, if we consider:

* EXPORT_SYMBOL_GPL symbols are #[stable]
* un-exported symbols are #[unstable(feature = "core_kernel")]
* other namespaces are #[unstable(feature = "namespace_name_here")]

Of course the way this is enforced is through an entirely different
mechanism than symbol exports.

Alice

  reply	other threads:[~2026-02-06 16:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 22:31 [PATCH 0/5] Use struct devres_node in Devres<T> Danilo Krummrich
2026-02-05 22:31 ` [PATCH 1/5] devres: move struct devres_node into base.h Danilo Krummrich
2026-02-05 22:31 ` [PATCH 2/5] devres: export devres_node_init() and devres_node_add() Danilo Krummrich
2026-02-06 10:43   ` Danilo Krummrich
2026-02-06 11:04     ` Greg KH
2026-02-06 11:32       ` Danilo Krummrich
2026-02-06 11:34         ` Alice Ryhl
2026-02-06 11:46           ` Danilo Krummrich
2026-02-06 12:34           ` Greg KH
2026-02-06 13:16             ` Danilo Krummrich
2026-02-06 13:20               ` Alice Ryhl
2026-02-06 13:25                 ` Greg KH
2026-02-06 13:33                   ` Danilo Krummrich
2026-02-06 13:35                     ` Alice Ryhl
2026-02-06 13:22               ` Greg KH
2026-02-06 13:33                 ` Alice Ryhl
2026-02-06 13:55                   ` Greg KH
2026-02-06 14:23                     ` Gary Guo
2026-02-06 14:31                       ` Greg KH
2026-02-06 15:09                     ` Alice Ryhl
2026-02-06 16:31                       ` Alice Ryhl [this message]
2026-02-06 14:08                   ` Danilo Krummrich
2026-02-05 22:31 ` [PATCH 3/5] devres: add devres_node_remove() Danilo Krummrich
2026-02-05 22:31 ` [PATCH 4/5] devres: rename and export set_node_dbginfo() Danilo Krummrich
2026-02-05 22:31 ` [PATCH 5/5] rust: devres: embed struct devres_node directly Danilo Krummrich

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=aYYXSPtndNSPZDH-@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mmaurer@google.com \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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