Bug 326444 - Cavium MIPS Octeon Specific Load Indexed Instructions
Summary: Cavium MIPS Octeon Specific Load Indexed Instructions
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.9.0.SVN
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-22 14:18 UTC by Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Modified: 2014-03-13 18:18 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Add support cavium octeon specific Load Indexed instructions (6.26 KB, patch)
2013-10-22 14:25 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Test Cases (10.00 KB, application/x-gzip)
2013-10-22 14:29 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Output File (617.00 KB, application/octet-stream)
2013-10-22 14:29 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Adds support for cvm MIPS Load Indexed instructions (18.03 KB, patch)
2013-12-11 13:55 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Test Cases For Load Indexed Instructions (4.84 KB, text/x-csrc)
2013-12-11 13:59 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Expected Output of cvm_lx_ins (617.00 KB, application/octet-stream)
2013-12-11 14:00 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
VGTEST file for cvm_lx_ins (80 bytes, application/octet-stream)
2013-12-11 14:01 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Test Cases For LDX instruction (4.25 KB, text/x-csrc)
2013-12-11 14:02 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
Output File for LDX (179.00 KB, application/octet-stream)
2013-12-11 14:03 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details
VGTEST file for LDX (93 bytes, application/octet-stream)
2013-12-11 14:03 UTC, Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-10-22 14:18:46 UTC
The MIPS port for valgrind does not have support for the following Cavium Octeon specific instructions: 
- lbx
- lhux
- lwux
- ldx

Reproducible: Always

Steps to Reproduce:
Executing valgrind using any of its regression tests on an Octeon II Processor using Cavium SDK 3.0 will produce this error.
Actual Results:  
==14508== Memcheck, a memory error detector
==14508== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14508== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==14508== Command: ./memcheck/tests/malloc1
==14508== 
     14508:	
==14508== Invalid write of size 8
==14508==    at 0x40030D8: _dl_start_user (in /usr/local/Cavium_Networks/OCTEON-SDK/tools/lib64/ld-2.16.so)
==14508==    by 0x4003068: __start (in /usr/local/Cavium_Networks/OCTEON-SDK/tools/lib64/ld-2.16.so)
==14508==  Address 0xfff0009f8 is just below the stack ptr.  To suppress, use: --workaround-gcc296-bugs=yes
==14508== 
Error occured while trying to decode MIPS32 DSP instruction.
Your platform probably doesn't support MIPS32 DSP ASE.
vex mips->IR: unhandled instruction bytes: 0x7C 0x62 0x1A 0xA
==14508== valgrind: Unrecognised instruction at address 0x4092b78.
==14508==    at 0x4092B78: __ctype_init (ctype-info.c:32)
==14508==    by 0x408353C: _init (init-first.c:97)
==14508==    by 0x40124F4: call_init (dl-init.c:69)
==14508==    by 0x40126E8: _dl_init (dl-init.c:133)
==14508==    by 0x40030E8: _dl_start_user (in /usr/local/Cavium_Networks/OCTEON-SDK/tools/lib64/ld-2.16.so)
==14508== Your program just tried to execute an instruction that Valgrind
==14508== did not recognise.  There are two possible reasons for this.
==14508== 1. Your program has a bug and erroneously jumped to a non-code
==14508==    location.  If you are running Memcheck and you just saw a
==14508==    warning about a bad jump, it's probably your program's fault.
==14508== 2. The instruction is legitimate but Valgrind doesn't handle it,
==14508==    i.e. it's Valgrind's fault.  If you think this is the case or
==14508==    you are not sure, please let us know and we'll try to fix it.
==14508== Either way, Valgrind will now raise a SIGILL signal which will
==14508== probably kill your program.
==14508== 
==14508== Process terminating with default action of signal 4 (SIGILL)
==14508==  Illegal opcode at address 0x4092B78
==14508==    at 0x4092B78: __ctype_init (ctype-info.c:32)
==14508==    by 0x408353C: _init (init-first.c:97)
==14508==    by 0x40124F4: call_init (dl-init.c:69)
==14508==    by 0x40126E8: _dl_init (dl-init.c:133)
==14508==    by 0x40030E8: _dl_start_user (in /usr/local/Cavium_Networks/OCTEON-SDK/tools/lib64/ld-2.16.so)
==14508== 
==14508== HEAP SUMMARY:
==14508==     in use at exit: 0 bytes in 0 blocks
==14508==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==14508== 
==14508== All heap blocks were freed -- no leaks are possible
==14508== 
==14508== For counts of detected and suppressed errors, rerun with: -v
==14508== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
./vg-in-place: line 31: 14508 Illegal instruction     VALGRIND_LIB="$vgbasedir/.in_place" VALGRIND_LIB_INNER="$vgbasedir/.in_place" "$vgbasedir/coregrind/valgrind" "$@"

