From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Murilo Opsfelder Araújo" <muriloo@linux.ibm.com>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH] powerpc/boot: Build wrapper for an appropriate CPU
Date: Thu, 7 Apr 2022 15:33:09 -0500 [thread overview]
Message-ID: <20220407203309.GQ614@gate.crashing.org> (raw)
In-Reply-To: <75f14a30-f1ad-7cdf-a8af-d1fad8647ca2@linux.ibm.com>
On Thu, Apr 07, 2022 at 03:43:20PM -0300, Murilo Opsfelder Araújo wrote:
> On 4/6/22 04:08, Joel Stanley wrote:
> >On Thu, 31 Mar 2022 at 23:46, Segher Boessenkool
> ><segher@kernel.crashing.org> wrote:
> >>On Thu, Mar 31, 2022 at 12:19:52PM -0300, Murilo Opsfelder Araújo wrote:
> >>>My understanding is that the default cpu type for -mcpu=powerpc64 can
> >>>change.
> >>
> >>Different subtargets (Linux, AIX, Darwin, the various BSDs, bare ELF,
> >>etc.) have different default CPUs. It also can be set at configure time
> >>for most subtargets.
> >>
> >>Linux can be built with compilers not targetting *-linux*, so it would
> >>be best to specify a specific CPU always.
> >>
> >>>>I did a little test using my buildroot compiler which has
> >>>>with-cpu=power10. I used the presence of PCREL relocations as evidence
> >>>>that it was build for power10.
> >>>>
> >>>>$ powerpc64le-buildroot-linux-gnu-gcc -mcpu=power10 -c test.c
> >>>>$ readelf -r test.o |grep -c PCREL
> >>>>24
> >>>
> >>>It respected the -mcpu=power10 you provided.
> >>
> >>Of course.
> >>
> >>>And that's my concern. We're relying on the compiler default cpu type.
> >>
> >>That is not the compiler default. It is the default from who built the
> >>compiler. It can vary wildly and unpredictably.
> >>
> >>The actual compiler default will not change so easily at all, basically
> >>only when its subtarget drops support for an older CPU.
> >>
> >>>If gcc defaults -mcpu=powerpc64le to power10, you're going to have
> >>>the same problem again.
> >>
> >>That will not happen before power10 is the minimum supported CPU.
> >>Anything else is madness.
> >
> >Murilo, does Segher's explanation address your concerns?
>
> The comment:
>
> "Different subtargets (Linux, AIX, Darwin, the various BSDs, bare ELF,
> etc.) have different default CPUs. It also can be set at configure time
> for most subtargets.
>
> Linux can be built with compilers not targetting *-linux*, so it would
> be best to specify a specific CPU always."
>
> made me think that it's better to specify -mcpu=power8 instead of
> -mcpu=powerpc64le
> because of such compilers not targetting *-linux*.
>
> Did I understand Segher's comment correctly? To be honest, I don't know
> how much concerned we should be about this scenario.
That is the long and short of it, yes. This matters for reproducible
builds if you care for more exotic compilers (which are very common for
32 bit, but not so much for 64 bit).
> Just for the sake of consistency, if we decide to go with -mcpu=powerpc64le,
> then I think we should also change arch/powerpc/Makefile CFLAGS.
> Otherwise, we could follow what we already have in the tree and use
> -mcpu=power8 in BOOTCLAGS, too.
>
> Practically speaking, either way works for us. In any case:
+1
> Reviewed-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Segher
next prev parent reply other threads:[~2022-04-07 20:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 11:24 [PATCH] powerpc/boot: Build wrapper for an appropriate CPU Joel Stanley
2022-03-30 11:33 ` Christophe Leroy
2022-03-30 11:39 ` Joel Stanley
2022-03-31 23:00 ` Segher Boessenkool
2022-03-31 2:05 ` Murilo Opsfelder Araújo
2022-03-31 5:01 ` Joel Stanley
2022-03-31 15:19 ` Murilo Opsfelder Araújo
2022-03-31 23:44 ` Segher Boessenkool
2022-04-06 7:08 ` Joel Stanley
2022-04-07 18:43 ` Murilo Opsfelder Araújo
2022-04-07 20:33 ` Segher Boessenkool [this message]
2022-03-31 23:09 ` Segher Boessenkool
2022-05-15 10:12 ` Michael Ellerman
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=20220407203309.GQ614@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=joel@jms.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=muriloo@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).