Bug 1713658

Summary: valgrind does not recognise rdrand and f16c instructions on machines without avx2
Product: Red Hat Enterprise Linux 8 Reporter: Alexandra Petlanová Hájková <ahajkova>
Component: valgrindAssignee: Mark Wielaard <mjw>
valgrind sub component: system-version QA Contact: Alexandra Petlanová Hájková <ahajkova>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: fweimer, jakub, ohudlick
Version: 8.1Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: valgrind-3.15.0-9.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 20:51:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexandra Petlanová Hájková 2019-05-24 12:25:06 UTC
valgrind does not recognise rdrand and f16c instructions on machines without avx2 which makes none/tests/amd64/f16c and none/tests/amd64/rdrand tests fail

rpm -q valgrind
valgrind-3.15.0-4.el8.x86_64

/vg-in-place -v none/tests/amd64/rdrand 2>&1 | grep -i hwcaps
--6458-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-rdtscp-sse3-ssse3-avx

Comment 1 Mark Wielaard 2019-05-24 15:54:20 UTC
This caused by the following code in machine_get_hwcaps () coregrind/m_machine.c:

     /* Sanity check for RDRAND and F16C.  These don't actually *need* AVX2, but
        it's convenient to restrict them to the AVX2 case since the simulated
        CPUID we'll offer them on has AVX2 as a base. */
     if (!have_avx2) {
        have_f16c   = False;
        have_rdrand = False;
     }

This is somewhat lame. It could be argued that this is a testsuite bug, because it checks for support of f16c and rdrand on the host instead of under valgrind itself. But there really is no reason valgrind couldn't support f16c and rdrand in this case. It would need some surgery to the cpuid emulation code though.

Comment 2 Mark Wielaard 2019-05-27 23:09:48 UTC
Fix proposed upstream: https://bugs.kde.org/show_bug.cgi?id=408009

Comment 4 Alexandra Petlanová Hájková 2019-06-03 10:12:35 UTC
I verified rdrand and fc16 tests passes on machines with avx (without avx2) which supports rdrand and f16c instructions and are skipped and instread of failing on machines with avx or avx2 when the machine does not support such instructions.

Comment 6 errata-xmlrpc 2019-11-05 20:51:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:3346