Expected Results:  
octeon:~ ./vg-in-place memcheck/tests/malloc1 
==22582== Memcheck, a memory error detector 
==22582== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. 
==22582== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info 
==22582== Command: memcheck/tests/malloc1 
==22582== 
==22582== Invalid write of size 1 
==22582== at 0x120000C24: really (malloc1.c:20) 
==22582== by 0x120000B68: main (malloc1.c:9) 
==22582== Address 0x422e041 is 1 bytes inside a block of size 10 free'd 
==22582== at 0x4045E9C: free (vg_replace_malloc.c:283) 
==22582== by 0x120000C10: really (malloc1.c:19) 
==22582== by 0x120000B68: main (malloc1.c:9) 
==22582== ==22582== Invalid write of size 1 
==22582== at 0x120000C5C: really (malloc1.c:23) 
==22582== by 0x120000B68: main (malloc1.c:9) 
==22582== Address 0x422e08f is 1 bytes before a block of size 10 alloc'd 
==22582== at 0x4046FC4: malloc (vg_replace_malloc.c:176) 
==22582== by 0x120000C34: really (malloc1.c:21) 
==22582== by 0x120000B68: main (malloc1.c:9) 
==22582== 
==22582== 
==22582== HEAP SUMMARY: 
==22582== in use at exit: 10 bytes in 1 blocks 
==22582== total heap usage: 2 allocs, 1 frees, 20 bytes allocated 
==22582== 
==22582== LEAK SUMMARY: 
==22582== definitely lost: 10 bytes in 1 blocks 
==22582== indirectly lost: 0 bytes in 0 blocks 
==22582== possibly lost: 0 bytes in 0 blocks 
==22582== still reachable: 0 bytes in 0 blocks 
==22582== suppressed: 0 bytes in 0 blocks 
==22582== Rerun with --leak-check=full to see details of leaked memory 
==22582== 
==22582== For counts of detected and suppressed errors, rerun with: -v 
==22582== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 15 from 9)
Comment 1 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-10-22 14:25:02 UTC
Created attachment 83020 [details]
Add support cavium octeon specific Load Indexed instructions

******************  PRE-REQUISITES   *****************

----Testing Enviroment specification:-----
																			
SDK             3.0 with new tool chain																		
Tool-chain	tool-121004																		
gcc version	4.7																		
glibc version	2.11																		
kernel version	3.4.27-rt37-Cavium-Octeon																		
cpu info	Cavium Octeon II V0.1																		
MotherBoard	OCTEON_CN63XX																		

valgrind 3.9.0 	r13667 release 13667
command to checkout: svn co -r 13667 svn://svn.valgrind.org/valgrind/trunk valgrind

******************  Applying patch   *****************

copy patch file to valgrind folder and following command should be run to apply patch.
run patch -p1 -i valgrind_3.9_r13667_22_oct_2013.patch 

******************  Files patched   *****************
patch file none/tests/mips64/Makefile.am
patch file tests/mips_features.c
patch file VEX/priv/guest_mips_toIR.c

********  Instructions added (Cavium specific) ******
- lbx
- lhux
- lwux
- ldx
Comment 2 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-10-22 14:29:02 UTC
Created attachment 83023 [details]
Test Cases
Comment 3 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-10-22 14:29:39 UTC
Created attachment 83025 [details]
Output File
Comment 4 Petar Jovanovic 2013-11-16 04:36:35 UTC
Couple of general remarks:

- Please avoid attaching archives, rather attach plain text patches.
- Rebase your patch to the ToT

Have you tested your patch on both LE and BE MIPS64? If not, can you please do it and add if anything is missing for it?

> + cvm_lx_ins_CFLAGS = $(AM_CFLAGS) -g -O0 -march=octeon2

