public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Jiri Olsa <jolsa@kernel.org>, Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andi Kleen <ak@linux.intel.com>, Song Liu <songliubraving@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH 06/12] perf tools: Do not erase uncovered maps by kcore
Date: Tue, 23 Apr 2019 12:32:12 +0300	[thread overview]
Message-ID: <5cd0aadb-8bfc-2e97-4260-459b076aba2d@intel.com> (raw)
In-Reply-To: <20190416160127.30203-7-jolsa@kernel.org>

On 16/04/19 7:01 PM, Jiri Olsa wrote:
> Maps in kcore do not cover bpf maps, so we can't just
> remove everything. Keeping all kernel maps, which are
> not covered by kcore maps.

Memory for jited-bpf is allocated from the same area that is used for
modules.  In the case of /proc/kcore, that entire area is mapped, so there
won't be any bpf-maps that are not covered.  For copies of kcore made by
'perf buildid-cache' the same would be true for any bpf that got allocated
in between modules.

But shouldn't the bpf map supersede the kcore map for the address range that
it maps?  I guess that would mean splitting the kcore map, truncating the
first piece and inserting the bpf map in between.

> 
> Link: http://lkml.kernel.org/n/tip-9eytka8wofp0a047ul6lmejk@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/symbol.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 5cbad55cd99d..96738a7a8c14 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1166,6 +1166,18 @@ static int kcore_mapfn(u64 start, u64 len, u64 pgoff, void *data)
>  	return 0;
>  }
>  
> +static bool in_kcore(struct kcore_mapfn_data *md, struct map *map)
> +{
> +	struct map *iter;
> +
> +	list_for_each_entry(iter, &md->maps, node) {
> +		if ((map->start >= iter->start) && (map->start < iter->end))
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static int dso__load_kcore(struct dso *dso, struct map *map,
>  			   const char *kallsyms_filename)
>  {
> @@ -1222,7 +1234,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
>  	while (old_map) {
>  		struct map *next = map_groups__next(old_map);
>  
> -		if (old_map != map)
> +		if (old_map != map && !in_kcore(&md, old_map))
>  			map_groups__remove(kmaps, old_map);
>  		old_map = next;
>  	}
> 


  reply	other threads:[~2019-04-23  9:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 16:01 [PATCH 00/12] perf tools: Display eBPF code in intel_pt trace Jiri Olsa
2019-04-16 16:01 ` [PATCH 01/12] perf tools: Separate generic code in dso__data_file_size Jiri Olsa
2019-04-16 16:01 ` [PATCH 02/12] perf tools: Separate generic code in dso_cache__read Jiri Olsa
2019-04-16 17:17   ` Stanislav Fomichev
2019-04-16 18:21     ` Jiri Olsa
2019-04-16 16:01 ` [PATCH 03/12] perf tools: Simplify dso_cache__read function Jiri Olsa
2019-04-16 16:01 ` [PATCH 04/12] perf tools: Add bpf dso read and size hooks Jiri Olsa
2019-04-16 16:01 ` [PATCH 05/12] perf tools: Read also the end of the kernel Jiri Olsa
2019-04-16 16:01 ` [PATCH 06/12] perf tools: Do not erase uncovered maps by kcore Jiri Olsa
2019-04-23  9:32   ` Adrian Hunter [this message]
2019-04-23 14:55     ` Jiri Olsa
2019-04-16 16:01 ` [PATCH 07/12] perf tools: Check maps for bpf programs Jiri Olsa
2019-04-16 19:31   ` Arnaldo Carvalho de Melo
2019-04-19 17:18   ` [tip:perf/urgent] " tip-bot for Song Liu
2019-04-16 16:01 ` [PATCH 08/12] perf tools: Fix side band thread draining Jiri Olsa
2019-04-16 19:33   ` Arnaldo Carvalho de Melo
2019-04-16 20:41   ` Song Liu
2019-04-19 17:19   ` [tip:perf/urgent] perf evlist: " tip-bot for Jiri Olsa
2019-04-16 16:01 ` [PATCH 09/12] perf tools: Fix map reference counting Jiri Olsa
2019-04-16 19:36   ` Arnaldo Carvalho de Melo
2019-04-19 17:20   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2019-04-16 16:01 ` [PATCH 10/12] perf tools: Keep zero in pgoff bpf map Jiri Olsa
2019-04-16 16:01 ` [PATCH 11/12] perf tools: Reuse shared eBPF dso objects Jiri Olsa
2019-04-17  6:35   ` Adrian Hunter
2019-04-17  6:51     ` Jiri Olsa
2019-04-17  6:55       ` Adrian Hunter
2019-04-17  7:32         ` Jiri Olsa
2019-04-17 16:56           ` Song Liu
2019-04-16 16:01 ` [PATCH 12/12] perf script: Pad dso name for --call-trace Jiri Olsa

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=5cd0aadb-8bfc-2e97-4260-459b076aba2d@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=songliubraving@fb.com \
    /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