[Bug 1500846] [NEW] valgrind missing TM instructions

Launchpad Bug Tracker 1500846 at bugs.launchpad.net
Wed Sep 30 17:28:07 UTC 2015


You have been subscribed to a public bug:

valgrind fails on Ubuntu 15.10 Wily when debugging threaded
applicatoins. The issue is the TM instructions in the pthread lock
elision code:

dis_proc_ctl(ppc)(mfspr,SPR)(0x83)
disInstr(ppc): unhandled instruction: 0x7D2322A6
                 primary 31(0x1F), secondary 678(0x2A6)
==94927== valgrind: Unrecognised instruction at address 0x417f6e8.
==94927==    at 0x417F6E8: __elide_lock (elide.h:52)
==94927==    by 0x417F6E8: pthread_rwlock_wrlock (pthread_rwlock_wrlock.c:95)
==94927==    by 0x10D65CDB: llvm::sys::RWMutexImpl::writer_acquire() (RWMutex.cpp:102)
==94927==    by 0x10A149B7: lock (RWMutex.h:119)
==94927==    by 0x10A149B7: SmartScopedWriter (RWMutex.h:166)
==94927==    by 0x10A149B7: llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*) (PassRegistry.cpp:121)
==94927==    by 0x10A13767: llvm::PassNameParser::PassNameParser(llvm::cl::Option&) (Pass.cpp:228)
==94927==    by 0x1040F54B: list<char [13], llvm::cl::desc, llvm::cl::OptionHidden> (CommandLine.h:1420)
==94927==    by 0x1040F54B: __static_initialization_and_destruction_0 (LegacyPassManager.cpp:68)
==94927==    by 0x1040F54B: _GLOBAL__sub_I_LegacyPassManager.cpp (LegacyPassManager.cpp:1912)
==94927==    by 0x12359D63: __libc_csu_init (in /home/anton/llvm.install/bin/clang-3.8)
==94927==    by 0x450348B: generic_start_main.isra.0 (libc-start.c:245)
==94927==    by 0x4503733: (below main) (libc-start.c:94)
==94927== Your program just tried to execute an instruction that Valgrind
==94927== did not recognise.  There are two possible reasons for this.
==94927== 1. Your program has a bug and erroneously jumped to a non-code
==94927==    location.  If you are running Memcheck and you just saw a
==94927==    warning about a bad jump, it's probably your program's fault.
==94927== 2. The instruction is legitimate but Valgrind doesn't handle it,
==94927==    i.e. it's Valgrind's fault.  If you think this is the case or
==94927==    you are not sure, please let us know and we'll try to fix it.
==94927== Either way, Valgrind will now raise a SIGILL signal which will
==94927== probably kill your program.

== Comment: #1 - Carl E. Love <carll at us.ibm.com> - 2015-09-17 12:21:09 ==
Anton

The instruction hex code for the unhandled instruction is 7D2322A6.  You say it is a Transactional Memory instruction (TM).  The format of the TM instructions has a primary opcode of 31, which matches your instruction.
The secondary instruction identifier for the TM instruction is in bits 21:30 which for you instruction is 0x153 = 339 decimal, assuming I didn't screw it up.

Looking at the Power ISA v2.07 I find the following TM instructions and
corresponding secondary identifiers:

tbegin.      654
tend.         686
tabort.       910
tabortwc.   782
tabortwci.   846
tabortdci.    878
tsr.             750
tcheck       718

I am not seeing a TM instruction with a secondary identifier of 339.

I did find the move instruction mfspr RT,SPR  which has a primary opcode
of 31 and a secondary opcode of 339.  The spr number is in bits 11:20
which is 0x245 = 581 decimal. Figure 17 in the ISA 2.07, page 881 does
not list an SPR of 581.

The registers used with the TM instructions and spr numbers are:
TFHAR      128
TFIAR       129
TEXASR    130
TEXASRU  121

So, this doesn't seem to match either.

Can you send me the assembly code for the instruction so I can figure
out which TM instruction it is?   Thanks for the help.

== Comment: #3 - William M. Schmidt <willschm at us.ibm.com> - 2015-09-18 16:20:56 ==
valgrind svn revision 3143.

== Comment: #4 - William M. Schmidt <willschm at us.ibm.com> - 2015-09-18 16:22:06 ==
(I meant to add this comment before the attachment).

(In reply to comment #0)
> valgrind fails on Ubuntu 15.10 Wily when debugging threaded applicatoins.
> The issue is the TM instructions in the pthread lock elision code:
> 
> dis_proc_ctl(ppc)(mfspr,SPR)(0x83)
> disInstr(ppc): unhandled instruction: 0x7D2322A6
>                 primary 31(0x1F), secondary 678(0x2A6)

That message comes out of the default case when handling the mfspr
register number.

looks like valgrind in Wily is missing this patch:

  r3143 | carll | 2015-04-22 11:15:41 -0500 (Wed, 22 Apr 2015) | 16 lines
  Add support for the TEXASRU register.

** Affects: valgrind (Ubuntu)
     Importance: Undecided
     Assignee: Matthias Klose (doko)
         Status: Triaged


** Tags: architecture-ppc64le bot-comment bugnameltc-130358 severity-high targetmilestone-inin---
-- 
valgrind missing TM instructions
https://bugs.launchpad.net/bugs/1500846
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to valgrind in Ubuntu.



More information about the foundations-bugs mailing list