From patchwork Fri Jul 23 02:25:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1508932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=h/l4tG+s; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GWCqN6lyGz9sWS for ; Fri, 23 Jul 2021 12:26:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A4D63892029 for ; Fri, 23 Jul 2021 02:26:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A4D63892029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627007166; bh=re/UbYAK09gP6rnIAh/Qmqs/y6K+sEO2DYU1UBK+eMk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=h/l4tG+stoM6paJtViwCsPPlQjsoGRLT4iY+F8IVmiI/EEE0ofE5f+Fx6la0nH+oR 73W5Vc1kT0EFIDlNaxUvXmFEpW5xtH5NF41f8eM1nVxbEOzbJLeqoUZ5/bqse3bIsb lB7UqrZil/XvK/5CWkiXHjz2/mFC8FXrwUJoFtMk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from crocodile.elm.relay.mailchannels.net (crocodile.elm.relay.mailchannels.net [23.83.212.45]) by sourceware.org (Postfix) with ESMTPS id 9B8F3385742A for ; Fri, 23 Jul 2021 02:25:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B8F3385742A X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3AF45361901; Fri, 23 Jul 2021 02:25:49 +0000 (UTC) Received: from pdx1-sub0-mail-a30.g.dreamhost.com (100-96-18-103.trex-nlb.outbound.svc.cluster.local [100.96.18.103]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C3472361C1D; Fri, 23 Jul 2021 02:25:48 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a30.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.18.103 (trex/6.3.3); Fri, 23 Jul 2021 02:25:49 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Stretch-Duck: 25b6c965650d2377_1627007149067_936641342 X-MC-Loop-Signature: 1627007149067:3220392730 X-MC-Ingress-Time: 1627007149067 Received: from pdx1-sub0-mail-a30.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a30.g.dreamhost.com (Postfix) with ESMTP id 889DD7E6D6; Thu, 22 Jul 2021 19:25:48 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a30.g.dreamhost.com (Postfix) with ESMTPSA id 2FAE37E433; Thu, 22 Jul 2021 19:25:43 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a30 To: libc-alpha@sourceware.org Subject: [PATCH] Fix build and tests with --disable-tunables Date: Fri, 23 Jul 2021 07:55:30 +0530 Message-Id: <20210723022530.268766-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <87pmvab0cp.fsf@linux.ibm.com> References: <87pmvab0cp.fsf@linux.ibm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3494.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Remove unused code and declare __libc_mallopt when !IS_IN (libc) to allow the debug hook to build with --disable-tunables. Also, run tst-ifunc-isa-2* tests only when tunables are enabled since the result depends on it. Tested on x86_64. Reported-by: Matheus Castanho Reviewed-by: Carlos O'Donell --- It's a trivial non-ABI change that is needed to get --disable-tunables working correctly, so I'll push this if there are no objections. malloc/arena.c | 5 ----- malloc/malloc-check.c | 2 ++ malloc/malloc.c | 51 ++++++++++++++++++++++--------------------- sysdeps/x86/Makefile | 8 +++++-- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/malloc/arena.c b/malloc/arena.c index edcaa8816d..667484630e 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -332,7 +332,6 @@ ptmalloc_init (void) # endif TUNABLE_GET (mxfast, size_t, TUNABLE_CALLBACK (set_mxfast)); #else - const char *s = NULL; if (__glibc_likely (_environ != NULL)) { char **runp = _environ; @@ -351,10 +350,6 @@ ptmalloc_init (void) switch (len) { - case 6: - if (memcmp (envline, "CHECK_", 6) == 0) - s = &envline[7]; - break; case 8: if (!__builtin_expect (__libc_enable_secure, 0)) { diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c index a444c7478e..8ed67de3ff 100644 --- a/malloc/malloc-check.c +++ b/malloc/malloc-check.c @@ -376,6 +376,7 @@ memalign_check (size_t alignment, size_t bytes) return mem2mem_check (tag_new_usable (mem), bytes); } +#if HAVE_TUNABLES static void TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp) { @@ -383,6 +384,7 @@ TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp) if (value != 0) __malloc_debug_enable (MALLOC_CHECK_HOOK); } +#endif static bool initialize_malloc_check (void) diff --git a/malloc/malloc.c b/malloc/malloc.c index 38b649fcba..e065785af7 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -687,31 +687,6 @@ void* __libc_valloc(size_t); -/* - mallopt(int parameter_number, int parameter_value) - Sets tunable parameters The format is to provide a - (parameter-number, parameter-value) pair. mallopt then sets the - corresponding parameter to the argument value if it can (i.e., so - long as the value is meaningful), and returns 1 if successful else - 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, - normally defined in malloc.h. Only one of these (M_MXFAST) is used - in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, - so setting them has no effect. But this malloc also supports four - other options in mallopt. See below for details. Briefly, supported - parameters are as follows (listed defaults are for "typical" - configurations). - - Symbol param # default allowed param values - M_MXFAST 1 64 0-80 (0 disables fastbins) - M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming) - M_TOP_PAD -2 0 any - M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support) - M_MMAP_MAX -4 65536 any (0 disables use of mmap) -*/ -int __libc_mallopt(int, int); -libc_hidden_proto (__libc_mallopt) - - /* mallinfo() Returns (by copy) a struct containing various summary statistics: @@ -820,6 +795,32 @@ void __malloc_stats(void); int __posix_memalign(void **, size_t, size_t); #endif /* IS_IN (libc) */ +/* + mallopt(int parameter_number, int parameter_value) + Sets tunable parameters The format is to provide a + (parameter-number, parameter-value) pair. mallopt then sets the + corresponding parameter to the argument value if it can (i.e., so + long as the value is meaningful), and returns 1 if successful else + 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, + normally defined in malloc.h. Only one of these (M_MXFAST) is used + in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, + so setting them has no effect. But this malloc also supports four + other options in mallopt. See below for details. Briefly, supported + parameters are as follows (listed defaults are for "typical" + configurations). + + Symbol param # default allowed param values + M_MXFAST 1 64 0-80 (0 disables fastbins) + M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming) + M_TOP_PAD -2 0 any + M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support) + M_MMAP_MAX -4 65536 any (0 disables use of mmap) +*/ +int __libc_mallopt(int, int); +#if IS_IN (libc) +libc_hidden_proto (__libc_mallopt) +#endif + /* mallopt tuning options */ /* diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 346ec491b3..bd4f6a13b9 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -19,14 +19,18 @@ ifeq (yes,$(have-ifunc)) ifeq (yes,$(have-gcc-ifunc)) tests += \ tst-ifunc-isa-1 \ - tst-ifunc-isa-1-static \ + tst-ifunc-isa-1-static +tests-static += \ + tst-ifunc-isa-1-static +ifneq ($(have-tunables),no) +tests += \ tst-ifunc-isa-2 \ tst-ifunc-isa-2-static tests-static += \ - tst-ifunc-isa-1-static \ tst-ifunc-isa-2-static endif endif +endif ifeq (yes,$(enable-x86-isa-level)) tests += tst-isa-level-1 modules-names += tst-isa-level-mod-1-baseline \