From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 3264B3861823 for ; Fri, 23 Jul 2021 04:56:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3264B3861823 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-523-_FdGPgWYPD2qRHgDl_ee9g-1; Fri, 23 Jul 2021 00:55:58 -0400 X-MC-Unique: _FdGPgWYPD2qRHgDl_ee9g-1 Received: by mail-qk1-f197.google.com with SMTP id b4-20020a3799040000b02903b899a4309cso290800qke.14 for ; Thu, 22 Jul 2021 21:55:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=4JYQty3C+T4Yfv4/hsndXlMOlIDojctTdfLkCH9XgHo=; b=GMcq9HGUKYOZjIgbj0Do90kUBhe1HyIZZFGDY/U69zPhXwPsSduDAVBpa9ApVRdi92 3pvIwvf/jZwCe/ZHs6PsikWaVrPnMaxAtOZypLeVOe3kgAHy1OWl1BhPEglbovpzJCUO SVuNEyg7nbCEDAksq/y+Q6HgJ2cKdixdvwkIevL0+XU4SeMPxSK+zWl/qYwnwyAQhhv5 K5yMclZirhO1coxmMVxYDvqz0gImG8InBZ6ecbyy4ou8lN2ZD6uB6Z7D+70fPCXJXfT4 wf+NkyR3sjk8ESa4cUFNMMyljtNuJfwHnb8D5fU6RGzuYJCyiVR5BfnNe+H0jO5gAKz7 ly0w== X-Gm-Message-State: AOAM532oqpaL3GwJLZkiQtQHwqE8Vd1GqnFw8HYvHiyR0XvdtPVkA+rO jndBDraqyy113zIiZ/XdrgkKw8B5DjJrisOAgeuATkYgcqI5rJsE1yM9zGM27Jh1qmVa1qRlZ8Y YlXEfK8TuLcNtnn78PGui X-Received: by 2002:a37:684f:: with SMTP id d76mr2942214qkc.357.1627016158372; Thu, 22 Jul 2021 21:55:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygsqB49EhABR/nKXw2nPh6JNXg6ILUQA/6H5W5KuvpvFzLwXhhZ1Gaw9NlcR7PUC+uVY9O3Q== X-Received: by 2002:a37:684f:: with SMTP id d76mr2942205qkc.357.1627016158206; Thu, 22 Jul 2021 21:55:58 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id j16sm1897374qkk.132.2021.07.22.21.55.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Jul 2021 21:55:57 -0700 (PDT) Subject: Re: [PATCH] Fix build and tests with --disable-tunables To: Siddhesh Poyarekar , libc-alpha@sourceware.org References: <87pmvab0cp.fsf@linux.ibm.com> <20210723022530.268766-1-siddhesh@sourceware.org> From: Carlos O'Donell Organization: Red Hat Message-ID: <7a2e3a07-71a5-4c65-5362-f533bf31ac67@redhat.com> Date: Fri, 23 Jul 2021 00:55:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210723022530.268766-1-siddhesh@sourceware.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-15.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable 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-List-Received-Date: Fri, 23 Jul 2021 04:56:01 -0000 On 7/22/21 10:25 PM, Siddhesh Poyarekar wrote: > 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. LGTM. Reviewed-by: Carlos O'Donell > Reported-by: Matheus Castanho > --- > > 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; OK. > 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; OK. > 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 OK. > > 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 OK. > ifeq (yes,$(enable-x86-isa-level)) > tests += tst-isa-level-1 > modules-names += tst-isa-level-mod-1-baseline \ > -- Cheers, Carlos.