From: Nicholas Piggin <npiggin@gmail.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 2/2] powerpc/64: Increase stack redzone for 64-bit kernel to 512 bytes
Date: Mon, 1 Oct 2018 12:22:56 +1000 [thread overview]
Message-ID: <20181001122256.7cfdf186@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <CAEUhbmUih9irf-A8E4rouvpWKjeqg78Vzg+xm5TzUVB_vLPr=g@mail.gmail.com>
On Mon, 1 Oct 2018 09:11:04 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Nick,
>
> On Mon, Oct 1, 2018 at 7:27 AM Nicholas Piggin <npiggin@gmail.com> wrote:
> >
> > On Sat, 29 Sep 2018 23:25:20 -0700
> > Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > > commit 573ebfa6601f ("powerpc: Increase stack redzone for 64-bit
> > > userspace to 512 bytes") only changes stack userspace redzone size.
> > > We need increase the kernel one to 512 bytes too per ABIv2 spec.
> >
> > You're right we need 512 to be compatible with ABIv2, but as the
> > comment says, gcc limits this to 288 bytes so that's what is used
> > to save stack space. We can use a compiler version test to change
> > this if llvm or a new version of gcc does something different.
> >
>
> I believe what the comment says is for ABIv1. At the time when commit
> 573ebfa6601f was submitted, kernel had not switched to ABIv2 build
> yet.
I see, yes you are right about that. However gcc still seems to be using
288 bytes.
static inline bool
offset_below_red_zone_p (HOST_WIDE_INT offset)
{
return offset < (DEFAULT_ABI == ABI_V4
? 0
: TARGET_32BIT ? -220 : -288);
}
llvm does as well AFAIKS
// DarwinABI has a 224-byte red zone. PPC32 SVR4ABI(Non-DarwinABI) has no
// red zone and PPC64 SVR4ABI has a 288-byte red zone.
unsigned getRedZoneSize() const {
return isDarwinABI() ? 224 : (isPPC64() ? 288 : 0);
}
So I suspect we can get away with using 288 for the kernel. Although
the ELFv2 ABI allows 512, I suspect at this point compilers won't switch
over without an explicit red zone size flag.
Thanks,
Nick
next prev parent reply other threads:[~2018-10-01 2:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-30 6:25 [PATCH 1/2] powerpc/64: Remove duplicated -mabi=elfv2 for little endian targets Bin Meng
2018-09-30 6:25 ` [PATCH 2/2] powerpc/64: Increase stack redzone for 64-bit kernel to 512 bytes Bin Meng
2018-09-30 23:27 ` Nicholas Piggin
2018-10-01 1:11 ` Bin Meng
2018-10-01 2:22 ` Nicholas Piggin [this message]
2018-10-01 8:51 ` Segher Boessenkool
2018-10-01 23:59 ` Nicholas Piggin
2018-10-02 8:30 ` Segher Boessenkool
2018-10-01 12:41 ` Bin Meng
2018-10-02 0:03 ` Nicholas Piggin
2018-10-01 9:07 ` Segher Boessenkool
2018-10-01 8:59 ` [PATCH 1/2] powerpc/64: Remove duplicated -mabi=elfv2 for little endian targets Segher Boessenkool
2018-10-01 12:19 ` Bin Meng
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=20181001122256.7cfdf186@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=bmeng.cn@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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).