From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by sourceware.org (Postfix) with ESMTPS id BAF513858D1E for ; Tue, 11 Jul 2023 16:23:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAF513858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-56368c40e8eso3668431eaf.0 for ; Tue, 11 Jul 2023 09:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689092584; x=1691684584; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=fZPwQiUJNtheIx+FscKyLG8vmk9b+A/Mv/Wa+WUL0vU=; b=CE42NPrYFhXbvwVc4GPcZfCDcVf3q6+o0RozzhE1DJ4BfHoWeKOnA3InTnHTrx/AqR mQUubUBf4+vL6Z5MgeJ7VOZyJQd1eRa6iQS7rICJEGYTeX4uJ/NH7PBnBz4DgVlBFeb4 nYqALS+2UTBpB+EJ35jcCTBe/3QMwF7SxBdJ3IDdDfnPLBpdLhc6lhBWXj1Zfj9nsguo u1ENSTWVEOoXKStVM38oo3W0h4IIEe5HBAiQkXmMwQFBAFdBqFVZi1R7jXlFSgfbntVU oSRU81J7NEN80MpLLY2dmG1ggkTM4N5Aq2/FhTw4MpRnQ10jUXDpLT3HPclNvpaha6n9 8sfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689092584; x=1691684584; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fZPwQiUJNtheIx+FscKyLG8vmk9b+A/Mv/Wa+WUL0vU=; b=KX5+7IvRM8AvbMvNCykXTG/V1/G6hp4+BNTj7eVEJCmazMG90seeE+IdU+RE7WyRsa EJuRTijE6TBw9PWiXKx1kVqCF54vLiFluwJBaqSu6VVZECAiK7sKnO3S6hEy6CiJmGQc fjcZ8FMLRmmUjKj/1DfUuH3ucQZUicdfQ0TA4Ga5Wmk6Au0aE8XU8HIiyAUzMtvCfSse k6ErftDN6aT1SbHK9Rz59ZjPz+l/U6unkISYHjxlYzo+uiaxiuQmiVBHPJm+v+0TMiB6 ESFuwDt/KvvkQ1a/k0D/PSw7KRDXgwDIvW1LS7ict8VLPycjSS0RNTvVnV7pE2wO19aC KwBQ== X-Gm-Message-State: ABy/qLYVb5pDpNr0z6AD+WBALBtf2gOgV3DDOTBvkJe72TlE3glvbFfm ueZJQmaL5i6d5hGQE/mKGX3dJpf3+jJ7FdNXMGSqBw== X-Google-Smtp-Source: APBJJlFNxlRaDVSrx1zYCWMVpGzwFRc5Mj0Jp/9fHlXZTpWUFd3ZIf6KqXbhAv6Hh/8r3nEXChvSig== X-Received: by 2002:a4a:e81b:0:b0:563:3a08:1cb4 with SMTP id b27-20020a4ae81b000000b005633a081cb4mr10816768oob.0.1689092584605; Tue, 11 Jul 2023 09:23:04 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c3:e0c8:142d:91c0:e0dd:736d? ([2804:1b3:a7c3:e0c8:142d:91c0:e0dd:736d]) by smtp.gmail.com with ESMTPSA id 184-20020a4a01c1000000b005634e8c4bbdsm985466oor.11.2023.07.11.09.23.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jul 2023 09:23:03 -0700 (PDT) Message-ID: <26880933-6ff7-dedc-8dcb-44aa8000e848@linaro.org> Date: Tue, 11 Jul 2023 13:23:00 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v5] PowerPC: Influence cpu/arch hwcap features via GLIBC_TUNABLES. Content-Language: en-US To: MAHESH BODAPATI , libc-alpha@sourceware.org Cc: rajis@linux.ibm.com, bergner@linux.ibm.com, Mahesh Bodapati References: <20230710182150.2376678-1-bmahi496@linux.ibm.com> <2b71d409-0649-f47c-0626-f4726456256d@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/07/23 13:03, MAHESH BODAPATI wrote: > > On 11/07/23 7:15 pm, Adhemerval Zanella Netto wrote: >> On 10/07/23 15:21, bmahi496@linux.ibm.com wrote: >>> From: Mahesh Bodapati >>> >>> This patch enables the option to influence hwcaps used by PowerPC. >>> The environment variable, GLIBC_TUNABLES=glibc.cpu.hwcaps=-xxx,yyy,-zzz...., >>> can be used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature xxx >>> and zzz, where the feature name is case-sensitive and has to match the ones >>> mentioned in the file{sysdeps/powerpc/dl-procinfo.c}. >>> >>> Note that the tunable only handles the features which are really used >>> in the IFUNC selection. All others are ignored as the values are only >>> used inside glibc. >> It is still missing a regression test to check if tunable work as intended. > > > I ran glibc tests with and without setting hwcap tunables and no regressions were found. > Summary of test results: >    4458 PASS >       9 UNSUPPORTED >      16 XFAIL >       2 XPASS > > The runtime behavior is as expected when we set hwcap tunables. > We tested on power10,power9 BE and powerpc32 machines and the results were good. > Could you go through the attached sheet ,we have listed runtime behavior for some of the tunable options. > We are not sure on how to add regressions tests for tunable feature. > I didn't see hwcap tunable specific tests added for other targets as well. There are only tests for x86, so running the tests won't really exercise this code path for powerpc: $ git grep glibc.cpu.hwcaps manual/tunables.texi:glibc.cpu.hwcaps: manual/tunables.texi:@deftp Tunable glibc.cpu.hwcaps manual/tunables.texi:The @code{glibc.cpu.hwcaps=-xxx,yyy,-zzz...} tunable allows the user to sysdeps/s390/cpu-features.c: GLIBC_TUNABLES=glibc.cpu.hwcaps=-xxx,yyy,zzz,.... sysdeps/x86/Makefile:tst-ifunc-isa-2-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SSE4_2,-AVX,-AVX2,-AVX512F sysdeps/x86/Makefile:tst-cet-legacy-5b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/Makefile:tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/Makefile:tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/Makefile:tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/cpu-features.c: GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/cpu-tunables.c: GLIBC_TUNABLES=glibc.cpu.hwcaps=-xxx,yyy,-zzz,.... sysdeps/x86/dl-cet.c: GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK sysdeps/x86/include/cpu-features.h: GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC sysdeps/x86/tst-cet-legacy-9.c: -fcf-protection and GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK. */ sysdeps/x86_64/Makefile: GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX2 Since testing depending of the auxv returned values from kernel and there is no easy way to override it, one possibility is to get the current hwcap/hwcap2, and spawn a new process with GLIBC_TUNABLES masking some bits, and check the result hwcap/hwcap2 to see if it matches the masked value. You may add multiple tests and mark them UNSUPPORTED if the hwcap does not contain the expected bits (for instance ISA 2.07 or ISA 3.0).