linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Helge Deller <deller@gmx.de>
Cc: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Bernardo Innocenti <bernie@develer.com>,
	Parisc List <linux-parisc@vger.kernel.org>,
	linux-block <linux-block@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: div_u64/do_div stack size usage, was Re: [v3] block: Removed a warning while compiling with a cross compiler for parisc
Date: Thu, 8 Jul 2021 13:37:17 +0200	[thread overview]
Message-ID: <CAK8P3a0x4gba+syLqjBDG0634FNDNRTvDm4dQ9p_fmgSXBUiig@mail.gmail.com> (raw)
In-Reply-To: <bece0f60-b19e-5601-3bd9-c899c3d4cd93@gmx.de>

On Thu, Jul 8, 2021 at 11:30 AM Helge Deller <deller@gmx.de> wrote:
> On 7/7/21 10:39 PM, Arnd Bergmann wrote:
> >> [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.
> >
> > I think setting it to 2048 is rather excessive,
>
> Since parisc needs roughly twice the frame (and stack) size as x86,
> 2048 seemed logical since that's the double of what's used on x86.
> Of course we can reduce it, e.g. to 1536.

But it doesn't use twice as much for large functions at all. The stack
frame for a small function is much larger, so you need a larger kernel
stack to allow for deely nested call chains, but the frame for single
function with large variables is only a bit larger as most of it is used up
by those variables.

> > and it would make you miss other real bugs. What I suggested was to
> > change the defconfig to use CONFIG_CC_OPTIMIZE_FOR_SIZE instead.
>
> But then you still will see those warnings in case you choose to not
> optize for size.

Right, and I would consider that a good thing: this warning is for a real
(though fairly harmless) bug that has already been fixed with newer
toolchains, so anyone that runs into the bug should probably see the
warning for it. Doubling the limit would effectively prevent similar bugs
from being noticed, and they could be in performance-critical code
or cause an actual stack overrun.

I can think of two other, more directed workarounds:

- change block/Makefile to add -Os to the cflags for this one file in
  known-broken configurations (parisc with old gcc and -O2),
  to be removed in a few years when gcc-10 becomes the minimum
  supported version

- add a warning that points to the gcc bug (if someone has a link)
  when building an affected configuration, and let users decide to
  either change their setup (using -Os or a newer compiler) or to
  ignore the warning.

> or bad coding, e.g. huge local variables

That's what I meant with 'kernel bug'.

       Arnd

  reply	other threads:[~2021-07-08 11:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 11:19 [PATCH v3] block: Removed a warning while compiling with a cross compiler for parisc Abd-Alrhman Masalkhi
2021-07-06 13:59 ` Christoph Hellwig
2021-07-06 15:30   ` [v3] " Abd-Alrhman Masalkhi
2021-07-06 17:01     ` div_u64/do_div stack size usage, was " Christoph Hellwig
2021-07-06 17:35       ` Arnd Bergmann
2021-07-06 20:59         ` Abd-Alrhman Masalkhi
2021-07-07  8:17           ` Arnd Bergmann
2021-07-07 13:36             ` Helge Deller
2021-07-07 20:39               ` Arnd Bergmann
2021-07-08  9:29                 ` Helge Deller
2021-07-08 11:37                   ` Arnd Bergmann [this message]
2021-07-08 15:01                     ` John David Anglin
2021-07-07 14:36             ` John David Anglin
2021-07-07 15:30             ` Abd-Alrhman Masalkhi

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=CAK8P3a0x4gba+syLqjBDG0634FNDNRTvDm4dQ9p_fmgSXBUiig@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=abd.masalkhi@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bernie@develer.com \
    --cc=dan.carpenter@oracle.com \
    --cc=deller@gmx.de \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@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;
as well as URLs for NNTP newsgroup(s).