linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf test powerpc: Fix 'Object code reading' test
@ 2017-08-31  9:14 Ravi Bangoria
  2017-08-31  9:15 ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Ravi Bangoria @ 2017-08-31  9:14 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, adrian.hunter, jolsa,
	linux-kernel, mpe, linuxppc-dev, Ravi Bangoria

'Object code reading' test always fails on powerpc guest. 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>
---
Changes in v2:
 - Add pr_debug()

 tools/perf/tests/code-reading.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 761c5a4..466a462 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -237,6 +237,11 @@ 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) {
+		if (cpumode == PERF_RECORD_MISC_HYPERVISOR) {
+			pr_debug("Hypervisor address can not be resolved - skipping\n");
+			return 0;
+		}
+
 		pr_debug("thread__find_addr_map failed\n");
 		return -1;
 	}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] perf test powerpc: Fix 'Object code reading' test
  2017-08-31  9:14 [PATCH v2] perf test powerpc: Fix 'Object code reading' test Ravi Bangoria
@ 2017-08-31  9:15 ` Adrian Hunter
  2017-08-31 16:31   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2017-08-31  9:15 UTC (permalink / raw)
  To: Ravi Bangoria, acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, jolsa, linux-kernel,
	mpe, linuxppc-dev

On 31/08/17 12:14, Ravi Bangoria wrote:
> 'Object code reading' test always fails on powerpc guest. 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>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> Changes in v2:
>  - Add pr_debug()
> 
>  tools/perf/tests/code-reading.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 761c5a4..466a462 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -237,6 +237,11 @@ 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) {
> +		if (cpumode == PERF_RECORD_MISC_HYPERVISOR) {
> +			pr_debug("Hypervisor address can not be resolved - skipping\n");
> +			return 0;
> +		}
> +
>  		pr_debug("thread__find_addr_map failed\n");
>  		return -1;
>  	}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] perf test powerpc: Fix 'Object code reading' test
  2017-08-31  9:15 ` Adrian Hunter
@ 2017-08-31 16:31   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-08-31 16:31 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Ravi Bangoria, peterz, mingo, alexander.shishkin, namhyung, jolsa,
	linux-kernel, mpe, linuxppc-dev

Em Thu, Aug 31, 2017 at 12:15:29PM +0300, Adrian Hunter escreveu:
> On 31/08/17 12:14, Ravi Bangoria wrote:
> > 'Object code reading' test always fails on powerpc guest. 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>
> 
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-31 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-31  9:14 [PATCH v2] perf test powerpc: Fix 'Object code reading' test Ravi Bangoria
2017-08-31  9:15 ` Adrian Hunter
2017-08-31 16:31   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).