From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Sasha Levin <sashal@kernel.org>,
khalid@gonehiking.org, James.Bottomley@HansenPartnership.com,
linux-scsi@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-5.15] scsi: buslogic: Reduce stack usage
Date: Sun, 15 Feb 2026 10:03:22 -0500 [thread overview]
Message-ID: <20260215150333.2150455-5-sashal@kernel.org> (raw)
In-Reply-To: <20260215150333.2150455-1-sashal@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
[ Upstream commit e17f0d4cc006265dd92129db4bf9da3a2e4a4f66 ]
Some randconfig builds run into excessive stack usage with gcc-14 or
higher, which use __attribute__((cold)) where earlier versions did not do
that:
drivers/scsi/BusLogic.c: In function 'blogic_init':
drivers/scsi/BusLogic.c:2398:1: error: the frame size of 1680 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
The problem is that a lot of code gets inlined into blogic_init() here. Two
functions stick out, but they are a bit different:
- blogic_init_probeinfo_list() actually uses a few hundred bytes of kernel
stack, which is a problem in combination with other functions that also
do. Marking this one as noinline means that the stack slots get get
reused between function calls
- blogic_reportconfig() has a few large variables, but whenever it is not
inlined into its caller, the compiler is actually smart enough to reuse
stack slots for these automatically, so marking it as noinline saves
most of the stack space by itself.
The combination of both of these should avoid the problem entirely.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260203163321.2598593-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis of commit: "scsi: buslogic: Reduce stack usage"
### Commit Message Analysis
The commit addresses a **build failure** (-Werror=frame-larger-than=)
that occurs with gcc-14 or higher on certain randconfig builds. The
function `blogic_init()` exceeds the 1536-byte stack frame limit
(reaching 1680 bytes) due to excessive inlining by the compiler.
The fix is to mark two functions as `noinline_for_stack`:
1. `blogic_init_probeinfo_list()` - uses significant stack space that
compounds with other inlined functions
2. `blogic_reportconfig()` - has large local variables that the compiler
can reuse stack slots for when not inlined
### Code Change Analysis
The change is extremely minimal and surgical:
- **Two functions** have their declarations changed from `static ...
__init` to `static noinline_for_stack ... __init`
- **Zero logic changes** - no behavior modification whatsoever
- **Zero new code paths** - the functions still do exactly the same
thing
- The `noinline_for_stack` annotation is a well-established kernel
mechanism specifically designed for this purpose
### Classification: Build Fix
This is a **build fix** — one of the explicitly allowed exception
categories for stable backports. With gcc-14+, the kernel fails to
compile with `-Werror=frame-larger-than=` enabled in certain
configurations. Build failures prevent users from building the kernel at
all, which is a critical issue.
### Scope and Risk Assessment
- **Lines changed**: Effectively 2 lines (function signature annotations
only)
- **Files touched**: 1 (drivers/scsi/BusLogic.c)
- **Risk**: Extremely low. `noinline_for_stack` only prevents the
compiler from inlining these functions. Since they are `__init`
functions (called once during initialization and then discarded), the
negligible performance impact of preventing inlining is irrelevant.
- **Regression potential**: Near zero. The functions still execute
identically; only their calling convention changes slightly.
### User Impact
- Users building kernels with gcc-14 or newer (increasingly common as
distributions adopt newer toolchains) will hit build failures on
certain configurations
- The BusLogic SCSI driver is a legacy driver, but it still has users
and is compiled in many kernel configs
- Build failures are binary — either you can build or you can't — making
this high impact for affected configurations
### Stability Indicators
- **Author**: Arnd Bergmann — a very well-known and respected kernel
developer who regularly contributes build fixes and architecture
improvements
- **Reviewer**: Martin K. Petersen — SCSI subsystem maintainer
- The fix uses `noinline_for_stack`, the standard kernel annotation for
exactly this type of stack reduction
### Dependency Check
- No dependencies on other commits
- The `noinline_for_stack` macro has been available in the kernel for
many years
- The BusLogic driver exists in all stable trees
### Conclusion
This is a textbook stable backport candidate:
1. **Build fix** — explicitly allowed in stable rules
2. **Trivially correct** — annotation-only change with no logic
modification
3. **Zero risk** of regression — functions behave identically
4. **Real impact** — prevents build failure with modern gcc versions
5. **Tiny scope** — 2 annotation additions in a single file
6. **Well-established pattern** — `noinline_for_stack` is the standard
kernel solution for this class of problem
**YES**
drivers/scsi/BusLogic.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index a86d780d1ba40..026c3e617cb1c 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -920,7 +920,8 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
a particular probe order.
*/
-static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
+static noinline_for_stack void __init
+blogic_init_probeinfo_list(struct blogic_adapter *adapter)
{
/*
If a PCI BIOS is present, interrogate it for MultiMaster and
@@ -1690,7 +1691,8 @@ static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
blogic_reportconfig reports the configuration of Host Adapter.
*/
-static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
+static noinline_for_stack bool __init
+blogic_reportconfig(struct blogic_adapter *adapter)
{
unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
unsigned short sync_ok, fast_ok;
--
2.51.0
next prev parent reply other threads:[~2026-02-15 15:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 15:03 [PATCH AUTOSEL 6.19-6.12] riscv: vector: init vector context with proper vlenb Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.12] scsi: ufs: mediatek: Fix page faults in ufs_mtk_clk_scale() trace event Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.1] hisi_acc_vfio_pci: update status after RAS error Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.18] hisi_acc_vfio_pci: fix the queue parameter anomaly issue Sasha Levin
2026-02-15 15:03 ` Sasha Levin [this message]
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-5.15] tracing: Fix false sharing in hwlat get_sample() Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.6] vhost: fix caching attributes of MMIO regions by setting them explicitly Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.18] hisi_acc_vfio_pci: resolve duplicate migration states Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.6] ata: libata: avoid long timeouts on hot-unplugged SATA DAS Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-5.15] RDMA/rtrs-clt: For conn rejection use actual err number Sasha Levin
2026-02-15 15:03 ` [PATCH AUTOSEL 6.19-6.18] um: Preserve errno within signal handler Sasha Levin
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=20260215150333.2150455-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=arnd@arndb.de \
--cc=khalid@gonehiking.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=patches@lists.linux.dev \
--cc=stable@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