Not all compilers will accept 'octeon2' flag. Make sure the compiler understands it, and if so, then compile the test.
This may need some checks in confiure.ac.


Please clean up the patch per the code style in the Valgrind. There may be
inconsistency in the code style, but try to:

1) remove trailing spaces
2) add spaces where needed
[e.g. you are missing them in each of the following lines]
+    switch(opc1){
+   } /* opc1 0x1C ends here*/
+     } /* opc1 = 0x1F & opc2 = 0xA (LX) ends here*/
+          if (VEX_MIPS_COMP_ID(archinfo->hwcaps) == VEX_PRID_COMP_CAVIUM){
+ 	cvm_lx_ins\
3) remove use of tabs
4) align line delimiters such as '\' (e.g. see #define TEST1(instruction, offset, mem))
5) do correct indentation everywhere

Thanks.
Comment 5 Petar Jovanovic 2013-11-17 04:52:43 UTC
I also missed to say that ldx is MIPS64 DSP instruction, so this instruction
should be treated differently. Have a separate test file for it, so it can be
tested on 64-bit platforms that support DSP ASE and not Cavium only.
Comment 6 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 13:44:16 UTC
(In reply to comment #4)
> Couple of general remarks:
> 
> - Please avoid attaching archives, rather attach plain text patches.
> - Rebase your patch to the ToT
Files have been attached separately now.  Patch has been rebased with ToT (revision 13752)
 
> Have you tested your patch on both LE and BE MIPS64? If not, can you please
> do it and add if anything is missing for it?
Test results have been verified on a BE MIPS64 OCTEON board. LE functionality has been manually verified.

> > + cvm_lx_ins_CFLAGS = $(AM_CFLAGS) -g -O0 -march=octeon2
> 
> Not all compilers will accept 'octeon2' flag. Make sure the compiler
> understands it, and if so, then compile the test.
> This may need some checks in confiure.ac.
> 
A check has been added for octeon in configure.ac (added in updated patch file)

> 
> Please clean up the patch per the code style in the Valgrind. There may be
> inconsistency in the code style, but try to:
> 
> 1) remove trailing spaces
> 2) add spaces where needed
> [e.g. you are missing them in each of the following lines]
> +    switch(opc1){
> +   } /* opc1 0x1C ends here*/
> +     } /* opc1 = 0x1F & opc2 = 0xA (LX) ends here*/
> +          if (VEX_MIPS_COMP_ID(archinfo->hwcaps) == VEX_PRID_COMP_CAVIUM){
> + 	cvm_lx_ins\
> 3) remove use of tabs
> 4) align line delimiters such as '\' (e.g. see #define TEST1(instruction,
> offset, mem))
> 5) do correct indentation everywhere
> 
Patch has been cleaned according to valgrind code style.

