Bug 385868 - glibc ld.so _dl_runtime_resolve_avx_slow conditional jump warning
Summary: glibc ld.so _dl_runtime_resolve_avx_slow conditional jump warning
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.13.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-17 15:56 UTC by Mark Wielaard
Modified: 2017-10-20 13:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case workaround (5.38 KB, patch)
2017-10-17 15:57 UTC, Mark Wielaard
Details
Add default suppression for _dl_runtime_resolve_avx_slow (1.38 KB, patch)
2017-10-17 15:58 UTC, Mark Wielaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2017-10-17 15:56:55 UTC
glibc ld.so has an optimization when resolving a symbol that checks
whether or not the upper 128 bits of the ymm registers are zero. If
so it uses "cheaper" instructions to save/restore them using the xmm
registers. If those upper 128 bits contain undefined values memcheck
will issue an Conditional jump or move depends on uninitialised value(s)
warning whenever trying to resolve a symbol.

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/dl-trampoline.h#l53

Apparently it is cheaper to check the upper bits are set than to invoke AVX unnecessarily (it is more energy efficient if you only use sse instructions on some CPUs so the cores don't have to "power up" the full AVX engine).

This triggers in our sh-mem-vecxxx test cases because we there explicitly make sure those bits are (partially) undefined.

We can workaround it my just resolving all symbols early. Which is what my first patch does.

But Tom Hughes said it might be better to make this a generic default suppression. I haven't seen this trigger outside the testsuite. But I guess that does make sense. That is patch number 2.
Comment 1 Mark Wielaard 2017-10-17 15:57:56 UTC
Created attachment 108407 [details]
Test case workaround
Comment 2 Mark Wielaard 2017-10-17 15:58:45 UTC
Created attachment 108408 [details]
Add default suppression for _dl_runtime_resolve_avx_slow
Comment 3 Mark Wielaard 2017-10-20 12:19:01 UTC
I went with the global suppression instead of the testcase workaround.

commit f844689f858d4bb744e59eadaaf984d3fd0b5b50
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Oct 17 17:49:26 2017 +0200

    Suppress _dl_runtime_resolve_avx_slow for memcheck conditional.
Comment 4 John Reiser 2017-10-20 12:52:22 UTC
Please state the version of glibc ld.so where this problem was observed.  That bounds the search for interactions between software.  The link to ld.so code at sourceware.org only points to the current version, so can become stale.
Comment 5 Mark Wielaard 2017-10-20 13:12:16 UTC
(In reply to John Reiser from comment #4)
> Please state the version of glibc ld.so where this problem was observed. 
> That bounds the search for interactions between software.  The link to ld.so
> code at sourceware.org only points to the current version, so can become
> stale.

glibc-2.17-196.el7.x86_64 (probably had the code backported) and glibc-2.25-10.fc26.x86_64