Bug #73111 [Opn]: make prof-use don't work -> still profiling code

From: Date: Thu, 29 Sep 2016 14:59:42 +0000
Subject: Bug #73111 [Opn]: make prof-use don't work -> still profiling code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204341@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73111&edit=1

 ID:                 73111
 User updated by:    spam2 at rhsoft dot net
 Reported by:        spam2 at rhsoft dot net
 Summary:            make prof-use don't work -> still profiling code
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Linux
-PHP Version:        7.0.11
+PHP Version:        7.0.12 RC1
 Block user comment: N
 Private report:     N

 New Comment:

7.0.12 RC1 does the same nonsense and skip the "make -j8 prof-use" completly which leads
in steop over to "make install" and in fact installs binaries with the profile-code
leading in overhead error messages at runtime without the "--always-make" hack 
______________________________________

./configure
make -j8 prof-gen
<run application code>
make -j8 prof-use
make install
______________________________________

+ make -j8 prof-use
CCACHE_DISABLE=1 make PROF_FLAGS=-fprofile-use all
make[1]: Entering directory '/home/builduser/rpmbuild/BUILD/php-7.0.12'

Build complete.
Don't forget to run 'make test'.

make[1]: Leaving directory '/home/builduser/rpmbuild/BUILD/php-7.0.12'
+ exit 0
Ausführung(%install): /bin/sh -e /var/tmp/rpm-tmp.F1EgEt
+ umask 022
+ cd /home/builduser/rpmbuild/BUILD
+ '[' /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
'!=' / ']'
+ rm -rf /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
++ dirname /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ mkdir -p /home/builduser/rpmbuild/BUILDROOT
+ mkdir /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ cd php-7.0.12
+ install -m 0755 -d
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc/httpd/conf
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/lib64/httpd/modules
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/share/php
+ install -m 0644 /home/builduser/rpmbuild/SOURCES/opcache-zendoptimizer.php
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/share/php/zendoptimizer.php
+ install -m 0644 /home/builduser/rpmbuild/SOURCES/php-httpd-dummy.conf
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc/httpd/conf/httpd.conf
+ INSTALL_ROOT=/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ make install


Previous Comments:
------------------------------------------------------------------------
[2016-09-19 19:04:46] spam2 at rhsoft dot net

BTW:

pleae take a look at "-fprofile-generate leads in root-owned files"
https://bugzilla.redhat.com/show_bug.cgi?id=1377249

i had a fight the whole last night including some hours at moring in the office without understand
what happens, it seems now disappeared but running "rpmbuild" as restrcited user and
ending in root-owned files and all sorts of errors when other things are still running as the
correct restricted user is very strange

finally i had 10 successful builds with PGO, the perofrmance of our own CMS system is increased by
7% with PHP 7.0.11 compared to normal builds - really great but the root-thing and need of
"make --always-make" don't make me terrible happy while i can only explain the
"make prof-use" NOOP which is topic of this bugreport
_______________________

currently PGO is done with that snippet while "profile.sh" first starts CLI-autotests with
the temporary binary and after that starts a webserver on port 9000, fetching a URL-list and fetch
all URLs known by the cms 10 times to fill up the profiledata for "make prof-use"

# build php with 'profile-guided-optimization' when enabled
%if %pgo_build
 echo "PROFILE-GUIDED-OPTIMIZATION: Stage 1"
 make %{?_smp_mflags} prof-gen
 /rpmbuild/PHP-PGO/profile.sh $PWD
 echo "PROFILE-GUIDED-OPTIMIZATION: Stage 2"
 make --always-make %{?_smp_mflags} prof-use
%else
 make %{?_smp_mflags}
%endif
_______________________

comment from GCC maintainers

The *.gcda files aren't written by gcc, but by the application you're testing (when
compiled/linked with -fprofile-generate).  It uses whatever uid the process has.  Perhaps you are
dlopening your -fprofile-generate built library into some suid app or something similar?
In any case, there is nothing that can be done about it on the gcc side

------------------------------------------------------------------------
[2016-09-19 12:20:39] spam2 at rhsoft dot net

the problem is that "make prof-use" don't do anything while
"-Wno-coverage-mismatch" is a dirty workaround for now - "-always-make" should
not be needed

that sequence should work out-of-the-box instead "make prof-use" thingink "oh,
already built, nothing to do"

make prof-gen
make test
make prof-use

------------------------------------------------------------------------
[2016-09-19 11:49:34] nikic@php.net

Without having looked into it, I suspect that the error you got in your last comment is because
--always-make forces a regeneration of the lexer and you have a different re2c version installed
which was used to generate the lexer in the repo, so you end up with minor differences in control
flow. It will likely work if you run the whole thing (including profile generation) a second time.

------------------------------------------------------------------------
[2016-09-19 11:43:31] spam2 at rhsoft dot net

"make --always-make" seems to help partially

echo "PROFILE-GUIDED-OPTIMIZATION: Stage 1"
make %{?_smp_mflags} prof-gen
/rpmbuild/PHP-PGO/profile.sh $PWD
echo "PROFILE-GUIDED-OPTIMIZATION: Stage 2"
make --always-make %{?_smp_mflags} prof-use

but:

Zend/zend_language_scanner.l:2406:1: error: the control flow of function 'lex_scan' does
not match its profile data (counter 'indirect_call') [-Werror=coverage-mismatch]
Zend/zend_language_scanner.l:2406:1: error: the control flow of function 'lex_scan' does
not match its profile data (counter 'time_profiler') [-Werror=coverage-mismatch]
cc1: some warnings being treated as errors
Makefile:1721: recipe for target 'Zend/zend_ini_scanner.lo' failed
make[1]: *** [Zend/zend_ini_scanner.lo] Error 1
cc1: some warnings being treated as errors
Makefile:1717: recipe for target 'Zend/zend_language_scanner.lo' failed
make[1]: *** [Zend/zend_language_scanner.lo] Error 1
make[1]: Leaving directory '/home/builduser/rpmbuild/BUILD/php-7.0.11'
Makefile:302: recipe for target 'prof-use' failed
make: *** [prof-use] Error 2
Fehler: Fehler-Status beim Beenden von /var/tmp/rpm-tmp.1UuVW4 (%build)

------------------------------------------------------------------------
[2016-09-19 08:21:56] spam2 at rhsoft dot net

Description:
------------
make prof-gen
make test
make prof-use

the "make prof-use" just takes a second while i would expect a full compile using the
gcda-files filled with informations wude running "make test" and that part works becuase
while "make test" is running the timestamps of that files are changing

after that there is still the profiling code in the binaries because running it on another machine
at httpd startup you see these messages in the apache-errorlog

profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/zlib/.libs/zlib.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/pcre/.libs/php_pcre.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/libxml/.libs/libxml.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/interval.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/parse_iso_intervals.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/unixtime2tm.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/tm2unixtime.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/timelib.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/parse_tz.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/parse_date.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/dow.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/.libs/astro.gcda:Skip
profiling:/home/builduser:Cannot create directory
profiling:/home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/.libs/php_date.gcda:Ski

Test script:
---------------
make prof-gen
make test
make prof-use

yes, i know that "make test" is probably not the best thing for PGO but a good start to
get the build-process implemented and then replace it with running custom php-code and "make
test" at the end with the final build

Expected result:
----------------
a final PGO build without the profiling code

Actual result:
--------------
binaries which stil contain profiling code after "make prof-use"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73111&edit=1


Thread (15 messages)

« previous php.bugs (#204341) next »