valgrind missing TM instructions

Bug #1500846 reported by bugproxy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
valgrind (Ubuntu)
Fix Released
Undecided
Matthias Klose

Bug Description

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 <email address hidden> - 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 <email address hidden> - 2015-09-18 16:20:56 ==
valgrind svn revision 3143.

== Comment: #4 - William M. Schmidt <email address hidden> - 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.

Revision history for this message
bugproxy (bugproxy) wrote : valgrind svn revision 3143

Default Comment by Bridge

tags: added: architecture-ppc64le bugnameltc-130358 severity-high targetmilestone-inin---
Changed in ubuntu:
assignee: nobody → Taco Screen team (taco-screen-team)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1500846/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Steve Langasek (vorlon) wrote :

Matthias, can you please have a look at pulling in this upstream patch for 15.10?

affects: ubuntu → valgrind (Ubuntu)
Changed in valgrind (Ubuntu):
assignee: Taco Screen team (taco-screen-team) → Matthias Klose (doko)
status: New → Triaged
Revision history for this message
Matthias Klose (doko) wrote :

this is already fixed with today's upload.

Changed in valgrind (Ubuntu):
status: Triaged → Fix Released
bugproxy (bugproxy)
tags: added: targetmilestone-inin1510
removed: targetmilestone-inin---
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2016-02-24 09:48 EDT-------
I've verified in an updated 15.10 environment that this issue appears to be resolved. valgrind happily handles threaded apps and userland htm testcases.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.