Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723867 > unrolled thread

[PATCH] perf test powerpc: Fix 'Object code reading' test

Started byRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
First post2017-08-31 08:40 +0200
Last post2017-08-31 09:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] perf test powerpc: Fix 'Object code reading' test Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2017-08-31 08:40 +0200
    Re: [PATCH] perf test powerpc: Fix 'Object code reading' test Adrian Hunter <adrian.hunter@intel.com> - 2017-08-31 09:00 +0200

#1723867 — [PATCH] perf test powerpc: Fix 'Object code reading' test

FromRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Date2017-08-31 08:40 +0200
Subject[PATCH] perf test powerpc: Fix 'Object code reading' test
Message-ID<ukriV-288-7@gated-at.bofh.it>
'Object code reading' test always fails on powerpc. Two reasons for
the failure are:

1. When elf section is too big (size beyond 'unsigned int' max value).
objdump fails to disassemble from such section. This was fixed with
commit 0f6329bd7fc ("binutils/objdump: Fix disassemble for huge elf
sections") in binutils.

2. When the sample is from hypervisor. Hypervisor symbols can not
be resolved within guest and thus thread__find_addr_map() fails for
such symbols. Fix this by ignoring hypervisor symbols in the test.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
---
 tools/perf/tests/code-reading.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 761c5a4..8702592 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -237,6 +237,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
 
 	thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al);
 	if (!al.map || !al.map->dso) {
+		/* Hyprevisor addr can not be resolved. */
+		if (cpumode == PERF_RECORD_MISC_HYPERVISOR)
+			return 0;
+
 		pr_debug("thread__find_addr_map failed\n");
 		return -1;
 	}
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1723877

FromAdrian Hunter <adrian.hunter@intel.com>
Date2017-08-31 09:00 +0200
Message-ID<ukrCi-2fq-9@gated-at.bofh.it>
In reply to#1723867
On 31/08/17 09:38, Ravi Bangoria wrote:
> 'Object code reading' test always fails on powerpc. Two reasons for
> the failure are:
> 
> 1. When elf section is too big (size beyond 'unsigned int' max value).
> objdump fails to disassemble from such section. This was fixed with
> commit 0f6329bd7fc ("binutils/objdump: Fix disassemble for huge elf
> sections") in binutils.
> 
> 2. When the sample is from hypervisor. Hypervisor symbols can not
> be resolved within guest and thus thread__find_addr_map() fails for
> such symbols. Fix this by ignoring hypervisor symbols in the test.
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/code-reading.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 761c5a4..8702592 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -237,6 +237,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
>  
>  	thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al);
>  	if (!al.map || !al.map->dso) {
> +		/* Hyprevisor addr can not be resolved. */

Hyprevisor -> Hypervisor

> +		if (cpumode == PERF_RECORD_MISC_HYPERVISOR)

You need a pr_debug() message here e.g.
pr_debug("Hypervisor address can not be resolved - skipping\n");


> +			return 0;
> +
>  		pr_debug("thread__find_addr_map failed\n");
>  		return -1;
>  	}
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web