Mark Wielaard 0ceac8
On a zEC12 or z13, a glibc with lock elision enabled infers from HWCAP
Mark Wielaard 0ceac8
that the prerequisites for lock elision are met.  Then it may use TBEGIN
Mark Wielaard 0ceac8
and other transactional-execution instructions which are not implemented
Mark Wielaard 0ceac8
by Valgrind.  Likewise, the upcoming glibc 2.23 will exploit vector
Mark Wielaard 0ceac8
instructions if they are advertised by HWCAP; and those are currently
Mark Wielaard 0ceac8
not implemented by Valgrind either.  In general, the increased use of
Mark Wielaard 0ceac8
ifunc may lead to more such cases in the future.
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8
This patch suppresses the advertising of those hardware features via
Mark Wielaard 0ceac8
HWCAP which are either not known to Valgrind or currently unsupported.
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).
Mark Wielaard 0ceac8
Fixes BZ #353680.
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8
Modified: trunk/README.s390
Mark Wielaard 0ceac8
==============================================================================
Mark Wielaard 0ceac8
--- trunk/README.s390 (original)
Mark Wielaard 0ceac8
+++ trunk/README.s390 Mon Oct 12 21:35:56 2015
Mark Wielaard 0ceac8
@@ -22,6 +22,9 @@
Mark Wielaard 0ceac8
 - Some gcc versions use mvc to copy 4/8 byte values. This will affect
Mark Wielaard 0ceac8
   certain debug messages. For example, memcheck will complain about
Mark Wielaard 0ceac8
   4 one-byte reads/writes instead of just a single read/write.
Mark Wielaard 0ceac8
+- The transactional-execution facility is not supported; it is masked
Mark Wielaard 0ceac8
+  off from HWCAP.
Mark Wielaard 0ceac8
+- The vector facility is not supported; it is masked off from HWCAP.
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
 Hardware facilities
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8
Modified: trunk/coregrind/m_initimg/initimg-linux.c
Mark Wielaard 0ceac8
==============================================================================
Mark Wielaard 0ceac8
--- trunk/coregrind/m_initimg/initimg-linux.c (original)
Mark Wielaard 0ceac8
+++ trunk/coregrind/m_initimg/initimg-linux.c Mon Oct 12 21:35:56 2015
Mark Wielaard 0ceac8
@@ -701,6 +701,12 @@
Mark Wielaard 0ceac8
                  in syswrap-arm-linux.c rather than to base this on
Mark Wielaard 0ceac8
                  conditional compilation. */
Mark Wielaard 0ceac8
             }
Mark Wielaard 0ceac8
+#           elif defined(VGP_s390x_linux)
Mark Wielaard 0ceac8
+            {
Mark Wielaard 0ceac8
+               /* Advertise hardware features "below" TE only.  TE and VXRS
Mark Wielaard 0ceac8
+                  (and anything above) are not supported by Valgrind. */
Mark Wielaard 0ceac8
+               auxv->u.a_val &= VKI_HWCAP_S390_TE - 1;
Mark Wielaard 0ceac8
+            }
Mark Wielaard 0ceac8
 #           endif
Mark Wielaard 0ceac8
             break;
Mark Wielaard 0ceac8
 #        if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8
Modified: trunk/include/vki/vki-s390x-linux.h
Mark Wielaard 0ceac8
==============================================================================
Mark Wielaard 0ceac8
--- trunk/include/vki/vki-s390x-linux.h (original)
Mark Wielaard 0ceac8
+++ trunk/include/vki/vki-s390x-linux.h Mon Oct 12 21:35:56 2015
Mark Wielaard 0ceac8
@@ -800,12 +800,15 @@
Mark Wielaard 0ceac8
 #define VKI_PTRACE_POKEUSR_AREA       0x5001
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
 //----------------------------------------------------------------------
Mark Wielaard 0ceac8
-// From linux-2.6.16.60/include/asm-s390/elf.h
Mark Wielaard 0ceac8
+// From linux-3.18/include/asm-s390/elf.h
Mark Wielaard 0ceac8
 //----------------------------------------------------------------------
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
 typedef vki_s390_fp_regs vki_elf_fpregset_t;
Mark Wielaard 0ceac8
 typedef vki_s390_regs vki_elf_gregset_t;
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
+#define VKI_HWCAP_S390_TE           1024
Mark Wielaard 0ceac8
+#define VKI_HWCAP_S390_VXRS         2048
Mark Wielaard 0ceac8
+
Mark Wielaard 0ceac8
 
Mark Wielaard 0ceac8
 //----------------------------------------------------------------------
Mark Wielaard 0ceac8
 // From linux-2.6.16.60/include/asm-s390/ucontext.h
Mark Wielaard 0ceac8
Mark Wielaard 0ceac8