Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Yuan Tan" <tanyuan@tinylab.org>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	linux-kbuild@vger.kernel.org, linux-riscv@lists.infradead.org
Cc: Linux-Arch <linux-arch@vger.kernel.org>,
	linux-kernel@vger.kernel.org, i@maskray.me,
	"Zhangjin Wu" <falcon@tinylab.org>,
	ronbogo@outlook.com, z1652074432@gmail.com, lx24@stu.ynu.edu.cn
Subject: Re: [PATCH v2 0/8] dce, riscv: Unused syscall trimming with PUSHSECTION and conditional KEEP()
Date: Wed, 15 Oct 2025 09:47:11 +0200	[thread overview]
Message-ID: <33333fdd-2aa2-4ce0-8781-92222829ea12@app.fastmail.com> (raw)
In-Reply-To: <30C972B6393DBAC5+cover.1760463245.git.tanyuan@tinylab.org>

On Wed, Oct 15, 2025, at 08:16, Yuan Tan wrote:
> Hi all,
>
> This series aims to introduce syscall trimming support based on dead code
> and data elimination (DCE). This can reduce the final image size, which is
> particularly useful for embedded devices, while also reducing the attack
> surface. It might further benefit specialized scenarios such as unikernels
> or LTO builds, and could potentially help shrink the instruction cache
> footprint.
>
> Besides that, this series also introduces a new PUSHSECTION macro. This
> wrapper allows sections created by .pushsection to have a proper reference
> relationship with their callers, so that --gc-sections can safely work
> without requiring unconditional KEEP() entries in linker scripts.
>
> Since the new syscalltbl.sh infrastructure has been merged, I think it’s a
> good time to push this patchsetTODO? forward.
>
> Patch 1–3 introduce the infrastructure for TRIM_UNUSED_SYSCALLS, mainly
> allowing syscalltbl.sh to decide which syscalls to keep according to
> USED_SYSCALLS.
> Patch 4 enables TRIM_UNUSED_SYSCALLS for the RISC-V architecture. With
> syscalltbl.sh now available, this feature should be applicable to all
> architectures that support LD_DEAD_CODE_DATA_ELIMINATION and use
> syscalltbl.sh, but let’s focus on RISC-V first.
> Patch 5–8 address the dependency inversion problem caused by sections
> created with .pushsection that are forcibly retained by KEEP() in linker
> scripts.

Thanks a lot for your work on this. I think it is indeed valuable to
be able to optimize kernels with a smaller subset of system calls for
known workloads, and have as much dead code elimination as possible.

However, I continue to think that the added scripting with a known
set of syscall names is fundamentally the wrong approach to get to
this list: This adds complexity to the build process in one of
the areas that is already too complicated, and it duplicates what
we can already do with Kconfig for a subset of the system calls.

I think the way we should configure the set of syscalls instead is
to add more Kconfig symbols guarded by CONFIG_EXPERT that turn
classes of syscalls on or off. You have obviously done the research
to come up with a list of used/unused entry points for one or more
workloads. Can you share those lists?

      Arnd

  parent reply	other threads:[~2025-10-15  7:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1760463245.git.tanyuan@tinylab.org>
2025-10-15  6:16 ` [PATCH v2 0/8] dce, riscv: Unused syscall trimming with PUSHSECTION and conditional KEEP() Yuan Tan
2025-10-15  6:38   ` [PATCH v2/resend " Yuan Tan
2025-10-15  7:47   ` Arnd Bergmann [this message]
2025-11-04  2:21     ` [PATCH v2 " Yuan Tan
2025-11-07 13:33       ` Arnd Bergmann
2025-12-03  6:02         ` Yuan Tan
2025-12-03 11:13           ` Arnd Bergmann
2025-10-15  6:17 ` [PATCH v2 1/8] init/Kconfig: add CONFIG_TRIM_UNUSED_SYSCALLS and related options Yuan Tan
2025-10-15  6:17 ` [PATCH v2 2/8] scripts/syscalltbl.sh: add optional --used-syscalls argument for syscall trimming Yuan Tan
2025-10-15  6:18 ` [PATCH v2 3/8] scripts/Makefile.asm-headers: pass USED_SYSCALLS to syscalltbl.sh Yuan Tan
2025-10-15  6:18 ` [PATCH v2 4/8] riscv: enable HAVE_TRIM_UNUSED_SYSCALLS when toolchain supports DCE Yuan Tan
2025-10-15  6:18 ` [PATCH v2 5/8] kconfig: add CONFIG_PUSHSECTION_WITH_RELOC for relocation support Yuan Tan
2025-10-15  6:19 ` [PATCH v2 6/8] compiler.h: introduce PUSHSECTION macro to establish proper references Yuan Tan
2025-10-16  3:14   ` kernel test robot
2025-10-16  6:03   ` kernel test robot
2025-10-15  6:22 ` [PATCH v2 7/8] vmlinux.lds.h: support conditional KEEP() in linker script Yuan Tan
2025-10-15  6:22 ` [PATCH v2 8/8] riscv: use PUSHSECTION in ex_table, jump_table, bug_table and alternatives Yuan Tan

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=33333fdd-2aa2-4ce0-8781-92222829ea12@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=i@maskray.me \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lx24@stu.ynu.edu.cn \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=ronbogo@outlook.com \
    --cc=tanyuan@tinylab.org \
    --cc=z1652074432@gmail.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