Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3682452yba; Tue, 23 Apr 2019 07:56:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKtXmfBtoD1v5DgrUVEeICRgW2C1ieSsD6SnnBLVCcs/T73TBs3zqdbhquC9RYq9SjBvkV X-Received: by 2002:a63:4c45:: with SMTP id m5mr16818445pgl.78.1556031384378; Tue, 23 Apr 2019 07:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556031384; cv=none; d=google.com; s=arc-20160816; b=s+qLZEy+mr50jAIiyNkf0/4oLHGW258vw2k9QuGzkEvFbEnz+MOaDF+JJUu+J8ePnx /Zv91J/AIGQNXgjUvDeaM//UPGR50kyI+i/mt3Fzj7kRzR5FCUhXIii9/gU0sZc9Hrpi yhH6gbKaJx/k/pzaY38iv/RQGyvPS/XXPLs9qGsJmJWbGtn+TYJ7UuqmJxSu/Zwnz8do F9R1CehAjpa/Eo5yxse6ArvpZqx63DpIKF5+vI60b0hMyBk5LyT61+D1ixqytbAD4eYG eIw81CMFedVVb22DwgotQ3XzccdBtfKv4qQ3y3sKR9qoKEl4wsBpanJ6cCdSqgINBosU i3OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=IZzppIikZ+jD4RzlMBEFHAm3xGXkMcPUDJb6T9Q+5+A=; b=MBi7yozWxDyOrR5/DOW8lDUcO/EP1xZMpdgwjtaqh4hrb6q6zjpIMkzgS2mdbh8zzf W9es8y/EkX0PFy8OpHzWxFZIn66elLHDkk8UxpRXEfP4im6q0gQfO8vaSZCFIbV/A2TD 12cPVHQt0vgKQY2pcYT886ojkwS85qSRLNovmqQAiKqyJ+R2WIO7fMEx4H6/H0qx4LjZ xD8qkHDQRkoIp/5z+tQM7B77x8dqUK0duncaKl7q3US4BAKcrMrTIfw9RrmDyI1cmpR5 qFz0xaBn4BbUpHm48h5uhvtY4JZeo6HzVdeFhXCESMEx3QvQ7vC/dmNU4DmjkR5mhTOT NDUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si16642522pfe.240.2019.04.23.07.56.08; Tue, 23 Apr 2019 07:56:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbfDWOzM (ORCPT + 99 others); Tue, 23 Apr 2019 10:55:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33304 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbfDWOzM (ORCPT ); Tue, 23 Apr 2019 10:55:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1793399DD9; Tue, 23 Apr 2019 14:55:12 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 8B97160142; Tue, 23 Apr 2019 14:55:09 +0000 (UTC) Date: Tue, 23 Apr 2019 16:55:08 +0200 From: Jiri Olsa To: Adrian Hunter Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH 06/12] perf tools: Do not erase uncovered maps by kcore Message-ID: <20190423145508.GE1730@krava> References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-7-jolsa@kernel.org> <5cd0aadb-8bfc-2e97-4260-459b076aba2d@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5cd0aadb-8bfc-2e97-4260-459b076aba2d@intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 23 Apr 2019 14:55:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 12:32:12PM +0300, Adrian Hunter wrote: > 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. I haven't considered it could get in between modules, I think you're right and we need to cut kcore maps in case bpf is mapped within.. I'll submit new version thanks, jirka > > > > > Link: http://lkml.kernel.org/n/tip-9eytka8wofp0a047ul6lmejk@git.kernel.org > > Signed-off-by: Jiri Olsa > > --- > > 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; > > } > > >