* [PATCH] SCSI: buslogic: reduce stack usage
@ 2026-02-03 16:33 Arnd Bergmann
2026-02-04 3:31 ` Martin K. Petersen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-02-03 16:33 UTC (permalink / raw)
To: Khalid Aziz, James E.J. Bottomley, Martin K. Petersen
Cc: Arnd Bergmann, Al Viro, Jens Axboe, Bart Van Assche,
Alexey Gladkov, linux-scsi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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>
---
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 865fcbac8fa1..49929d0339fa 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.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] SCSI: buslogic: reduce stack usage
2026-02-03 16:33 [PATCH] SCSI: buslogic: reduce stack usage Arnd Bergmann
@ 2026-02-04 3:31 ` Martin K. Petersen
2026-02-06 0:39 ` Maciej W. Rozycki
2026-02-08 2:01 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2026-02-04 3:31 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Khalid Aziz, James E.J. Bottomley, Martin K. Petersen,
Arnd Bergmann, Al Viro, Jens Axboe, Bart Van Assche,
Alexey Gladkov, linux-scsi, linux-kernel
Arnd,
> Some randconfig builds run into excessive stack usage with gcc-14 or
> higher, which use __attribute__((cold)) where earlier versions did not
> do that:
Applied to 6.20/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SCSI: buslogic: reduce stack usage
2026-02-03 16:33 [PATCH] SCSI: buslogic: reduce stack usage Arnd Bergmann
2026-02-04 3:31 ` Martin K. Petersen
@ 2026-02-06 0:39 ` Maciej W. Rozycki
2026-02-08 2:01 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2026-02-06 0:39 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Khalid Aziz, James E.J. Bottomley, Martin K. Petersen,
Arnd Bergmann, Al Viro, Jens Axboe, Bart Van Assche,
Alexey Gladkov, linux-scsi, linux-kernel
On Tue, 3 Feb 2026, Arnd Bergmann wrote:
> 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=]
Probably obviously correct, but still:
Tested-by: Maciej W. Rozycki <macro@orcam.me.uk>
-- with GCC 15 and a BT-958 MultiMaster host adapter, and the rootfs as
well as most other filesystems on devices downstream. This is with
slightly older 6.19.0-rc1 from the pci repo, which I've had handy from
other verification and should not matter for the scope of this testing.
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SCSI: buslogic: reduce stack usage
2026-02-03 16:33 [PATCH] SCSI: buslogic: reduce stack usage Arnd Bergmann
2026-02-04 3:31 ` Martin K. Petersen
2026-02-06 0:39 ` Maciej W. Rozycki
@ 2026-02-08 2:01 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2026-02-08 2:01 UTC (permalink / raw)
To: Khalid Aziz, James E.J. Bottomley, Arnd Bergmann
Cc: Martin K . Petersen, Arnd Bergmann, Al Viro, Jens Axboe,
Bart Van Assche, Alexey Gladkov, linux-scsi, linux-kernel
On Tue, 03 Feb 2026 17:33:15 +0100, Arnd Bergmann wrote:
> 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=]
>
> [...]
Applied to 6.20/scsi-queue, thanks!
[1/1] SCSI: buslogic: reduce stack usage
https://git.kernel.org/mkp/scsi/c/e17f0d4cc006
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-08 2:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 16:33 [PATCH] SCSI: buslogic: reduce stack usage Arnd Bergmann
2026-02-04 3:31 ` Martin K. Petersen
2026-02-06 0:39 ` Maciej W. Rozycki
2026-02-08 2:01 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox