Skip to content

Commit e17f0d4

Browse files
arndbmartinkpetersen
authored andcommitted
scsi: buslogic: Reduce stack usage
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>
1 parent bbb8d98 commit e17f0d4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/scsi/BusLogic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,8 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
920920
a particular probe order.
921921
*/
922922

923-
static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
923+
static noinline_for_stack void __init
924+
blogic_init_probeinfo_list(struct blogic_adapter *adapter)
924925
{
925926
/*
926927
If a PCI BIOS is present, interrogate it for MultiMaster and
@@ -1690,7 +1691,8 @@ static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
16901691
blogic_reportconfig reports the configuration of Host Adapter.
16911692
*/
16921693

1693-
static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
1694+
static noinline_for_stack bool __init
1695+
blogic_reportconfig(struct blogic_adapter *adapter)
16941696
{
16951697
unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
16961698
unsigned short sync_ok, fast_ok;

0 commit comments

Comments
 (0)