Re: div_u64/do_div stack size usage, was Re: [v3] block: Removed a warning while compiling with a cross compiler for parisc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Arnd Bergmann <arnd@xxxxxxxx>:
> On Tue, Jul 6, 2021 at 10:59 PM Abd-Alrhman Masalkhi
> <abd.masalkhi@xxxxxxxxx> wrote:
> >
> > I have compiled the kernel with a cross compiler hppa-linux-gnu-
> > (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 and the conficuration was the
> > default, Build for generic-32bit "generic-32bit_defconfig"
>
> Ok, thanks. I have reproduced this now with gcc-9.4.0 from
> https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/.
>
> I have also tried it with the other gcc versions and shown that it
> happens with every older compiler as well, but it does not happen
> with gcc-10 or gcc-11, which bring the frame size down to 164 or
> 172 bytes respectively. gcc-10 also fixes similar warnings for
> net/ipv4/tcp_input.c, net/sunrpc/stats.c and lib/xxhash.c that
> fly under the radar with the default warning level.
>
> My first thought was this was a result of -finline-functions getting
> enabled by default in gcc-10, but enabling it on gcc-9 did not
> help here. It's likely that the gcc behavior was fixed in the process
> of enabling the more aggressive inliner by default though.
>
> I also tried building genhd.o for every architecture that has
> gcc-9.4 support and did not find the problem anywhere except
> on parisc.
>
> Using CONFIG_CC_OPTIMIZE_FOR_SIZE did solve the
> problem for me (frame size down to 164 bytes), but I could not
> pinpoint a specific -f option that fixes it for -O2. Maybe we can
> simply change the defconfig here? 32-bit parisc systems are
> probably memory limited enough that building a -Os kernel
> is a good idea anyway. 64-bit parisc already builds with -Os
> but does not see the warning with -O2 either.

I agree that the simplest solution is to increase the default value for
parisc here.
On parisc we have a 32k stack (either 1x32k or 2x16k when using IRQ
stacks). I increased the default value to 1280 in 2017, but as can be
seen here this isn't sufficient. Either way, we have an active runtime
check for stack overflows which has never triggered yet, so let's just
remove the compiler warning by increasing the value to 2048. Patch is
below.

Helge

---

[PATCH] parisc: Increase gcc stack frame check to 2048 for 32- and 64-bit

parisc uses much bigger frames than other architectures, so increase the
stack frame check value to 2048 to avoid compiler warnings.

Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Abd-Alrhman Masalkhi <abd.masalkhi@xxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Helge Deller <deller@xxxxxx>

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 678c13967580..1d99c3194e18 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -335,9 +335,8 @@ config FRAME_WARN
 	int "Warn for stack frames larger than"
 	range 0 8192
 	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
-	default 1280 if (!64BIT && PARISC)
-	default 1024 if (!64BIT && !PARISC)
-	default 2048 if 64BIT
+	default 1024 if !(64BIT || PARISC)
+	default 2048 if (64BIT || PARISC)
 	help
 	  Tell gcc to warn at build time for stack frames larger than this.
 	  Setting this too low will cause a lot of warnings.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux