Bug 1158802
| Summary: | are_valid_hwcaps() assertion fail makes valgrind unusable on (qemu emulated) Haswell x86_64 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Lubomir Rintel <lrintel> |
| Component: | valgrind | Assignee: | Mark Wielaard <mjw> |
| Status: | CLOSED ERRATA | QA Contact: | Miloš Prchlík <mprchlik> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.7 | CC: | jakub, mbenitez, mcermak, mfranc, mprchlik |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | valgrind-3.8.1-4.el6 | Doc Type: | Bug Fix |
| Doc Text: |
Valgrind assumed that a processor that supported the Advanced Vector Extensions 2 (AVX2) instruction set also always supported the Leading Zeros Count (LZCNT) instruction. This is not always true under QEMU, which can support AVX2 instructions, but not LZCNT. Consequently, Valgrind failed to run under QEMU when AVX2 instructions were enabled. Valgrind has been fixed to be able to run when the AVX2 instruction set is supported but the LZCNT instruction is not, and Valgrind now runs under QEMU as expected.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-07-22 06:23:48 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
Lubomir Rintel
2014-10-30 09:31:45 UTC
I'll try to replicate this issue. But in the meantime could you provide the output of "rpm -q valgrind" and "valgrind -v /bin/true" Thanks, Mark Got it replicated against valgrind-3.8.1-3.7.el6.x86_64 $ valgrind -v /bin/true ==4146== Memcheck, a memory error detector ==4146== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==4146== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==4146== Command: /bin/true ==4146== --4146-- Valgrind options: --4146-- -v --4146-- Contents of /proc/version: --4146-- Linux version 2.6.32-504.el6.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Tue Sep 16 01:56:35 EDT 2014 --4146-- Arch and hwcaps: AMD64, INVALID [...] As a quick workaround try valgrind from DTS-3, part of rhel-server-rhscl-6-rpms. devtoolset-3-valgrind-3.9.0-8.3.el6.x86_64 works on the same setup as expected. ==4182== Memcheck, a memory error detector ==4182== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==4182== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==4182== Command: /bin/true ==4182== --4182-- Valgrind options: --4182-- -v --4182-- Contents of /proc/version: --4182-- Linux version 2.6.32-504.el6.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Tue Sep 16 01:56:35 EDT 2014 --4182-- Arch and hwcaps: AMD64, amd64-cx16-rdtscp-sse3-avx-avx2-bmi [...] The issue is that the valgrind hwcaps check expects Haswell (actually AVX2 capable) CPUs to always have lzcnt available. That is true on real CPUs, but not under qemu.
Valgrind actually handles that combination fine, so the simplest fix is just to add this case to the hwcaps sanity check:
--- VEX/priv/main_main.c.orig 2014-11-03 20:15:32.647070331 +0100
+++ VEX/priv/main_main.c 2014-11-03 20:12:04.772687750 +0100
@@ -1147,6 +1147,10 @@
| VEX_HWCAPS_AMD64_BMI:
return "amd64-sse3-cx16-lzcnt-avx-bmi";
case VEX_HWCAPS_AMD64_SSE3 | VEX_HWCAPS_AMD64_CX16
+ | VEX_HWCAPS_AMD64_AVX
+ | VEX_HWCAPS_AMD64_BMI | VEX_HWCAPS_AMD64_AVX2:
+ return "amd64-sse3-cx16-avx2-bmi";
+ case VEX_HWCAPS_AMD64_SSE3 | VEX_HWCAPS_AMD64_CX16
| VEX_HWCAPS_AMD64_LZCNT | VEX_HWCAPS_AMD64_AVX
| VEX_HWCAPS_AMD64_BMI | VEX_HWCAPS_AMD64_AVX2:
return "amd64-sse3-cx16-lzcnt-avx2-bmi";
Upstream made this check much saner (which is why this issue isn't seen with valgrind 3.9.0 or later). See VEX svn r2701. But that introduces some other changes too.
If there is a way for qemu to pass-through the lzcnt cpuid flag (support is indicated via the CPUID.80000001H:ECX.ABM[Bit 5] flag), that would be another workaround.
Verified for build valgrind-3.8.1-7.el6. 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://rhn.redhat.com/errata/RHBA-2015-1298.html |