> Thanks.
Comment 7 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 13:50:27 UTC
(In reply to comment #5)
> I also missed to say that ldx is MIPS64 DSP instruction, so this instruction
> should be treated differently. Have a separate test file for it, so it can be
> tested on 64-bit platforms that support DSP ASE and not Cavium only.
Separate test, vgtest and exp files have been added for "ldx" instruction 
(test name : LoadIndexedInstructions.c).
Comment 8 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 13:55:05 UTC
Created attachment 84036 [details]
Adds support for cvm MIPS Load Indexed instructions

******************  PRE-REQUISITES   *****************

----Testing Enviroment specification:-----
																			
SDK             3.0 with new tool chain																		
Tool-chain	tool-121004																		
gcc version	4.7																		
glibc version	2.16																		
kernel version	3.4.27-rt37-Cavium-Octeon																		
cpu info	Cavium Octeon II V0.1																		
MotherBoard	OCTEON_CN63XX																		

valgrind 3.10.0 	r13752 release 13752
command to checkout: svn co -r 13752 svn://svn.valgrind.org/valgrind/trunk valgrind

******************  Applying patch   *****************

copy patch file to valgrind folder and following command should be run to apply patch.
run patch -p2 -i valgrind_bug326444_10_Dec_2013.patch 

******************  Files patched   *****************
patch file configure.ac
patch file none/tests/mips64/Makefile.am
patch file tests/mips_features.c
patch file VEX/priv/guest_mips_toIR.c

********  Instructions added (CVM MIPS) ******
- lbux
- lwx
- lbx
- lhux
- lwux
- ldx
Comment 9 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 13:59:14 UTC
Created attachment 84037 [details]
Test Cases For Load Indexed Instructions

Test for all load indexed instructions except "ldx" which has been treated differently.
Comment 10 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 14:00:26 UTC
Created attachment 84038 [details]
Expected Output of cvm_lx_ins
Comment 11 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 14:01:10 UTC
Created attachment 84039 [details]
VGTEST file for cvm_lx_ins
Comment 12 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 14:02:27 UTC
Created attachment 84040 [details]
Test Cases For LDX instruction
Comment 13 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 14:03:00 UTC
Created attachment 84041 [details]
Output File for LDX
Comment 14 Dr. Zahid Anwar, School of Electrical Engg. & Computer Science, National Univ. of Sciences & Technology, Islamabad, Pakistan 2013-12-11 14:03:32 UTC
Created attachment 84042 [details]
VGTEST file for LDX
Comment 15 Sasi 2014-01-08 15:11:15 UTC
I tried the latest patches from Bug 326444 & 327223. It solved the invalid instruction error on octeon but I'm not getting proper stack trace and logs when I tried to run simple program.

configure options:   ./configure --host=mips64-target-linux-gnu --build=x86_64-crosscompile-linux-gnu

II'm 

root@sasi:/root> valgrind ./a.out 1
==4236== Memcheck, a memory error detector
==4236== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==4236== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==4236== Command: ./a.out 1
==4236==
==4236== Conditional jump or move depends on uninitialised value(s)
==4236==    at 0x401AD20: ??? (in /lib64/ld-2.11.1.so)
==4236==    by 0x4008EA0: ??? (in /lib64/ld-2.11.1.so)
==4236==
==4236== Conditional jump or move depends on uninitialised value(s)
==4236==    at 0x401AEB0: ??? (in /lib64/ld-2.11.1.so)
==4236==    by 0x4006204: ??? (in /lib64/ld-2.11.1.so)
==4236==
==4236== Conditional jump or move depends on uninitialised value(s)
==4236==    at 0x401AEB0: ??? (in /lib64/ld-2.11.1.so)
==4236==    by 0x400C7BC: ??? (in /lib64/ld-2.11.1.so)
==4236==
      4236:
==4236== Invalid read of size 4
==4236==    at 0x400D148: ??? (in /lib64/ld-2.11.1.so)
==4236==    by 0x4004B4C: ??? (in /lib64/ld-2.11.1.so)
==4236==  Address 0x50 is not stack'd, malloc'd or (recently) free'd
==4236==
==4236==
==4236== Process terminating with default action of signal 11 (SIGSEGV)
==4236==  Access not within mapped region at address 0x50
==4236==    at 0x400D148: ??? (in /lib64/ld-2.11.1.so)
==4236==    by 0x4004B4C: ??? (in /lib64/ld-2.11.1.so)
==4236==  If you believe this happened as a result of a stack
==4236==  overflow in your program's main thread (unlikely but
==4236==  possible), you can try to increase the size of the
==4236==  main thread stack using the --main-stacksize= flag.
==4236==  The main thread stack size used in this run was 8388608.
==4236== Jump to the invalid address stated on the next line
==4236==    at 0x9E0: ???
==4236==    by 0x40338F0: _vgnU_freeres (vg_preloaded.c:63)
==4236==    by 0x4004B50: ??? (in /lib64/ld-2.11.1.so)
==4236==  Address 0x9e0 is not stack'd, malloc'd or (recently) free'd
==4236==
==4236==
==4236== Process terminating with default action of signal 11 (SIGSEGV)
==4236==  Bad permissions for mapped region at address 0x9E0
==4236==    at 0x9E0: ???
==4236==    by 0x40338F0: _vgnU_freeres (vg_preloaded.c:63)
==4236==    by 0x4004B50: ??? (in /lib64/ld-2.11.1.so)
==4236==
==4236== HEAP SUMMARY:
==4236==     in use at exit: 0 bytes in 0 blocks
==4236==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==4236==
==4236== All heap blocks were freed -- no leaks are possible
==4236==
==4236== For counts of detected and suppressed errors, rerun with: -v
==4236== Use --track-origins=yes to see where uninitialised values come from
==4236== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
Segmentation fault
Comment 16 Dejan Jevtic 2014-01-08 16:01:13 UTC
@ Sasi

