public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/release/2.34/master] gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI Date: Fri, 28 Apr 2023 17:23:46 +0000 (GMT) [thread overview] Message-ID: <20230428172346.DE2593858C66@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0ea8174d62263c2679c95c0d215d2627e560f7aa commit 0ea8174d62263c2679c95c0d215d2627e560f7aa Author: Florian Weimer <fweimer@redhat.com> Date: Fri Apr 28 17:07:38 2023 +0200 gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI Otherwise, processes are likely to crash during concurrent updates to a new glibc version on the stable release branch. The test gmon/tst-mcount-overflow depends on those tunables, so it has to be removed as well. Diff: --- gmon/Makefile | 14 +------------ gmon/gmon.c | 16 -------------- manual/tunables.texi | 59 ---------------------------------------------------- 3 files changed, 1 insertion(+), 88 deletions(-) diff --git a/gmon/Makefile b/gmon/Makefile index 7fd9db8f74..8aa17b28a4 100644 --- a/gmon/Makefile +++ b/gmon/Makefile @@ -26,7 +26,7 @@ include ../Makeconfig headers := sys/gmon.h sys/gmon_out.h sys/profil.h routines := gmon mcount profil sprofil prof-freq -tests = tst-sprofil tst-gmon tst-mcount-overflow tst-mcleanup +tests = tst-sprofil tst-gmon tst-mcleanup ifeq ($(build-profile),yes) tests += tst-profile-static tests-static += tst-profile-static @@ -57,18 +57,6 @@ ifeq ($(run-built-tests),yes) tests-special += $(objpfx)tst-gmon-gprof.out endif -CFLAGS-tst-mcount-overflow.c := -fno-omit-frame-pointer -pg -tst-mcount-overflow-no-pie = yes -CRT-tst-mcount-overflow := $(csu-objpfx)g$(start-installed-name) -# Intentionally use invalid config where maxarcs<minarcs to check warning is printed -tst-mcount-overflow-ENV := GMON_OUT_PREFIX=$(objpfx)tst-mcount-overflow.data \ - GLIBC_TUNABLES=glibc.gmon.minarcs=51:glibc.gmon.maxarcs=50 -# Send stderr into output file because we make sure expected messages are printed -tst-mcount-overflow-ARGS := 2>&1 1>/dev/null | cat -ifeq ($(run-built-tests),yes) -tests-special += $(objpfx)tst-mcount-overflow-check.out -endif - CFLAGS-tst-mcleanup.c := -fno-omit-frame-pointer -pg tst-mcleanup-no-pie = yes CRT-tst-mcleanup := $(csu-objpfx)g$(start-installed-name) diff --git a/gmon/gmon.c b/gmon/gmon.c index 5e99a7351d..97be1f72ca 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -46,11 +46,6 @@ #include <libc-internal.h> #include <not-cancel.h> -#if HAVE_TUNABLES -# define TUNABLE_NAMESPACE gmon -# include <elf/dl-tunables.h> -#endif - #ifdef PIC # include <link.h> @@ -130,20 +125,9 @@ __monstartup (u_long lowpc, u_long highpc) struct gmonparam *p = &_gmonparam; long int minarcs, maxarcs; -#if HAVE_TUNABLES - /* Read minarcs/maxarcs tunables. */ - minarcs = TUNABLE_GET (minarcs, int32_t, NULL); - maxarcs = TUNABLE_GET (maxarcs, int32_t, NULL); - if (maxarcs < minarcs) - { - ERR("monstartup: maxarcs < minarcs, setting maxarcs = minarcs\n"); - maxarcs = minarcs; - } -#else /* No tunables, we use hardcoded defaults */ minarcs = MINARCS; maxarcs = MAXARCS; -#endif /* * If we are incorrectly called twice in a row (without an diff --git a/manual/tunables.texi b/manual/tunables.texi index 436cefa85c..a3118bc48d 100644 --- a/manual/tunables.texi +++ b/manual/tunables.texi @@ -77,9 +77,6 @@ glibc.malloc.check: 0 (min: 0, max: 3) capabilities seen by @theglibc{} * Memory Related Tunables:: Tunables that control the use of memory by @theglibc{}. -* gmon Tunables:: Tunables that control the gmon profiler, used in - conjunction with gprof - @end menu @node Tunable names @@ -574,59 +571,3 @@ support in the kernel if this tunable has any non-zero value. The default value is @samp{0}, which disables all memory tagging. @end deftp - -@node gmon Tunables -@section gmon Tunables -@cindex gmon tunables - -@deftp {Tunable namespace} glibc.gmon -This tunable namespace affects the behaviour of the gmon profiler. -gmon is a component of @theglibc{} which is normally used in -conjunction with gprof. - -When GCC compiles a program with the @code{-pg} option, it instruments -the program with calls to the @code{mcount} function, to record the -program's call graph. At program startup, a memory buffer is allocated -to store this call graph; the size of the buffer is calculated using a -heuristic based on code size. If during execution, the buffer is found -to be too small, profiling will be aborted and no @file{gmon.out} file -will be produced. In that case, you will see the following message -printed to standard error: - -@example -mcount: call graph buffer size limit exceeded, gmon.out will not be generated -@end example - -Most of the symbols discussed in this section are defined in the header -@code{sys/gmon.h}. However, some symbols (for example @code{mcount}) -are not defined in any header file, since they are only intended to be -called from code generated by the compiler. -@end deftp - -@deftp Tunable glibc.mem.minarcs -The heuristic for sizing the call graph buffer is known to be -insufficient for small programs; hence, the calculated value is clamped -to be at least a minimum size. The default minimum (in units of -call graph entries, @code{struct tostruct}), is given by the macro -@code{MINARCS}. If you have some program with an unusually complex -call graph, for which the heuristic fails to allocate enough space, -you can use this tunable to increase the minimum to a larger value. -@end deftp - -@deftp Tunable glibc.mem.maxarcs -To prevent excessive memory consumption when profiling very large -programs, the call graph buffer is allowed to have a maximum of -@code{MAXARCS} entries. For some very large programs, the default -value of @code{MAXARCS} defined in @file{sys/gmon.h} is too small; in -that case, you can use this tunable to increase it. - -Note the value of the @code{maxarcs} tunable must be greater or equal -to that of the @code{minarcs} tunable; if this constraint is violated, -a warning will printed to standard error at program startup, and -the @code{minarcs} value will be used as the maximum as well. - -Setting either tunable too high may result in a call graph buffer -whose size exceeds the available memory; in that case, an out of memory -error will be printed at program startup, the profiler will be -disabled, and no @file{gmon.out} file will be generated. -@end deftp
reply other threads:[~2023-04-28 17:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230428172346.DE2593858C66@sourceware.org \ --to=fw@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).