From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id DE2593858C66; Fri, 28 Apr 2023 17:23:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE2593858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682702626; bh=cu1cPYI+qzi+1pkWMrCaEBVKlzGUNWkEvok/T66xGcw=; h=From:To:Subject:Date:From; b=BIDUM6IsQxentnDiAXi2eXJQtkXBJx6U1BZpwqbRmvoyiyiOSWACjn1nMH42f0Unl Ye6QQteHUhcXMc1Uq08J2BPfvm010OBoLkuV4oUmsfpIMc5o6qoWKYKXrflueDNlFl IQAiq3ZGM77oVjXzK3MJzgkWYa6WIypdGNwttmEE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.34/master] gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/release/2.34/master X-Git-Oldrev: f1b15d2005f5125529171db3be39026a1157c2a8 X-Git-Newrev: 0ea8174d62263c2679c95c0d215d2627e560f7aa Message-Id: <20230428172346.DE2593858C66@sourceware.org> Date: Fri, 28 Apr 2023 17:23:46 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0ea8174d62263c2679c95c0d215d2627e560f7aa commit 0ea8174d62263c2679c95c0d215d2627e560f7aa Author: Florian Weimer 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&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 #include -#if HAVE_TUNABLES -# define TUNABLE_NAMESPACE gmon -# include -#endif - #ifdef PIC # include @@ -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