From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@arndb.de>, "S, Shirish" <sshankar@amd.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
"Wentland, Harry" <Harry.Wentland@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"yshuiv7@gmail.com" <yshuiv7@gmail.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
clang-built-linux <clang-built-linux@googlegroups.com>,
Matthias Kaehlcke <mka@google.com>,
"S, Shirish" <Shirish.S@amd.com>,
"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: RE: AMDGPU and 16B stack alignment
Date: Tue, 15 Oct 2019 10:48:35 +0000 [thread overview]
Message-ID: <309b52a1c174410f8c6c14fe69c32e51@AcuMS.aculab.com> (raw)
In-Reply-To: <CAK8P3a3_Q15hKT=gyupb0FrPX1xV3tEBpVaYy1LF0kMUj2u8hw@mail.gmail.com>
From: Arnd Bergmann
> Sent: 15 October 2019 08:19
>
> On Tue, Oct 15, 2019 at 9:08 AM S, Shirish <sshankar@amd.com> wrote:
> > On 10/15/2019 3:52 AM, Nick Desaulniers wrote:
>
> > My gcc build fails with below errors:
> >
> > dcn_calcs.c:1:0: error: -mpreferred-stack-boundary=3 is not between 4 and 12
> >
> > dcn_calc_math.c:1:0: error: -mpreferred-stack-boundary=3 is not between 4 and 12
> >
> > While GPF observed on clang builds seem to be fixed.
>
> Ok, so it seems that gcc insists on having at least 2^4 bytes stack
> alignment when
> SSE is enabled on x86-64, but does not actually rely on that for
> correct operation
> unless it's using sse2. So -msse always has to be paired with
> -mpreferred-stack-boundary=3.
>
> For clang, it sounds like the opposite is true: when passing 16 byte
> stack alignment
> and having sse/sse2 enabled, it requires the incoming stack to be 16
> byte aligned,
> but passing 8 byte alignment makes it do the right thing.
>
> So, should we just always pass $(call cc-option, -mpreferred-stack-boundary=4)
> to get the desired outcome on both?
It probably won't solve the problem.
You need to find all the asm blocks that call back into C and ensure they
maintain the required stack alignment.
This might be possible in the kernel, but is almost impossible in userspace.
ISTR that gcc arbitrarily changed the stack alignment for i386 a few years ago.
While it helped code generation it broke a lot of things.
I can't remember the correct set of options to get the stack alignment
code added only where it was needed (generates a double %bp frame).
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2019-10-15 10:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 22:22 Nick Desaulniers
[not found] ` <9e4d6378-5032-8521-13a9-d9d9519d07de@amd.com>
2019-10-15 7:19 ` Arnd Bergmann
2019-10-15 10:48 ` David Laight [this message]
2019-10-15 18:05 ` Nick Desaulniers
2019-10-15 18:11 ` Nick Desaulniers
2019-10-15 18:30 ` Alex Deucher
2019-10-15 20:15 ` Nick Desaulniers
2019-10-15 20:26 ` Arvind Sankar
2019-10-16 1:51 ` Nick Desaulniers
2019-10-16 18:55 ` Arvind Sankar
2019-10-16 23:05 ` Nick Desaulniers
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=309b52a1c174410f8c6c14fe69c32e51@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Harry.Wentland@amd.com \
--cc=Shirish.S@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrew.cooper3@citrix.com \
--cc=arnd@arndb.de \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mka@google.com \
--cc=ndesaulniers@google.com \
--cc=sshankar@amd.com \
--cc=yshuiv7@gmail.com \
/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
all inboxes | Powered by JetHome®