public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: libc-help@sourceware.org
Cc: siddhesh@gotplt.org, goldstein.w.n@gmail.com, hjl.tools@gmail.com
Subject: glibc tunables to disable axv not updating memcpy
Date: Wed, 7 Dec 2022 19:47:43 -0800	[thread overview]
Message-ID: <6d615a11-b863-1d76-e0ce-1f064cda06f1@linux.dev> (raw)

Hi,

I've been playing with x86_64 tunables to see how they are plumbed into 
ifunc machinery, but running into a something which I don't understand 
(this is glibc 2.35 so pretty recent).

I'm disabling AVX and friends as:
export 
GLIBC_TUNABLES=glibc.cpu.hwcaps=--SSSE3,-SSE4_2,AVX,-AVX2,-AVX512F,-AVX512VL


A simple program which calls memcpy, seems to be calling 
__memmove_evex_unaligned_erms() despite my tunable disabling AVX512VL.

|
| main (argc=2, argv=0x7fffffffdce8) at test-mcpu.c:10
| 10		memcpy(dest, src, atoi(argv[1]));
| (gdb) s
| __memmove_evex_unaligned_erms () at 
../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:307
| 307	../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S


glibc dependency on AVX512VL for the said routine/

| 	      IFUNC_IMPL_ADD (array, i, memmove,
|			      CPU_FEATURE_USABLE (AVX512VL),
|			      __memmove_evex_unaligned_erms)
|

There used to be AVX*_Usable for tunables but it seems that was changed 
in 107e6a3c2212ba7a3a (" x86: Support usable check for all CPU features")

I also don't understand how the memcpy is being redirected to memmove, 
since assembler in test has a PLT call to memcpy.

LD_DEBUG=all doesn't print any ifunc related info.

I've tried hacking x86 elf_machine_lazy_rel() add dl_debug_printf() 
around R_X86_64_IRELATIVE - which seems to work but there's too less 
info to help answer the exact ifunc plumbing.

Any ideas where to look ?

Thx,
-Vineet



             reply	other threads:[~2022-12-08  3:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  3:47 Vineet Gupta [this message]
2022-12-08  8:31 ` Florian Weimer
2023-01-05  0:04   ` glibc ifunc debug (was Re: glibc tunables to disable axv not updating memcpy) Vineet Gupta

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=6d615a11-b863-1d76-e0ce-1f064cda06f1@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=goldstein.w.n@gmail.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-help@sourceware.org \
    --cc=siddhesh@gotplt.org \
    /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).