All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv3 02/15] core: introduce BR2_ENABLE_RUNTIME_DEBUG
Date: Tue, 25 May 2021 14:27:37 +0200	[thread overview]
Message-ID: <20210525122750.5022-3-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20210525122750.5022-1-patrickdepinguin@gmail.com>

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Some packages have optional runtime assertions, extra traces, or other
elements that can help in debugging problems. However, such runtime elements
can negatively influence performance.

In a test program performing 100K gRPC calls from a client to a local server
and receiving the returned response, we see following execution time:

    - runtime debug enabled: 1065 seconds
    - runtime debug disabled:  48 seconds

This is more than a factor 20 (!) difference. Analysis shows that the
problem mostly stems from libabseil-cpp (a dependency of gRPC) which enables
mutex deadlock analysis when the preprocessor flag 'NDEBUG' is not set,
which adds a 'backtrace()' call on every lock/unlock.  Potentially worse,
when libunwind is enabled and linked with the test program, 'backtrace()' is
not provided by glibc but by libunwind itself.

For production systems, users expect good performance out-of-the-box. In the
example above, the difference is huge and unless explicitly tested and
analyzed, users may not realize that the performance could be much better.

Address this problem by introducing a new option BR2_ENABLE_RUNTIME_DEBUG,
which can be used by packages or package infrastructures to set the
necessary flags.

Note that BR2_ENABLE_RUNTIME_DEBUG is orthogonal to BR2_ENABLE_DEBUG: the
former changes runtime behavior, while the latter is only expected to add
debug symbols to the build. Today, the cmake build system does introduce a
runtime impact when BR2_ENABLE_DEBUG is set, but that will be rectified in a
subsequent commit.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 Config.in | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Config.in b/Config.in
index c65e34bd5e..a008425688 100644
--- a/Config.in
+++ b/Config.in
@@ -412,6 +412,19 @@ config BR2_DEBUG_3
 endchoice
 endif
 
+config BR2_ENABLE_RUNTIME_DEBUG
+	bool "build packages with runtime debugging info"
+	help
+	  Some packages may have runtime assertions, extra traces, and
+	  similar runtime elements that can help debugging. However,
+	  these elements may negatively influence performance so should
+	  normally not be enabled on production systems.
+
+	  Enable this option to enable such runtime debugging.
+
+	  Note: disabling this option is not a guarantee that all
+	  packages effectively removed these runtime debugging elements.
+
 config BR2_STRIP_strip
 	bool "strip target binaries"
 	default y
-- 
2.26.3

  parent reply	other threads:[~2021-05-25 12:27 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 12:27 [Buildroot] [PATCHv3 00/15] Introduce BR2_ENABLE_RUNTIME_DEBUG Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 01/15] package/Makefile.in: pass '-g0' explicitly if !BR2_ENABLE_DEBUG Thomas De Schampheleire
2021-05-25 20:30   ` Arnout Vandecappelle
2021-05-25 12:27 ` Thomas De Schampheleire [this message]
2021-05-25 20:34   ` [Buildroot] [PATCHv3 02/15] core: introduce BR2_ENABLE_RUNTIME_DEBUG Arnout Vandecappelle
2021-06-01 14:17     ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 03/15] package/pkg-cmake.mk: determine CMAKE_BUILD_TYPE depending on BR2_ENABLE_RUNTIME_DEBUG Thomas De Schampheleire
2021-05-25 20:47   ` Arnout Vandecappelle
2021-05-25 12:27 ` [Buildroot] [PATCHv3 04/15] package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE Thomas De Schampheleire
2021-05-25 20:51   ` Arnout Vandecappelle
2021-05-26 14:28     ` Thomas De Schampheleire
2021-05-26 15:18       ` Arnout Vandecappelle
2021-05-28 11:50         ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 05/15] package/sysrepo: use default CMAKE_BUILD_TYPE for host package Thomas De Schampheleire
2021-05-25 20:54   ` Arnout Vandecappelle
2021-05-26  9:19     ` Heiko Thiery
2021-05-25 12:27 ` [Buildroot] [PATCHv3 06/15] package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE Thomas De Schampheleire
2021-05-25 20:56   ` Arnout Vandecappelle
2021-05-26  9:20     ` Heiko Thiery
2021-06-01 14:24     ` Thomas De Schampheleire
2021-06-01 14:39       ` Arnout Vandecappelle
2021-05-25 12:27 ` [Buildroot] [PATCHv3 07/15] package/boost: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG Thomas De Schampheleire
2021-05-25 21:17   ` Arnout Vandecappelle
2021-05-28 10:11     ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 08/15] package/oracle-mysql: " Thomas De Schampheleire
2021-05-25 21:18   ` Arnout Vandecappelle
2021-05-25 12:27 ` [Buildroot] [PATCHv3 09/15] package/qt5: " Thomas De Schampheleire
2021-05-25 21:24   ` Arnout Vandecappelle
2021-05-25 12:27 ` [Buildroot] [PATCHv3 10/15] package/ripgrep: " Thomas De Schampheleire
2021-05-25 21:28   ` Arnout Vandecappelle
2021-05-25 12:27 ` [Buildroot] [PATCHv3 11/15] package/sofia-sip: " Thomas De Schampheleire
2021-05-25 21:32   ` Arnout Vandecappelle
2021-05-28 18:35     ` Thomas De Schampheleire
2021-05-28 21:07       ` Arnout Vandecappelle
2021-05-31 10:44         ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 12/15] package/uclibc: " Thomas De Schampheleire
2021-05-25 21:43   ` Arnout Vandecappelle
2021-05-28 18:49     ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 13/15] package/zmqpp: " Thomas De Schampheleire
2021-05-25 21:48   ` Arnout Vandecappelle
2021-05-31 10:30     ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 14/15] package/pkg-meson.mk: determine 'buildtype' based on " Thomas De Schampheleire
2021-05-28 21:01   ` Arnout Vandecappelle
2021-05-31 10:02     ` Thomas De Schampheleire
2021-05-25 12:27 ` [Buildroot] [PATCHv3 15/15] utils/genrandconfig: also test BR2_ENABLE_RUNTIME_DEBUG Thomas De Schampheleire
2021-05-25 21:50   ` Arnout Vandecappelle
2021-05-25 20:32 ` [Buildroot] [PATCHv3 00/15] Introduce BR2_ENABLE_RUNTIME_DEBUG Arnout Vandecappelle

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=20210525122750.5022-3-patrickdepinguin@gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.