Do you have libc library with debug info on your system?
You can install this library on debian with:

$ sudo apt-get install libc6-dbg

You can try to run your program with:
$ valgrind --run-libc-freeres=no ./a.out 1
Comment 17 Sasi 2014-01-08 16:32:52 UTC
(In reply to comment #16)
> @ Sasi
> 
> Do you have libc library with debug info on your system?
> You can install this library on debian with:
> 
> $ sudo apt-get install libc6-dbg
> 
> You can try to run your program with:
> $ valgrind --run-libc-freeres=no ./a.out 1

@Dejan Thanks. I installed glibc debug but getting access permission issue. I'm running as root and have 32G memory (free mem 31568M)

root@sasi:/root> valgrind  ./a.out 1
==1363== Memcheck, a memory error detector
==1363== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==1363== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==1363== Command: ./a.out 1
==1363==
      1363:
==1363==
==1363== Process terminating with default action of signal 11 (SIGSEGV)
==1363==  Access not within mapped region at address 0x50
==1363==    at 0x400D148: _dl_relocate_object (dl-machine.h:713)
==1363==    by 0x4004B50: dl_main (rtld.c:2227)
==1363==    by 0x4019188: _dl_sysdep_start (dl-sysdep.c:243)
==1363==    by 0x40021A4: _dl_start_final (rtld.c:333)
==1363==    by 0x40023E4: _dl_start (rtld.c:561)
==1363==    by 0x4001C0C: __start (in /lib64/ld-2.11.1.so)
==1363==  If you believe this happened as a result of a stack
==1363==  overflow in your program's main thread (unlikely but
==1363==  possible), you can try to increase the size of the
==1363==  main thread stack using the --main-stacksize= flag.
==1363==  The main thread stack size used in this run was 8388608.
==1363== Jump to the invalid address stated on the next line
==1363==    at 0x9E0: ???
==1363==    by 0x40338F0: _vgnU_freeres (vg_preloaded.c:63)
==1363==    by 0x4004B50: dl_main (rtld.c:2227)
==1363==    by 0x4021D44: ???
==1363==  Address 0x9e0 is not stack'd, malloc'd or (recently) free'd
==1363==
==1363==
==1363== Process terminating with default action of signal 11 (SIGSEGV)
==1363==  Bad permissions for mapped region at address 0x9E0
==1363==    at 0x9E0: ???
==1363==    by 0x40338F0: _vgnU_freeres (vg_preloaded.c:63)
==1363==    by 0x4004B50: dl_main (rtld.c:2227)
==1363==    by 0x4021D44: ???
==1363==
==1363== HEAP SUMMARY:
==1363==     in use at exit: 0 bytes in 0 blocks
==1363==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==1363==
==1363== All heap blocks were freed -- no leaks are possible
==1363==
==1363== For counts of detected and suppressed errors, rerun with: -v
==1363== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)
Segmentation fault
root@sasi:/root>
Comment 18 Petar Jovanovic 2014-02-14 18:30:13 UTC
Patches attached to this bug have been committed (with some modifications)
in several patches.

VEX: r2811, r2819
VALGRIND: r13782, r13783, r13786, r13805, r13808, r13809

This has been tested on Cavium Octeon II boards with MIPS64r2 Debian Linux.

@Zahid Anwar
Let me know if anything is missed or you have any comments here.

@everyone
If you have a general issue on Cavium boards (not related to load-indexed
instructions), please open a new issue.
Comment 19 Florian Krohm 2014-02-19 16:26:13 UTC
Marking as fixed as discussed with Petar.
Comment 20 Vien 2014-03-11 14:17:06 UTC
Hi  Petar,

I have met issue related to load-indexed instructions so please refer the terminal information on my MIPS 64 Octeon II board:

