Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented May 8, 2019

@gmaxwell
Copy link
Contributor

gmaxwell commented May 8, 2019

@jamesob any chance you can benchmark?

@jamesob
Copy link
Contributor

jamesob commented May 8, 2019

@gmaxwell yep, running now.

@sipa sipa mentioned this pull request May 8, 2019
@jamesob
Copy link
Contributor

jamesob commented May 9, 2019

Performance came back negligibly different, though I'm not totally sure this PR worked for me as intended. I double-checked to see if -fstack-reuse=none made it into the build parameters, and I don't see it in any Makefiles after configuration (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609):

Wed 8 20:32 james/.bitcoinperf/fad88bd6c9f85e6e7f8fb66a94aa75c67d26b7d8
$ grep -R 'fstack-reuse' .

./autom4te.cache/output.0:{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fstack-reuse=none" >&5
./autom4te.cache/output.0:$as_echo_n "checking whether C++ compiler accepts -fstack-reuse=none... " >&6; }
./autom4te.cache/output.0:  CXXFLAGS="$CXXFLAGS  -fstack-reuse=none"
./autom4te.cache/output.0:  HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"
./autom4te.cache/traces.0:m4trace:configure.ac:737: -1- AX_CHECK_COMPILE_FLAG([-fstack-reuse=none], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])

In any case, here's the bench data:

ibd local 500005 505000 dbcache=2048

1905-buildStackReuseNone vs. master (absolute)

bench name x 1905-buildStackReuseNone master
ibd.local.500005.505000.dbcache=2048 3 304.0416 (± 3.5953) 312.8965 (± 4.2451)
ibd.local.500005.505000.dbcache=2048.mem-usage 3 2463438.6667 (± 3039.5620) 2462478.0000 (± 5874.0000)
build.make.7.gcc 1 302.9981 (± 0.0000)
build.make.7.gcc.mem-usage 1 1024568.0000 (± 0.0000)
ibd.local.500000.505000.dbcache=2048 1 315.0404 (± 0.0000)
ibd.local.500000.505000.dbcache=2048.mem-usage 1 2458576.0000 (± 0.0000)

1905-buildStackReuseNone vs. master (relative)

bench name x 1905-buildStackReuseNone master
ibd.local.500005.505000.dbcache=2048 3 1.00 1.029
ibd.local.500005.505000.dbcache=2048.mem-usage 3 1.00 1.000
build.make.7.gcc 1 1.00
build.make.7.gcc.mem-usage 1 1.00
ibd.local.500000.505000.dbcache=2048 1 1.00
ibd.local.500000.505000.dbcache=2048.mem-usage 1 1.00

@maflcko
Copy link
Member Author

maflcko commented May 9, 2019

It should be supported for all versions of gcc we support: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Code-Gen-Options.html

I had to run ./autogen.sh && ./configure for it to end up in the CXXFLAGS (they are printed at the end of ./configure)

Also, the results of the micro benchmarks would be useful.

@maflcko
Copy link
Member Author

maflcko commented May 9, 2019

@laanwj
Copy link
Member

laanwj commented May 14, 2019

  • Tested that build with clang still works, it rejects the argument as expected:
configure:23543: checking whether C++ compiler accepts -fstack-reuse=none
configure:23562: /opt/clang90/bin/clang++ -std=c++11 -c -g -O2  -fstack-reuse=none -ggdb -DLIBEVENT_EXPERIMENTAL -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp >&5
clang-9: error: unknown argument: '-fstack-reuse=none'
configure:23562: $? = 1
  • Checked that the argument is successfully passed for gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0
