All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Fix kernel maps for kcore and eBPF
Date: Tue, 2 Jun 2020 11:07:03 -0300	[thread overview]
Message-ID: <20200602140703.GP31795@kernel.org> (raw)
In-Reply-To: <20200602112505.1406-1-adrian.hunter@intel.com>

Em Tue, Jun 02, 2020 at 02:25:05PM +0300, Adrian Hunter escreveu:
> Adjust pgoff also when moving a map's start address.
> 
> Example with v5.4.34 based kernel:
> 
>   Before:
> 
>     $ sudo tools/perf/perf record -a --kcore -e intel_pt//k sleep 1
>     [ perf record: Woken up 1 times to write data ]
>     [ perf record: Captured and wrote 1.958 MB perf.data ]
>     $ sudo tools/perf/perf script --itrace=e >/dev/null
>     Warning:
>     961 instruction trace errors
> 
>   After:
> 
>     $ sudo tools/perf/perf script --itrace=e >/dev/null
>     $

Thanks, tested on a kaby lake system (i5-7500) and applied,

- Arnaldo
 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Fixes: fb5a88d4131a ("perf tools: Preserve eBPF maps when loading kcore")
> Cc: stable@vger.kernel.org
> ---
>  tools/perf/util/symbol.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 57cbe7a29868..5ddf84dcbae7 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1224,6 +1224,7 @@ int maps__merge_in(struct maps *kmaps, struct map *new_map)
>  
>  				m->end = old_map->start;
>  				list_add_tail(&m->node, &merged);
> +				new_map->pgoff += old_map->end - new_map->start;
>  				new_map->start = old_map->end;
>  			}
>  		} else {
> @@ -1244,6 +1245,7 @@ int maps__merge_in(struct maps *kmaps, struct map *new_map)
>  				 *      |new......| ->         |new...|
>  				 * |old....|        -> |old....|
>  				 */
> +				new_map->pgoff += old_map->end - new_map->start;
>  				new_map->start = old_map->end;
>  			}
>  		}
> -- 
> 2.17.1
> 

-- 

- Arnaldo

      reply	other threads:[~2020-06-02 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 11:25 [PATCH] perf tools: Fix kernel maps for kcore and eBPF Adrian Hunter
2020-06-02 14:07 ` Arnaldo Carvalho de Melo [this message]

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=20200602140703.GP31795@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.