Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1227361

Summary: Fedora - Properly configure glibc for POWER8 on ppc64le
Product: [Fedora] Fedora Reporter: IBM Bug Proxy <bugproxy>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: arjun.is, codonell, fweimer, hannsj_uhl, jakub, jkachuck, law, mnewsome, pfrankli
Target Milestone: ---Keywords: Patch, Reopened
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: glibc-2.22.90-33.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-09 08:51:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1051573    

Description IBM Bug Proxy 2015-06-02 13:40:43 UTC

Comment 1 IBM Bug Proxy 2015-06-02 13:40:45 UTC
== Comment: #0 - Tulio Magno Quites Machado Filho <tulioqm.com> - 2015-05-28 15:52:08 ==
Although GCC for ppc64le has ben configured using --with-cpu=power7, that doesn't ensure glibc will make usage of all the POWER7 optimizations during its build.  That only happens when glibc is configured with --with-cpu=power7.

As ppc64le supports POWER >=7, it's better to use this configure flag.

A possible solution for this case is to add ppc64le to the following block of code taken from glibc.spec:

%ifarch ppc64p7
		--with-cpu=power7 \
%endif

Comment 2 Carlos O'Donell 2015-06-02 13:44:03 UTC
Sounds good to me. We'll put this into the backlog.

Comment 3 Florian Weimer 2016-02-05 20:34:38 UTC
ppc64le requires POWER8 and later, so this no longer relevant.

Comment 4 IBM Bug Proxy 2016-02-08 19:30:48 UTC
------- Comment From tulioqm.com 2016-02-08 14:25 EDT-------
(In reply to comment #5)
> ppc64le requires POWER8 and later, so this no longer relevant.

This is not clear to me.
Are you saying that glibc is being configured with --with-cpu=power8 now?

When I opened this bug report, Fedora wanted to support POWER7 on ppc64le. If it has changed to support POWER8, it's necessary to configure glibc --with-cpu=power8 in order to correctly use the POWER8 files from glibc.

Comment 5 Florian Weimer 2016-02-08 19:44:51 UTC
(In reply to IBM Bug Proxy from comment #4)

> When I opened this bug report, Fedora wanted to support POWER7 on ppc64le.

IBM does not want to support POWER7 on ppc64le, see the recent discussion on the Fedora secondary list.

> If it has changed to support POWER8, it's necessary to configure glibc
> --with-cpu=power8 in order to correctly use the POWER8 files from glibc.

I don't see any logic in the glibc build system which reacts to that.  As far as I can tell, just setting the GCC defaults appropriately is sufficient.

It might be theoretically possible to omit support code for older CPU variants, but I don't think glibc can do that for any architecture right now (there is nothing like __ASSUME_KERNEL for CPU features, as far as I know).

Comment 6 IBM Bug Proxy 2016-02-08 20:12:30 UTC
------- Comment From tulioqm.com 2016-02-08 15:02 EDT-------
(In reply to comment #9)
> > If it has changed to support POWER8, it's necessary to configure glibc
> > --with-cpu=power8 in order to correctly use the POWER8 files from glibc.
>
> I don't see any logic in the glibc build system which reacts to that.  As
> far as I can tell, just setting the GCC defaults appropriately is sufficient.

No it isn't.
If you don't set --with-cpu=power8, you won't be using POWER8-optimized files, i.e. those under the power8 directories.
That's why we have this patch: http://patchwork.sourceware.org/patch/10641/

IMO, you really want to use --with-cpu, unless you want to support POWER >= 4.

Comment 7 Carlos O'Donell 2016-02-08 20:45:53 UTC
(In reply to IBM Bug Proxy from comment #6)
> ------- Comment From tulioqm.com 2016-02-08 15:02 EDT-------
> (In reply to comment #9)
> > > If it has changed to support POWER8, it's necessary to configure glibc
> > > --with-cpu=power8 in order to correctly use the POWER8 files from glibc.
> >
> > I don't see any logic in the glibc build system which reacts to that.  As
> > far as I can tell, just setting the GCC defaults appropriately is sufficient.
> 
> No it isn't.
> If you don't set --with-cpu=power8, you won't be using POWER8-optimized
> files, i.e. those under the power8 directories.
> That's why we have this patch: http://patchwork.sourceware.org/patch/10641/

Tulio is correct. However, perhaps you can answer a question I had. In general all of the functions in the power8/ sysdep directory appear to be routed to by IFUNCs anyway, so you will get their benefit in a generic build also? However, because it isn't guaranteed that all functions have IFUNC selectors you generally want to build with --with-cpu=powerx for POWERx (where x is an integer value).

Florian, if you look deeply the --with-cpu options feed into the sysdeps selection mechanism which makes it a required option to pickup the POWER8 optimized functions. 

This is fixed this in Rawhide.

e.g.
 889 %if %{buildpower8}
 890 (
 891   AddOns="$AddOns --with-cpu=power8"
 892   GCC="$GCC -mcpu=power8 -mtune=power8"
 893   GXX="$GXX -mcpu=power8 -mtune=power8"
 894   build power8
 895 )

I'm marking CLOSED/RAWHIDE since we aren't going to change the runtimes for F22.

Comment 8 Carlos O'Donell 2016-02-08 21:18:56 UTC
Reopening because the default runtime for ppc64le doesn't use the %{buildpower8} path. We need this additional fix:

diff --git a/glibc.spec b/glibc.spec
index 5cb5262..da36986 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -818,6 +818,9 @@ build()
 %endif
                --enable-obsolete-rpc \
                --enable-systemtap \
+%ifarch ppc64le
+               --with-cpu=power8 \
+%endif
 %ifarch ppc64p7
                --with-cpu=power7 \
 %endif
---

Comment 9 Carlos O'Donell 2016-02-09 06:06:10 UTC
Testing changes to fix this.

Comment 10 Carlos O'Donell 2016-02-09 08:51:19 UTC
This is now fixed in rawhide.

The default ppc64le runtime now correctly configures using --with-cpu=power8.

Pre-tested using a ppc-koji scratch build and reviewed the final builds.

Comment 12 IBM Bug Proxy 2016-02-09 12:50:37 UTC
------- Comment From tulioqm.com 2016-02-09 07:47 EDT-------
> However, perhaps you can answer a question I had. In
> general all of the functions in the power8/ sysdep directory appear to be
> routed to by IFUNCs anyway, so you will get their benefit in a generic build
> also? However, because it isn't guaranteed that all functions have IFUNC
> selectors you generally want to build with --with-cpu=powerx for POWERx
> (where x is an integer value).

Not for all of the functions right now.  That's especially important for math functions which still lack IFUNC support.

Thanks Florian and Carlos!