configure:23543: checking whether C++ compiler accepts -fstack-reuse=none
configure:23562: g++ -std=c++11 -c -O2 -g  -fstack-reuse=none  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS conftest.cpp >&5
configure:23562: $? = 0
configure:23570: result: yes
$ make V=1
Making all in src
...
/bin/bash ../libtool  --tag=CXX --preserve-dup-deps  --mode=compile /usr/bin/ccache g++ -std=c++11 ...-fstack-reuse=none ...`crypto/chacha20.cpp

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK fad88bd6c9f85e6e7f8fb66a94aa75c67d26b7d8. Not tested, but config file change looks right and should do what's described.

@maflcko maflcko force-pushed the 1905-buildStackReuseNone branch from fad88bd to fae91e3 Compare May 15, 2019 19:15
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK fae91e3b19627cba63f05caa18eb990888684036. Just new comment added.

@maflcko maflcko force-pushed the 1905-buildStackReuseNone branch from fae91e3 to faf38bc Compare May 15, 2019 19:41
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15985 (Add test for GCC bug 90348 by sipa)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko maflcko merged commit faf38bc into bitcoin:master May 16, 2019
maflcko pushed a commit that referenced this pull request May 16, 2019
faf38bc build with -fstack-reuse=none (MarcoFalke)

Pull request description:

  All versions of gcc that we commonly use for building are subject to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set `-fstack-reuse=none` for all builds. See #15959 (comment)

  This option does not exist for clang https://clang.llvm.org/docs/ClangCommandLineReference.html#target-independent-compilation-options, but it does for gcc https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

ACKs for commit faf38b:

Tree-SHA512: f5597583402d31ea7b89ac358a6f4a537bbb82a1dde2bd41bac65ee0fd88c7af75ee4c24c6b8eed6b139bf4dbf07ab2987f8fc30fb3eab179cd2d753a8a2a47d
@maflcko maflcko deleted the 1905-buildStackReuseNone branch May 16, 2019 14:07
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request May 16, 2019
pull bot pushed a commit to uniibu/bitcoin that referenced this pull request Jun 5, 2019
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
@fanquake
Copy link
Member

fanquake commented Jun 7, 2019

Included for backport in #16035.

@maflcko
Copy link
Member Author

maflcko commented Jun 7, 2019

@fanquake What about 17.2?

@fanquake
Copy link
Member

fanquake commented Jun 7, 2019

@MarcoFalke I'll do that now so it's not forgotten.

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Jun 7, 2019
@fanquake
Copy link
Member

fanquake commented Jun 7, 2019

Done in #16163.

laanwj added a commit that referenced this pull request Jun 13, 2019
… case

b5a4abe Add test for GCC bug 90348 (Pieter Wuille)
05fb9f7 build with -fstack-reuse=none (MarcoFalke)

Pull request description:

  Backports:

  * [build with -fstack-reuse=none](#15983)
  * [Add test for GCC bug 90348](#15985)

  b5a4abe has been modified to replace the `setup_common.h` with `test_bitcoin.h` include.

ACKs for commit b5a4ab:
  Empact:
    ACK b5a4abe by review of the linked PRs, the GCC bug and option, and visual inspection/comparison of the ported code
  laanwj:
    Code review + relevancy for backport ACK b5a4abe

Tree-SHA512: cdfdc6e2f208e8dc6a8a86cd7a7ed0f2a6f96604a0663efc970f580f693c1975353341fa8434b23de3cb681e03c6918e3342178752ed595d16a0ec50db913266
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 23, 2019
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Aug 24, 2019
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
faf38bc build with -fstack-reuse=none (MarcoFalke)

Pull request description:

  All versions of gcc that we commonly use for building are subject to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set `-fstack-reuse=none` for all builds. See bitcoin#15959 (comment)

  This option does not exist for clang https://clang.llvm.org/docs/ClangCommandLineReference.html#target-independent-compilation-options, but it does for gcc https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

ACKs for commit faf38b:

Tree-SHA512: f5597583402d31ea7b89ac358a6f4a537bbb82a1dde2bd41bac65ee0fd88c7af75ee4c24c6b8eed6b139bf4dbf07ab2987f8fc30fb3eab179cd2d753a8a2a47d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 10, 2021
faf38bc build with -fstack-reuse=none (MarcoFalke)

Pull request description:

  All versions of gcc that we commonly use for building are subject to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set `-fstack-reuse=none` for all builds. See bitcoin#15959 (comment)

  This option does not exist for clang https://clang.llvm.org/docs/ClangCommandLineReference.html#target-independent-compilation-options, but it does for gcc https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

ACKs for commit faf38b:

Tree-SHA512: f5597583402d31ea7b89ac358a6f4a537bbb82a1dde2bd41bac65ee0fd88c7af75ee4c24c6b8eed6b139bf4dbf07ab2987f8fc30fb3eab179cd2d753a8a2a47d
barton2526 added a commit to barton2526/Gridcoin-Research that referenced this pull request Jul 13, 2021
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 9, 2021
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants