All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Giuliano Procida" <gprocida@google.com>
Cc: linux-modules@vger.kernel.org, "Petr Pavlu" <petr.pavlu@suse.com>,
	ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v2 1/2] rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h
Date: Thu, 22 Oct 2026 13:55:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-181589@kernel.org> (raw)
In-Reply-To: <20261022134617.228229-2-gprocida@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: missing scripts/misc-check update for EXPORT_SYMBOL_RUST_GPL()
--

commit 9207c761154db27eab7d2644afb940dea51e432c
Author: Giuliano Procida <gprocida@google.com>

rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h

This commit moves the duplicate definitions of EXPORT_SYMBOL_RUST_GPL from
rust/exports.c and drivers/gpu/nova-core/nova_core_exports.c into
include/linux/export.h.

> diff --git a/drivers/gpu/nova-core/nova_core_exports.c b/drivers/gpu/nova-core/nova_core_exports.c
> index 6e80ca9792ee5..480472b039db2 100644
> --- a/drivers/gpu/nova-core/nova_core_exports.c
> +++ b/drivers/gpu/nova-core/nova_core_exports.c
> @@ -10,6 +10,4 @@
>  
>  #include <linux/export.h>
>  
> -#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym)
> -
>  #include "exports_nova_core_generated.h"
> diff --git a/include/linux/export.h b/include/linux/export.h
> index a686fd0ba4065..4aeb422d86afc 100644
> --- a/include/linux/export.h
> +++ b/include/linux/export.h
> @@ -93,4 +93,17 @@
>  
>  #define EXPORT_SYMBOL_FOR_MODULES(sym, mods) __EXPORT_SYMBOL(sym, "GPL", "module:" mods)
>  
> +/*
> + * A hack to export Rust symbols for loadable modules without having to redo
> + * the entire `EXPORT_SYMBOL_GPL` logic in Rust.
> + *
> + * This requires Rust's new/future `v0` mangling scheme because the default one
> + * ("legacy") uses invalid characters for C identifiers (thus we cannot use the
> + * `EXPORT_SYMBOL_*` macros).
> + *
> + * All symbols are exported as GPL-only to guarantee no GPL-only feature is
> + * accidentally exposed.
> + */
> +#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym)
> +
>  #endif /* _LINUX_EXPORT_H */
> diff --git a/rust/exports.c b/rust/exports.c
> index 1b52460b0f4ee..8b2dd4aa1f928 100644
> --- a/rust/exports.c
> +++ b/rust/exports.c
> @@ -1,20 +1,10 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * A hack to export Rust symbols for loadable modules without having to redo
> - * the entire `include/linux/export.h` logic in Rust.
> - *
> - * This requires Rust's new/future `v0` mangling scheme because the default one
> - * ("legacy") uses invalid characters for C identifiers (thus we cannot use the
> - * `EXPORT_SYMBOL_*` macros).
> - *
> - * All symbols are exported as GPL-only to guarantee no GPL-only feature is
> - * accidentally exposed.
> + * Export symbols from the `rust/` crates and C helpers for loadable modules.
>   */
>  
>  #include <linux/export.h>
>  
> -#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym)
> -
>  #include "exports_core_generated.h"
>  #include "exports_bindings_generated.h"
>  #include "exports_kernel_generated.h"

[Severity: Low]
Does moving EXPORT_SYMBOL_RUST_GPL into include/linux/export.h cause
scripts/misc-check to emit false-positive warnings during W=2 builds?

In scripts/misc-check, check_missing_include_linux_export_h() and
check_unnecessary_include_linux_export_h() match export macros against
tracked files using:

scripts/misc-check:check_unnecessary_include_linux_export_h() {
	git -C "${srctree:-.}" grep --files-with-matches '#include[[:space:]]*<linux/export\.h>' \
	    -- '*.[c]' :^tools/ |
	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' |
	xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2
}

Previously, the local macro definition in both rust/exports.c and
drivers/gpu/nova-core/nova_core_exports.c contained EXPORT_SYMBOL_GPL(sym),
which satisfied that regular expression.

With the macro definition moved to include/linux/export.h, rust/exports.c
only contains EXPORT_SYMBOL_RUST_GPL(rust_build_error), and
drivers/gpu/nova-core/nova_core_exports.c only includes
exports_nova_core_generated.h without any direct EXPORT_SYMBOL* calls in the
tracked .c file. As a result, running make W=2 warns on both files:

  drivers/gpu/nova-core/nova_core_exports.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
  rust/exports.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present

Should scripts/misc-check also be updated to recognize
EXPORT_SYMBOL_RUST_GPL() and handle C export files that only invoke it via
generated headers?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022134617.228229-1-gprocida@google.com?part=1

  reply	other threads:[~2026-10-22 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 15:12 [PATCH] rust: exports: emit ___EXPORT_SYMBOL without C declarations Giuliano Procida
2026-10-19 23:36 ` Sami Tolvanen
2026-10-20 19:22 ` Miguel Ojeda
2026-10-21  9:27   ` Petr Pavlu
2026-10-21  9:44     ` Miguel Ojeda
2026-10-21 14:21   ` Giuliano Procida
2026-10-22 12:42     ` Miguel Ojeda
2026-10-22 13:46       ` [PATCH v2 0/2] clean up EXPORT_SYMBOL_RUST_GPL Giuliano Procida
2026-10-22 13:46       ` [PATCH v2 1/2] rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h Giuliano Procida
2026-10-22 13:55         ` sashiko-bot [this message]
2026-10-22 13:46       ` [PATCH v2 2/2] rust: exports: emit ___EXPORT_SYMBOL without C declarations Giuliano Procida

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=sashiko-outbox-181589@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gprocida@google.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.