public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Jan Stancek <jstancek@redhat.com>
Cc: linux-kernel@vger.kernel.org, acme@kernel.org, jolsa@kernel.org,
	dsahern@gmail.com, cjashfor@linux.vnet.ibm.com,
	fweisbec@gmail.com, mingo@kernel.org, namhyung@kernel.org,
	paulus@samba.org, a.p.zijlstra@chello.nl
Subject: Re: [PATCH v2 3/4] perf tests: stop reading if objdump output crossed sections
Date: Thu, 3 Sep 2015 12:12:22 +0300	[thread overview]
Message-ID: <55E80EF6.9060008@intel.com> (raw)
In-Reply-To: <9d1ea95e5f9884fdff1be6f761a2feabef37412c.1441181335.git.jstancek@redhat.com>

On 02/09/15 11:19, Jan Stancek wrote:
> objdump output can span across multiple sections:
> 
>   Disassembly of section .text:
>     0000000000000008 <crc32c+0x8>:
>        8:       48 89 e5                mov    %rsp,%rbp
>        b:       53                      push   %rbx
>        c:       8b 01                   mov    (%rcx),%eax
>     <snip>
>       6b:       90                      nop
> 
>   Disassembly of section .init.text:
>     0000000000000008 <init_module+0x8>:
>        8:       00 00                   add    %al,(%rax)
>        a:       00 00                   add    %al,(%rax)
>        c:       48 89 e5
> 
> Stop further reading if address starts going backwards,
> assuming we crossed sections.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>


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


> ---
>  tools/perf/tests/code-reading.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 375ba30e4ed0..e6bf47ff7e91 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -79,7 +79,7 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
>  	size_t line_len, off_last = 0;
>  	ssize_t ret;
>  	int err = 0;
> -	u64 addr;
> +	u64 addr, last_addr = start_addr;
>  
>  	while (off_last < *len) {
>  		size_t off, read_bytes, written_bytes;
> @@ -101,6 +101,11 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
>  
>  		if (sscanf(line, "%"PRIx64, &addr) != 1)
>  			continue;
> +		if (addr < last_addr) {
> +			pr_debug("addr going backwards, read beyond section?\n");
> +			break;
> +		}
> +		last_addr = addr;
>  
>  		/* copy it from temporary buffer to 'buf' according
>  		 * to address on current objdump line */
> 


  reply	other threads:[~2015-09-03  9:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02  8:19 [PATCH v2 1/4] perf tests: take into account address of each objdump line Jan Stancek
2015-09-02  8:19 ` [PATCH v2 2/4] perf tests: make objdump disassemble zero blocks Jan Stancek
2015-09-03  9:11   ` Adrian Hunter
2015-09-03 11:23     ` [PATCH v3 " Jan Stancek
2015-09-03 11:35       ` Adrian Hunter
2015-09-03 15:14         ` Arnaldo Carvalho de Melo
2015-09-03 16:19           ` Jan Stancek
2015-09-03 16:37             ` Arnaldo Carvalho de Melo
2015-09-15  6:58       ` [tip:perf/core] perf tests: Make " tip-bot for Jan Stancek
2015-09-02  8:19 ` [PATCH v2 3/4] perf tests: stop reading if objdump output crossed sections Jan Stancek
2015-09-03  9:12   ` Adrian Hunter [this message]
2015-09-15  6:58   ` [tip:perf/core] perf tests: Stop " tip-bot for Jan Stancek
2015-09-02  8:19 ` [PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match Jan Stancek
2015-09-03  9:12   ` Adrian Hunter
2015-09-15  6:58   ` [tip:perf/core] perf tests: Print objdump/dso buffers if they don 't match tip-bot for Jan Stancek
2015-09-03  9:08 ` [PATCH v2 1/4] perf tests: take into account address of each objdump line Adrian Hunter
2015-09-03 11:23   ` [PATCH v3 " Jan Stancek
2015-09-03 11:35     ` Adrian Hunter
2015-09-15  6:57 ` [tip:perf/core] perf tests: Take " tip-bot for Jan Stancek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E80EF6.9060008@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jstancek@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox