Skip to contentSkip to conversation

perf test 21("Test object code reading") failure on ARM64

BUG xiakaixu 4 participants 9 messages Dec 17, 2015 – Jan 8, 2016 perf events

lore
Share & tools
lore

xiakaixu

author
#0 lore raw

Hi,

Perf test "Test object code reading" failed on ARM64 board and the test log is here.

######################################################################################

# perf test -v 21
  ...
  File is: /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  On file address is: 0x70c3c
  Objdump command is: objdump -z -d --start-address=0x70c3c --stop-address=0x70cbc /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  objdump read too few bytes
  Bytes read differ from those read by objdump
  buf1 (dso):
  0x16 0x58 0x41 0xb9 0xf6 0x0e 0x00 0x35 0x00 0x00 0x00 0x90 0xbf 0x27 0x00 0xf9
  0x00 0x40 0x22 0x91 0xa0 0x23 0x00 0xf9 0xb4 0x06 0x00 0xf0 0x55 0xd0 0x3b 0xd5
  0x80 0xe2 0x14 0x91 0xb5 0xc2 0x1b 0xd1 0x00 0x60 0x00 0x91 0x01 0x04 0x40 0xf9
  0x3f 0x00 0x15 0xeb 0xc0 0x01 0x00 0x54 0xbf 0x3f 0x00 0xb9 0x21 0x00 0x80 0x52
  0x02 0xfc 0x5f 0x88 0x5f 0x00 0x1f 0x6b 0x61 0x00 0x00 0x54 0x01 0x7c 0x03 0x88
  0x83 0xff 0xff 0x35 0x40 0x00 0x00 0x54 0xa2 0x3f 0x00 0xb9 0xa0 0x3f 0x40 0xb9
  0xc0 0x0f 0x00 0x35 0x80 0xe2 0x14 0x91 0x15 0x10 0x00 0xf9 0x80 0xe2 0x14 0x91
  0x62 0x02 0x40 0xb9 0x44 0x00 0x11 0x12 0x01 0x1c 0x40 0xb9 0x13 0x08 0x00 0xf9

buf2 (objdump):
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

The result of objdump on ARM64 like this:
...
70c40: 35000ef6 cbnz w22, 70e1c <_IO_link_in+0x208>
70c44: 90000000 adrp x0, 70000 <_IO_file_fopen+0x164>
70c48: f90027bf str xzr, [x29,#72]
70c4c: 91224000 add x0, x0, #0x890
70c50: f90023a0 str x0, [x29,#64]
70c54: f00006b4 adrp x20, 147000 <__abort_msg+0x588>
...

So the following patch is needed.

tools/perf/tests/code-reading.c +0 -3
index a767a64..1b55fa0 100644
@@ -61,9 +61,6 @@ static size_t read_objdump_line(const char *line, size_t line_len, void *buf,
                if (i >= line_len || !isxdigit(line[i]))
                        break;
                c2 = line[i++];
-               /* Followed by a space */
-               if (i < line_len && line[i] && !isspace(line[i]))
-                       break;
                /* Store byte */
                *(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
               buf += 1;

After applying this patch, the test still failed.
######################################################################################
...
Objdump command is: objdump -z -d --start-address=0x7c4c4 --stop-address=0x7c544 /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so Bytes read differ from those read by objdump
buf1 (dso):
0x00 0x00 0x80 0xd2 0xd5 0xff 0xff 0x17 0xe0 0x03 0x19 0xaa 0xd3 0xff 0xff 0x17
0xe1 0x03 0x14 0xaa 0xa2 0x63 0x02 0x91 0xe0 0x03 0x13 0xaa 0x66 0xfe 0xff 0x97
0xfc 0x03 0x00 0xaa 0xa0 0x4f 0x40 0xf9 0xe2 0x03 0x1c 0xaa 0xe1 0x03 0x00 0xaa
0x08 0x00 0x67 0x9e 0x61 0x02 0x01 0x8b 0xe0 0x03 0x13 0xaa 0x60 0x01 0x00 0x94
0xe0 0xf9 0xff 0x35 0x95 0x07 0x00 0xd1 0x1b 0x00 0x80 0xd2 0x01 0x01 0x66 0x9e
0x60 0x02 0x15 0x8b 0x17 0x00 0x1c 0xcb 0xf8 0x03 0x1b 0xaa 0x0a 0x00 0x67 0x9e
0x20 0x00 0x80 0xd2 0x00 0x00 0x1c 0xcb 0x81 0x02 0x01 0xcb 0x09 0x00 0x67 0x9e
0x2b 0x00 0x67 0x9e 0x16 0x03 0x14 0x8b 0x20 0x03 0x1a 0x8b 0x01 0x00 0x80 0x52

buf2 (objdump):
0xd2 0x80 0x00 0x00 0x17 0xff 0xff 0xd5 0xaa 0x19 0x03 0xe0 0x17 0xff 0xff 0xd3 0xaa 0x14 0x03 0xe1 0x91 0x02 0x63 0xa2 0xaa 0x13 0x03 0xe0 0x97 0xff 0xfe 0x66 0xaa 0x00 0x03 0xfc 0xf9 0x40 0x4f 0xa0 0xaa 0x1c 0x03 0xe2 0xaa 0x00 0x03 0xe1 0x9e 0x67 0x00 0x08 0x8b 0x01 0x02 0x61 0xaa 0x13 0x03 0xe0 0x94 0x00 0x01 0x60 0x35 0xff 0xf9 0xe0 0xd1 0x00 0x07 0x95 0xd2 0x80 0x00 0x1b 0x9e 0x66 0x01 0x01 0x8b 0x15 0x02 0x60 0xcb 0x1c 0x00 0x17 0xaa 0x1b 0x03 0xf8 0x9e 0x67 0x00 0x0a 0xd2 0x80 0x00 0x20 0xcb 0x1c 0x00 0x00 0xcb 0x01 0x02 0x81 0x9e 0x67 0x00 0x09 0x9e 0x67 0x00 0x2b 0x8b 0x14 0x03 0x16 0x8b 0x1a 0x03 0x20 0x52 0x80 0x00 0x01

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

Seems the dso file format is different between x86 and ARM64. Maybe this test case only works fine on x86.

Signature · 2 lines
Regards
Kaixu Xia
#1 lore raw

adding Jan Stancek to the loop

jirka

Quoted 99 lines · xiakaixu

Hi,

Perf test "Test object code reading" failed on ARM64 board and the test log is here.

######################################################################################

# perf test -v 21
  ...
  File is: /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  On file address is: 0x70c3c
  Objdump command is: objdump -z -d --start-address=0x70c3c --stop-address=0x70cbc /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  objdump read too few bytes
  Bytes read differ from those read by objdump
  buf1 (dso):
  0x16 0x58 0x41 0xb9 0xf6 0x0e 0x00 0x35 0x00 0x00 0x00 0x90 0xbf 0x27 0x00 0xf9
  0x00 0x40 0x22 0x91 0xa0 0x23 0x00 0xf9 0xb4 0x06 0x00 0xf0 0x55 0xd0 0x3b 0xd5
  0x80 0xe2 0x14 0x91 0xb5 0xc2 0x1b 0xd1 0x00 0x60 0x00 0x91 0x01 0x04 0x40 0xf9
  0x3f 0x00 0x15 0xeb 0xc0 0x01 0x00 0x54 0xbf 0x3f 0x00 0xb9 0x21 0x00 0x80 0x52
  0x02 0xfc 0x5f 0x88 0x5f 0x00 0x1f 0x6b 0x61 0x00 0x00 0x54 0x01 0x7c 0x03 0x88
  0x83 0xff 0xff 0x35 0x40 0x00 0x00 0x54 0xa2 0x3f 0x00 0xb9 0xa0 0x3f 0x40 0xb9
  0xc0 0x0f 0x00 0x35 0x80 0xe2 0x14 0x91 0x15 0x10 0x00 0xf9 0x80 0xe2 0x14 0x91
  0x62 0x02 0x40 0xb9 0x44 0x00 0x11 0x12 0x01 0x1c 0x40 0xb9 0x13 0x08 0x00 0xf9

buf2 (objdump):
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

The result of objdump on ARM64 like this:

   ...
   70c40:	35000ef6 	cbnz	w22, 70e1c <_IO_link_in+0x208>
   70c44:	90000000 	adrp	x0, 70000 <_IO_file_fopen+0x164>
   70c48:	f90027bf 	str	xzr, [x29,#72]
   70c4c:	91224000 	add	x0, x0, #0x890
   70c50:	f90023a0 	str	x0, [x29,#64]
   70c54:	f00006b4 	adrp	x20, 147000 <__abort_msg+0x588>
   ...

So the following patch is needed.

tools/perf/tests/code-reading.c +0 -3
index a767a64..1b55fa0 100644
@@ -61,9 +61,6 @@ static size_t read_objdump_line(const char *line, size_t line_len, void *buf,
                if (i >= line_len || !isxdigit(line[i]))
                        break;
                c2 = line[i++];
-               /* Followed by a space */
-               if (i < line_len && line[i] && !isspace(line[i]))
-                       break;
                /* Store byte */
                *(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
               buf += 1;

After applying this patch, the test still failed.
######################################################################################
...
Objdump command is: objdump -z -d --start-address=0x7c4c4 --stop-address=0x7c544 /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so Bytes read differ from those read by objdump
buf1 (dso):
0x00 0x00 0x80 0xd2 0xd5 0xff 0xff 0x17 0xe0 0x03 0x19 0xaa 0xd3 0xff 0xff 0x17
0xe1 0x03 0x14 0xaa 0xa2 0x63 0x02 0x91 0xe0 0x03 0x13 0xaa 0x66 0xfe 0xff 0x97
0xfc 0x03 0x00 0xaa 0xa0 0x4f 0x40 0xf9 0xe2 0x03 0x1c 0xaa 0xe1 0x03 0x00 0xaa
0x08 0x00 0x67 0x9e 0x61 0x02 0x01 0x8b 0xe0 0x03 0x13 0xaa 0x60 0x01 0x00 0x94
0xe0 0xf9 0xff 0x35 0x95 0x07 0x00 0xd1 0x1b 0x00 0x80 0xd2 0x01 0x01 0x66 0x9e
0x60 0x02 0x15 0x8b 0x17 0x00 0x1c 0xcb 0xf8 0x03 0x1b 0xaa 0x0a 0x00 0x67 0x9e
0x20 0x00 0x80 0xd2 0x00 0x00 0x1c 0xcb 0x81 0x02 0x01 0xcb 0x09 0x00 0x67 0x9e
0x2b 0x00 0x67 0x9e 0x16 0x03 0x14 0x8b 0x20 0x03 0x1a 0x8b 0x01 0x00 0x80 0x52

buf2 (objdump):
0xd2 0x80 0x00 0x00 0x17 0xff 0xff 0xd5 0xaa 0x19 0x03 0xe0 0x17 0xff 0xff 0xd3 0xaa 0x14 0x03 0xe1 0x91 0x02 0x63 0xa2 0xaa 0x13 0x03 0xe0 0x97 0xff 0xfe 0x66 0xaa 0x00 0x03 0xfc 0xf9 0x40 0x4f 0xa0 0xaa 0x1c 0x03 0xe2 0xaa 0x00 0x03 0xe1 0x9e 0x67 0x00 0x08 0x8b 0x01 0x02 0x61 0xaa 0x13 0x03 0xe0 0x94 0x00 0x01 0x60 0x35 0xff 0xf9 0xe0 0xd1 0x00 0x07 0x95 0xd2 0x80 0x00 0x1b 0x9e 0x66 0x01 0x01 0x8b 0x15 0x02 0x60 0xcb 0x1c 0x00 0x17 0xaa 0x1b 0x03 0xf8 0x9e 0x67 0x00 0x0a 0xd2 0x80 0x00 0x20 0xcb 0x1c 0x00 0x00 0xcb 0x01 0x02 0x81 0x9e 0x67 0x00 0x09 0x9e 0x67 0x00 0x2b 0x8b 0x14 0x03 0x16 0x8b 0x1a 0x03 0x20 0x52 0x80 0x00 0x01

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

Seems the dso file format is different between x86 and ARM64. Maybe this test case only works fine on x86.

Signature · 2 lines
Regards
Kaixu Xia
#2 lore raw

----- Original Message -----

Quoted 8 lines

From: "Jiri Olsa" <[email protected]>
To: "xiakaixu" <[email protected]>
Cc: "adrian hunter" <[email protected]>, "Arnaldo Carvalho de Melo" <[email protected]>, "Ingo Molnar" <[email protected]>, "masami hiramatsu pt" <[email protected]>, [email protected], "Wangnan (F)" <[email protected]>, "Jan Stancek" <[email protected]>
Sent: Thursday, 17 December, 2015 1:09:26 PM
Subject: Re: [BUG] perf test 21("Test object code reading") failure on ARM64

Quoted 69 lines

adding Jan Stancek to the loop

jirka

Quoted 64 lines · xiakaixu

Hi,

Perf test "Test object code reading" failed on ARM64 board and the test log is here.

######################################################################################

# perf test -v 21
  ...
  File is: /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  On file address is: 0x70c3c
  Objdump command is: objdump -z -d --start-address=0x70c3c
  --stop-address=0x70cbc /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so
  objdump read too few bytes
  Bytes read differ from those read by objdump
  buf1 (dso):
  0x16 0x58 0x41 0xb9 0xf6 0x0e 0x00 0x35 0x00 0x00 0x00 0x90 0xbf 0x27
  0x00 0xf9
  0x00 0x40 0x22 0x91 0xa0 0x23 0x00 0xf9 0xb4 0x06 0x00 0xf0 0x55 0xd0
  0x3b 0xd5
  0x80 0xe2 0x14 0x91 0xb5 0xc2 0x1b 0xd1 0x00 0x60 0x00 0x91 0x01 0x04
  0x40 0xf9
  0x3f 0x00 0x15 0xeb 0xc0 0x01 0x00 0x54 0xbf 0x3f 0x00 0xb9 0x21 0x00
  0x80 0x52
  0x02 0xfc 0x5f 0x88 0x5f 0x00 0x1f 0x6b 0x61 0x00 0x00 0x54 0x01 0x7c
  0x03 0x88
  0x83 0xff 0xff 0x35 0x40 0x00 0x00 0x54 0xa2 0x3f 0x00 0xb9 0xa0 0x3f
  0x40 0xb9
  0xc0 0x0f 0x00 0x35 0x80 0xe2 0x14 0x91 0x15 0x10 0x00 0xf9 0x80 0xe2
  0x14 0x91
  0x62 0x02 0x40 0xb9 0x44 0x00 0x11 0x12 0x01 0x1c 0x40 0xb9 0x13 0x08
  0x00 0xf9

buf2 (objdump):
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

The result of objdump on ARM64 like this:

   ...
   70c40:	35000ef6 	cbnz	w22, 70e1c <_IO_link_in+0x208>
   70c44:	90000000 	adrp	x0, 70000 <_IO_file_fopen+0x164>
   70c48:	f90027bf 	str	xzr, [x29,#72]
   70c4c:	91224000 	add	x0, x0, #0x890
   70c50:	f90023a0 	str	x0, [x29,#64]
   70c54:	f00006b4 	adrp	x20, 147000 <__abort_msg+0x588>
   ...

Hi,

What is your objdump version?

Quoted 52 lines
Quoted 52 lines

So the following patch is needed.

tools/perf/tests/code-reading.c +0 -3
index a767a64..1b55fa0 100644
@@ -61,9 +61,6 @@ static size_t read_objdump_line(const char *line, size_t
 line_len, void *buf,
                if (i >= line_len || !isxdigit(line[i]))
                        break;
                c2 = line[i++];
-               /* Followed by a space */
-               if (i < line_len && line[i] && !isspace(line[i]))
-                       break;
                /* Store byte */
                *(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
               buf += 1;

After applying this patch, the test still failed.
######################################################################################
...
Objdump command is: objdump -z -d --start-address=0x7c4c4 --stop-address=0x7c544 /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so Bytes read differ from those read by objdump
buf1 (dso):
0x00 0x00 0x80 0xd2 0xd5 0xff 0xff 0x17 0xe0 0x03 0x19 0xaa 0xd3 0xff 0xff 0x17
0xe1 0x03 0x14 0xaa 0xa2 0x63 0x02 0x91 0xe0 0x03 0x13 0xaa 0x66 0xfe 0xff 0x97
0xfc 0x03 0x00 0xaa 0xa0 0x4f 0x40 0xf9 0xe2 0x03 0x1c 0xaa 0xe1 0x03 0x00 0xaa
0x08 0x00 0x67 0x9e 0x61 0x02 0x01 0x8b 0xe0 0x03 0x13 0xaa 0x60 0x01 0x00 0x94
0xe0 0xf9 0xff 0x35 0x95 0x07 0x00 0xd1 0x1b 0x00 0x80 0xd2 0x01 0x01 0x66 0x9e
0x60 0x02 0x15 0x8b 0x17 0x00 0x1c 0xcb 0xf8 0x03 0x1b 0xaa 0x0a 0x00 0x67 0x9e
0x20 0x00 0x80 0xd2 0x00 0x00 0x1c 0xcb 0x81 0x02 0x01 0xcb 0x09 0x00 0x67 0x9e
0x2b 0x00 0x67 0x9e 0x16 0x03 0x14 0x8b 0x20 0x03 0x1a 0x8b 0x01 0x00 0x80 0x52

buf2 (objdump):
0xd2 0x80 0x00 0x00 0x17 0xff 0xff 0xd5 0xaa 0x19 0x03 0xe0 0x17 0xff 0xff 0xd3
0xaa 0x14 0x03 0xe1 0x91 0x02 0x63 0xa2 0xaa 0x13 0x03 0xe0 0x97 0xff 0xfe 0x66
0xaa 0x00 0x03 0xfc 0xf9 0x40 0x4f 0xa0 0xaa 0x1c 0x03 0xe2 0xaa 0x00 0x03 0xe1
0x9e 0x67 0x00 0x08 0x8b 0x01 0x02 0x61 0xaa 0x13 0x03 0xe0 0x94 0x00 0x01 0x60

Quoted 8 lines
Quoted 8 lines

0x35 0xff 0xf9 0xe0 0xd1 0x00 0x07 0x95 0xd2 0x80 0x00 0x1b 0x9e 0x66 0x01 0x01
0x8b 0x15 0x02 0x60 0xcb 0x1c 0x00 0x17 0xaa 0x1b 0x03 0xf8 0x9e 0x67 0x00 0x0a
0xd2 0x80 0x00 0x20 0xcb 0x1c 0x00 0x00 0xcb 0x01 0x02 0x81 0x9e 0x67 0x00 0x09
0x9e 0x67 0x00 0x2b 0x8b 0x14 0x03 0x16 0x8b 0x1a 0x03 0x20 0x52 0x80 0x00 0x01

The data appears to match, but the endian is different.

Regards,
Jan

Quoted 13 lines
Quoted 12 lines

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

Seems the dso file format is different between x86 and ARM64. Maybe this test case only works fine on x86.
--
Regards
Kaixu Xia

author
#3 lore raw
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
   ...

Hi,

What is your objdump version?

Hi,

Sorry for the late reply.

# objdump --version
GNU objdump (GNU Binutils) 2.25.

I am sure that the system is Little endian.

Quoted 83 lines
Quoted 53 lines
Quoted 53 lines

So the following patch is needed.

tools/perf/tests/code-reading.c +0 -3
index a767a64..1b55fa0 100644
@@ -61,9 +61,6 @@ static size_t read_objdump_line(const char *line, size_t
 line_len, void *buf,
                if (i >= line_len || !isxdigit(line[i]))
                        break;
                c2 = line[i++];
-               /* Followed by a space */
-               if (i < line_len && line[i] && !isspace(line[i]))
-                       break;
                /* Store byte */
                *(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
               buf += 1;

After applying this patch, the test still failed.
######################################################################################
...
Objdump command is: objdump -z -d --start-address=0x7c4c4 --stop-address=0x7c544 /tmp/oxygen_root-root/lib64/libc-2.19-2014.08.so Bytes read differ from those read by objdump
buf1 (dso):
0x00 0x00 0x80 0xd2 0xd5 0xff 0xff 0x17 0xe0 0x03 0x19 0xaa 0xd3 0xff 0xff 0x17
0xe1 0x03 0x14 0xaa 0xa2 0x63 0x02 0x91 0xe0 0x03 0x13 0xaa 0x66 0xfe 0xff 0x97
0xfc 0x03 0x00 0xaa 0xa0 0x4f 0x40 0xf9 0xe2 0x03 0x1c 0xaa 0xe1 0x03 0x00 0xaa
0x08 0x00 0x67 0x9e 0x61 0x02 0x01 0x8b 0xe0 0x03 0x13 0xaa 0x60 0x01 0x00 0x94
0xe0 0xf9 0xff 0x35 0x95 0x07 0x00 0xd1 0x1b 0x00 0x80 0xd2 0x01 0x01 0x66 0x9e
0x60 0x02 0x15 0x8b 0x17 0x00 0x1c 0xcb 0xf8 0x03 0x1b 0xaa 0x0a 0x00 0x67 0x9e
0x20 0x00 0x80 0xd2 0x00 0x00 0x1c 0xcb 0x81 0x02 0x01 0xcb 0x09 0x00 0x67 0x9e
0x2b 0x00 0x67 0x9e 0x16 0x03 0x14 0x8b 0x20 0x03 0x1a 0x8b 0x01 0x00 0x80 0x52

buf2 (objdump):
0xd2 0x80 0x00 0x00 0x17 0xff 0xff 0xd5 0xaa 0x19 0x03 0xe0 0x17 0xff 0xff 0xd3
0xaa 0x14 0x03 0xe1 0x91 0x02 0x63 0xa2 0xaa 0x13 0x03 0xe0 0x97 0xff 0xfe 0x66
0xaa 0x00 0x03 0xfc 0xf9 0x40 0x4f 0xa0 0xaa 0x1c 0x03 0xe2 0xaa 0x00 0x03 0xe1
0x9e 0x67 0x00 0x08 0x8b 0x01 0x02 0x61 0xaa 0x13 0x03 0xe0 0x94 0x00 0x01 0x60

Quoted 8 lines
Quoted 8 lines

0x35 0xff 0xf9 0xe0 0xd1 0x00 0x07 0x95 0xd2 0x80 0x00 0x1b 0x9e 0x66 0x01 0x01
0x8b 0x15 0x02 0x60 0xcb 0x1c 0x00 0x17 0xaa 0x1b 0x03 0xf8 0x9e 0x67 0x00 0x0a
0xd2 0x80 0x00 0x20 0xcb 0x1c 0x00 0x00 0xcb 0x01 0x02 0x81 0x9e 0x67 0x00 0x09
0x9e 0x67 0x00 0x2b 0x8b 0x14 0x03 0x16 0x8b 0x1a 0x03 0x20 0x52 0x80 0x00 0x01

The data appears to match, but the endian is different.

Regards,
Jan

Quoted 6 lines
Quoted 6 lines

test child finished with -1
---- end ----
Test object code reading: FAILED!
######################################################################################

Quoted 7 lines
Quoted 6 lines

Seems the dso file format is different between x86 and ARM64. Maybe this test case only works fine on x86.
--
Regards
Kaixu Xia

.

Signature · 2 lines
Regards
Kaixu Xia
#4 lore raw
Quoted 7 lines · xiakaixu
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
   ...

Hi,

What is your objdump version?

Quoted 9 lines

Hi,

Sorry for the late reply.

# objdump --version
GNU objdump (GNU Binutils) 2.25.

I am sure that the system is Little endian.

Quoted 1 line

I have attached a patch if you care to try it with your setup. If it still fails, output from -v and last objdump command output would be helpful.

Regards,
Jan

tools/perf/tests/code-reading.c +68 -29
index a767a6400c5c..faf726865fac 100644
@@ -33,44 +33,83 @@ static unsigned int hex(char c)
 	return c - 'A' + 10;
 }
 
-static size_t read_objdump_line(const char *line, size_t line_len, void *buf,
-			      size_t len)
+static size_t read_objdump_chunk(const char **line, unsigned char **buf,
+				 size_t *buf_len)
+{
+	size_t bytes_read = 0;
+	unsigned char *chunk_start = *buf;
+
+	/* Read bytes */
+	while (*buf_len > 0) {
+		char c1, c2;
+
+		/* Get 2 hex digits */
+		c1 = *(*line)++;
+		if (!isxdigit(c1))
+			break;
+		c2 = *(*line)++;
+		if (!isxdigit(c2))
+			break;
+
+		/* Store byte and advance buf */
+		**buf = (hex(c1) << 4) | hex(c2);
+		(*buf)++;
+		(*buf_len)--;
+		bytes_read++;
+
+		/* End of chunk? */
+		if (isspace(**line))
+			break;
+	}
+
+	/*
+	 * objdump will display raw insn as LE if code endian
+	 * is LE and bytes_per_chunk > 1. In that case reverse
+	 * the chunk we just read.
+	 */
+	if (bytes_read > 1 && !bigendian()) {
+		unsigned char *chunk_end = chunk_start + bytes_read - 1;
+		unsigned char tmp;
+
+		while (chunk_start < chunk_end) {
+			tmp = *chunk_start;
+			*chunk_start = *chunk_end;
+			*chunk_end = tmp;
+			chunk_start++;
+			chunk_end--;
+		}
+	}
+
+	return bytes_read;
+}
+
+static size_t read_objdump_line(const char *line, unsigned char *buf,
+				size_t buf_len)
 {
 	const char *p;
-	size_t i, j = 0;
+	size_t ret, bytes_read = 0;
 
 	/* Skip to a colon */
 	p = strchr(line, ':');
 	if (!p)
 		return 0;
-	i = p + 1 - line;
+	p++;
 
-	/* Read bytes */
-	while (j < len) {
-		char c1, c2;
-
-		/* Skip spaces */
-		for (; i < line_len; i++) {
-			if (!isspace(line[i]))
-				break;
-		}
-		/* Get 2 hex digits */
-		if (i >= line_len || !isxdigit(line[i]))
-			break;
-		c1 = line[i++];
-		if (i >= line_len || !isxdigit(line[i]))
-			break;
-		c2 = line[i++];
-		/* Followed by a space */
-		if (i < line_len && line[i] && !isspace(line[i]))
+	/* Skip initial spaces */
+	while (*p) {
+		if (!isspace(*p))
 			break;
-		/* Store byte */
-		*(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
-		buf += 1;
-		j++;
+		p++;
 	}
+
+	do {
+		ret = read_objdump_chunk(&p, &buf, &buf_len);
+		bytes_read += ret;
+		p++;
+	} while (ret > 0);
+
 	/* return number of successfully read bytes */
-	return j;
+	return bytes_read;
 }
 
 static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
@@ -95,7 +134,7 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
 		}
 
 		/* read objdump data into temporary buffer */
-		read_bytes = read_objdump_line(line, ret, tmp, sizeof(tmp));
+		read_bytes = read_objdump_line(line, tmp, sizeof(tmp));
 		if (!read_bytes)
 			continue;
 
@@ -152,7 +191,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 
 	ret = read_objdump_output(f, buf, &len, addr);
 	if (len) {
-		pr_debug("objdump read too few bytes\n");
+		pr_debug("objdump read too few bytes: %lu\n", len);
 		if (!ret)
 			ret = len;
 	}
author
#5 lore raw
Quoted 15 lines · Jan Stancek
Quoted 14 lines · xiakaixu
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
   ...

Hi,

What is your objdump version?

Hi,

Sorry for the late reply.

# objdump --version
GNU objdump (GNU Binutils) 2.25.
Quoted 6 lines
Quoted 2 lines

I am sure that the system is Little endian.

Quoted 1 line

I have attached a patch if you care to try it with your setup. If it still fails, output from -v and last objdump command output would be helpful.

Hi,

After applying this patch, the perf test case passed.

# perf test 21
21: Test object code reading                                 : (no vmlinux) Ok

Thanks!

Quoted 4 lines

Regards,
Jan

Signature · 2 lines
Regards
Kaixu Xia
#6 lore raw

Em Mon, Dec 21, 2015 at 10:18:20AM +0800, xiakaixu escreveu:

Quoted 23 lines
Quoted 15 lines · Jan Stancek
Quoted 14 lines · xiakaixu
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
   ...

Hi,

What is your objdump version?

Hi,

Sorry for the late reply.

# objdump --version
GNU objdump (GNU Binutils) 2.25.
Quoted 6 lines
Quoted 2 lines

I am sure that the system is Little endian.

Quoted 1 line

I have attached a patch if you care to try it with your setup. If it still fails, output from -v and last objdump command output would be helpful.

Quoted 6 lines

Hi,

After applying this patch, the perf test case passed.

# perf test 21
21: Test object code reading                                 : (no vmlinux) Ok

So, assuming this doesn't break other running the test in other arches, can Jan please resend this with a changelog and a Tested-by: Xia?

Was that done already? /me still digging thru my queue after last month vacations...

- Arnaldo

Quoted 10 lines

Thanks!

Quoted 4 lines

Regards,
Jan

Signature · 2 lines
Regards
Kaixu Xia
#7 lore raw

----- Original Message -----

Quoted 40 lines

From: "Arnaldo Carvalho de Melo" <[email protected]>
To: "xiakaixu" <[email protected]>
Cc: "Jan Stancek" <[email protected]>, "Jiri Olsa" <[email protected]>, "adrian hunter" <[email protected]>, "Ingo Molnar" <[email protected]>, "masami hiramatsu pt" <[email protected]>, [email protected], "Wangnan (F)" <[email protected]>
Sent: Thursday, 7 January, 2016 5:27:21 PM
Subject: Re: [BUG] perf test 21("Test object code reading") failure on ARM64

Em Mon, Dec 21, 2015 at 10:18:20AM +0800, xiakaixu escreveu:

Quoted 23 lines
Quoted 15 lines · Jan Stancek
Quoted 14 lines · xiakaixu
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
   ...

Hi,

What is your objdump version?

Hi,

Sorry for the late reply.

# objdump --version
GNU objdump (GNU Binutils) 2.25.
Quoted 6 lines
Quoted 2 lines

I am sure that the system is Little endian.

Quoted 1 line

I have attached a patch if you care to try it with your setup. If it still fails, output from -v and last objdump command output would be helpful.

Quoted 7 lines

Hi,

After applying this patch, the perf test case passed.

# perf test 21
21: Test object code reading                                 : (no vmlinux)
Ok
Quoted 5 lines

So, assuming this doesn't break other running the test in other arches, can Jan please resend this with a changelog and a Tested-by: Xia?

Was that done already? /me still digging thru my queue after last month vacations...

Hi,

not yet. I'd like to try the patch also on ppc64 BE/LE before I post it (likely next week).

Regards,
Jan

Quoted 14 lines

- Arnaldo

Quoted 10 lines

Thanks!

Quoted 4 lines

Regards,
Jan

--
Regards
Kaixu Xia

#8 lore raw

Em Fri, Jan 08, 2016 at 03:03:34AM -0500, Jan Stancek escreveu:

Quoted 8 lines
Quoted 7 lines

From: "Arnaldo Carvalho de Melo" <[email protected]> Em Mon, Dec 21, 2015 at 10:18:20AM +0800, xiakaixu escreveu:

Quoted 5 lines

After applying this patch, the perf test case passed.

# perf test 21
21: Test object code reading    : (no vmlinux)
Ok
Quoted 8 lines
Quoted 5 lines

So, assuming this doesn't break other running the test in other arches, can Jan please resend this with a changelog and a Tested-by: Xia?

Was that done already? /me still digging thru my queue after last month vacations...

not yet. I'd like to try the patch also on ppc64 BE/LE before I post it (likely next week).

Thanks, I'll wait then,

- Arnaldo