LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	Borislav Petkov <bp@suse.de>,
	Nathan Chancellor <nathan@kernel.org>,
	x86@kernel.org, Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [tip: x86/build] x86/build: Remove stale cc-option checks
Date: Thu, 26 Aug 2021 11:55:35 -0700	[thread overview]
Message-ID: <CAKwvOd=ML1ytp8Q10oiz8q1ERAHcGnjjCSMOHj=tq6E2vHAkQw@mail.gmail.com> (raw)
In-Reply-To: <YSILd/Dc0dYKK2qk@gmail.com>

On Sun, Aug 22, 2021 at 1:31 AM Ingo Molnar <mingo@kernel.org> wrote:
>
>
> * tip-bot2 for Nick Desaulniers <tip-bot2@linutronix.de> wrote:
>
> > The following commit has been merged into the x86/build branch of tip:
> >
> > Commit-ID:     1463c2a27d59c69358ad1cbd869d3a8649695d8c
> > Gitweb:        https://git.kernel.org/tip/1463c2a27d59c69358ad1cbd869d3a8649695d8c
> > Author:        Nick Desaulniers <ndesaulniers@google.com>
> > AuthorDate:    Thu, 12 Aug 2021 11:38:48 -07:00
> > Committer:     Borislav Petkov <bp@suse.de>
> > CommitterDate: Sun, 15 Aug 2021 10:32:52 +02:00
> >
> > x86/build: Remove stale cc-option checks
> >
> > -mpreferred-stack-boundary= is specific to GCC, while -mstack-alignment=
> > is specific to Clang. Rather than test for this three times via
> > cc-option and __cc-option, rely on CONFIG_CC_IS_* from Kconfig.
> >
> > GCC did not support values less than 4 for -mpreferred-stack-boundary=
> > until GCC 7+. Change the cc-option test to check for a value of 2,
> > rather than 4.
>
> > --- a/arch/x86/Makefile
> > +++ b/arch/x86/Makefile
> > @@ -14,10 +14,13 @@ endif
> >
> >  # For gcc stack alignment is specified with -mpreferred-stack-boundary,
> >  # clang has the option -mstack-alignment for that purpose.
> > -ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
> > +ifdef CONFIG_CC_IS_GCC
> > +ifneq ($(call cc-option, -mpreferred-stack-boundary=2),)
> >        cc_stack_align4 := -mpreferred-stack-boundary=2
> >        cc_stack_align8 := -mpreferred-stack-boundary=3
> > -else ifneq ($(call cc-option, -mstack-alignment=16),)
> > +endif
> > +endif
> > +ifdef CONFIG_CC_IS_CLANG
> >        cc_stack_align4 := -mstack-alignment=4
> >        cc_stack_align8 := -mstack-alignment=8
>
> So I spent most of yesterday bisecting a hard to diagnose bug that looked
> like a GPU driver bug - but the bisect somewhat surprisingly ended up at
> this commit.

I'm genuinely sorry about that.  Let me guess, GPF on SSE instruction
with stack based operand from AMDGPU? (I've seen that twice so far
related to these options.)

I see now what went wrong....
GCC only supports a 4B stack alignment for ***32b*** (or 16b) x86;
`-mpreferred-stack-boundary=2` will produce an error unless -m32 or
-m16 is set; but `-mpreferred-stack-boundary=2 -m32` has been long
supported.  It's -mpreferred-stack-boundary=3 for -m64 that wasn't
supported until the gcc-7 release.  So the cc-option test should
instead test -mpreferred-stack-boundary=3.

>
> Doing the partial revert below solves the regression - as the above hunk is
> not obviously an identity transformation. I have a pretty usual GCC 10.3.0
> build environment with nothing exotic.
>
> I amdended the commit with the partial revert in tip:x86/build.

No worries. I'll send a follow up.

-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2021-08-26 18:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 18:38 [PATCH v2] x86/build: remove " Nick Desaulniers
2021-08-15  9:57 ` [tip: x86/build] x86/build: Remove " tip-bot2 for Nick Desaulniers
2021-08-22  8:31   ` Ingo Molnar
2021-08-26 18:55     ` Nick Desaulniers [this message]
2021-08-26 18:58       ` [PATCH] x86/build: Refresh stale cc-option check for stack alignment Nick Desaulniers
2021-08-22  8:32 ` [tip: x86/build] x86/build: Remove stale cc-option checks tip-bot2 for 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='CAKwvOd=ML1ytp8Q10oiz8q1ERAHcGnjjCSMOHj=tq6E2vHAkQw@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=x86@kernel.org \
    --subject='Re: [tip: x86/build] x86/build: Remove stale cc-option checks' \
    /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

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).