Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3369821yba; Tue, 23 Apr 2019 02:35:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1w6UzdiuYlPPiATt/9r3U8aQT7wTCP6fSrU81CULfnlEFpFijObgbWf2VAvScFhE2ky4l X-Received: by 2002:a63:d607:: with SMTP id q7mr14338710pgg.213.1556012101888; Tue, 23 Apr 2019 02:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556012101; cv=none; d=google.com; s=arc-20160816; b=AeTe2s0E3XuEooIllyXCxv2qXNZANSE767BjBm9/sKApvX0y9UArTKYeeuCc+hGfUw a+ezh/RE9QZbXWYhEcw2BmKwrGKdDLklCGoDd6ViEimwk+piT5r40W869MRAd94aTjv2 rWfkSXPntobspohw3ZDlhuX+mVTasNEO3fnfZy7OqNXzUWNp/YC6h+xAYNio3B0Q+f1b b/eQpyZ7JiDgI4Wbk1/fd25obzgS+MQ7Uxg9XrNe7eOhgHIRbyxSXgwsW2519er+cH0s 7l1a1Ss78sP8hSpKlTJchllnmVYIniy+e14ZaNTps1yTkv0FBrJljFjhkTkK5wPiVrX1 SQrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=761AYPqe/zWx8IUU+9HMr0JTut/LOpfoTRKhFLW2e28=; b=phNXjcnn0p728KMBdaQs0UdxduqR83Zxq79Gt1uzD2voRXX6ptb1pcu0unGgxUI5fS ywmrWdyE/t7q9wEWfYZNZp+qTZWxIRdL0J0IjsfesRSpBVXs4DqH3j3RHxaA95tI8b6U UT19Ftvltx7pkBjU0S355//tZTn9yfinEt1H8Zay8F6GaS0gmNIA5vzGKVaIqE/0x18a VlDBZpnkfvQ7IvuwG1JLD6JY8ioodreEWfrwrxlQV4dmnvDf1/34f6Agjn0g7vvDjVoj vUNeiG+gwIUDuj7Kh+LWNRDCtOmUgQyIDHRciKHmjkJaIei9M9kx96bG/ZHD1GXRO6mZ 5TKg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 98si15800373plb.84.2019.04.23.02.34.47; Tue, 23 Apr 2019 02:35:01 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727190AbfDWJdl (ORCPT + 99 others); Tue, 23 Apr 2019 05:33:41 -0400 Received: from mga14.intel.com ([192.55.52.115]:30189 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDWJdk (ORCPT ); Tue, 23 Apr 2019 05:33:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 02:33:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,385,1549958400"; d="scan'208";a="318191254" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.198]) ([10.237.72.198]) by orsmga005.jf.intel.com with ESMTP; 23 Apr 2019 02:33:32 -0700 Subject: Re: [PATCH 06/12] perf tools: Do not erase uncovered maps by kcore To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Song Liu , Alexei Starovoitov , Daniel Borkmann References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-7-jolsa@kernel.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <5cd0aadb-8bfc-2e97-4260-459b076aba2d@intel.com> Date: Tue, 23 Apr 2019 12:32:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190416160127.30203-7-jolsa@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 > --- > 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; > } >