valgrind ls -l
==17023== Memcheck, a memory error detector
==17023== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==17023== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==17023== Command: ls -l
==17023==
Error occured while trying to decode MIPS32 DSP instruction.
Your platform probably doesn't support MIPS32 DSP ASE.
vex mips->IR: unhandled instruction bytes: 0x7C 0xE2 0x12 0xA
==17023== valgrind: Unrecognised instruction at address 0x4016a0c.
==17023==    at 0x4016A0C: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x4002914: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x40031E4: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x400246C: ??? (in /lib64/ld-2.9.so)
==17023== Your program just tried to execute an instruction that Valgrind
==17023== did not recognise.  There are two possible reasons for this.
==17023== 1. Your program has a bug and erroneously jumped to a non-code
==17023==    location.  If you are running Memcheck and you just saw a
==17023==    warning about a bad jump, it's probably your program's fault.
==17023== 2. The instruction is legitimate but Valgrind doesn't handle it,
==17023==    i.e. it's Valgrind's fault.  If you think this is the case or
==17023==    you are not sure, please let us know and we'll try to fix it.
==17023== Either way, Valgrind will now raise a SIGILL signal which will
==17023== probably kill your program.
==17023==
==17023== Process terminating with default action of signal 4 (SIGILL)
==17023==  Illegal opcode at address 0x4016A0C
==17023==    at 0x4016A0C: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x4002914: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x40031E4: ??? (in /lib64/ld-2.9.so)
==17023==    by 0x400246C: ??? (in /lib64/ld-2.9.so)
==17023==
==17023== HEAP SUMMARY:
==17023==     in use at exit: 0 bytes in 0 blocks
==17023==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==17023==
==17023== All heap blocks were freed -- no leaks are possible
==17023==
==17023== For counts of detected and suppressed errors, rerun with: -v
==17023== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction

Reproducible: Always

Thank you and regards,
Vien Mai.
Comment 21 Petar Jovanovic 2014-03-12 14:18:05 UTC
(In reply to comment #20)
> Hi  Petar,
> 
> I have met issue related to load-indexed instructions so please refer the
> terminal information on my MIPS 64 Octeon II board:
> 
> valgrind ls -l
> ==17023== Memcheck, a memory error detector
> ==17023== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
> ==17023== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
> ==17023== Command: ls -l
> ==17023==
> Error occured while trying to decode MIPS32 DSP instruction.
> Your platform probably doesn't support MIPS32 DSP ASE.
> vex mips->IR: unhandled instruction bytes: 0x7C 0xE2 0x12 0xA
> ==17023== valgrind: Unrecognised instruction at address 0x4016a0c.
> ==17023==    at 0x4016A0C: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x4002914: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x40031E4: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x400246C: ??? (in /lib64/ld-2.9.so)
> ==17023== Your program just tried to execute an instruction that Valgrind
> ==17023== did not recognise.  There are two possible reasons for this.
> ==17023== 1. Your program has a bug and erroneously jumped to a non-code
> ==17023==    location.  If you are running Memcheck and you just saw a
> ==17023==    warning about a bad jump, it's probably your program's fault.
> ==17023== 2. The instruction is legitimate but Valgrind doesn't handle it,
> ==17023==    i.e. it's Valgrind's fault.  If you think this is the case or
> ==17023==    you are not sure, please let us know and we'll try to fix it.
> ==17023== Either way, Valgrind will now raise a SIGILL signal which will
> ==17023== probably kill your program.
> ==17023==
> ==17023== Process terminating with default action of signal 4 (SIGILL)
> ==17023==  Illegal opcode at address 0x4016A0C
> ==17023==    at 0x4016A0C: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x4002914: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x40031E4: ??? (in /lib64/ld-2.9.so)
> ==17023==    by 0x400246C: ??? (in /lib64/ld-2.9.so)
> ==17023==
> ==17023== HEAP SUMMARY:
> ==17023==     in use at exit: 0 bytes in 0 blocks
> ==17023==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
> ==17023==
> ==17023== All heap blocks were freed -- no leaks are possible
> ==17023==
> ==17023== For counts of detected and suppressed errors, rerun with: -v
> ==17023== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
> Illegal instruction
> 
> Reproducible: Always
> 
> Thank you and regards,
> Vien Mai.

@Vien Mai
Have you tried to checkout the latest Valgrind from SVN and use it?
If not, please do so.

If the problem persists, please open a new issue, indicate what revision
you are using, and add information that you get from 'cat /proc/cpuinfo'.

Thanks.
Comment 22 Vien 2014-03-13 18:18:04 UTC
Hi Peter,

Thank you for your instruction. After checkout latest code, load indexed instruction problems are solved.
However, I met another issue and will open another bug report after trying few more times.

Thank you and regards,
Vien Mai.