public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: MAHESH BODAPATI <bmahi496@linux.ibm.com>, libc-alpha@sourceware.org
Cc: rajis@linux.ibm.com, bergner@linux.ibm.com,
	Mahesh Bodapati <mahesh.bodapati@ibm.com>
Subject: Re: [PATCH v5] PowerPC: Influence cpu/arch hwcap features via GLIBC_TUNABLES.
Date: Tue, 11 Jul 2023 13:23:00 -0300	[thread overview]
Message-ID: <26880933-6ff7-dedc-8dcb-44aa8000e848@linaro.org> (raw)
In-Reply-To: <a52e69ce-c6ba-771c-63a8-b710447eb69e@linux.ibm.com>



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 <mahesh.bodapati@ibm.com>
>>>
>>> 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).

  reply	other threads:[~2023-07-11 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 18:21 bmahi496
2023-07-10 21:28 ` Peter Bergner
2023-07-11 12:24   ` Adhemerval Zanella Netto
2023-07-11 16:05     ` MAHESH BODAPATI
2023-07-11 13:45 ` Adhemerval Zanella Netto
2023-07-11 16:03   ` MAHESH BODAPATI
2023-07-11 16:23     ` Adhemerval Zanella Netto [this message]
2023-07-11 16:23     ` Adhemerval Zanella Netto
2023-07-12 11:04       ` MAHESH BODAPATI
2023-07-12 14:07         ` Adhemerval Zanella Netto
2023-07-13 13:17           ` MAHESH BODAPATI

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=26880933-6ff7-dedc-8dcb-44aa8000e848@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=bergner@linux.ibm.com \
    --cc=bmahi496@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mahesh.bodapati@ibm.com \
    --cc=rajis@linux.ibm.com \
    /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: link
Be 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).