From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbdBFNVE (ORCPT ); Mon, 6 Feb 2017 08:21:04 -0500 Received: from mga09.intel.com ([134.134.136.24]:27129 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbdBFNVD (ORCPT ); Mon, 6 Feb 2017 08:21:03 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,342,1477983600"; d="scan'208";a="1103654196" Subject: Re: [PATCH 2/2] perf tools: Support end symbols with no size for filters To: Andi Kleen , peterz@infradead.org References: <20170203221830.22354-1-andi@firstfloor.org> <20170203221830.22354-2-andi@firstfloor.org> Cc: alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, Andi Kleen From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <33fb6f80-a355-d093-0237-f8cb39ab0de7@intel.com> Date: Mon, 6 Feb 2017 15:15:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170203221830.22354-2-andi@firstfloor.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/02/17 00:18, Andi Kleen wrote: > From: Andi Kleen > > Currently a filter like > --filter "filter _text / _end" > doesn't work because _end doesn't have a size. The > filter resolution always wants to use the end of the function > as end. > > Allow this case by assuming the filter just spawns to the > start of the end symbol when there is no size. This makes > the above useful filter work. > > Cc: adrian.hunter@intel.com > Signed-off-by: Andi Kleen > --- > tools/perf/util/auxtrace.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c > index c5a6e0b12452..4c5ccb2b1298 100644 > --- a/tools/perf/util/auxtrace.c > +++ b/tools/perf/util/auxtrace.c > @@ -1840,7 +1840,12 @@ static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) > if (err) > return err; > filt->size = start + size - filt->addr; > - no_size = !!size; Erk! Isn't the logic is the wrong way around here. Sorry! i.e. should be: diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index c5a6e0b12452..78bd632f144d 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -1826,7 +1826,7 @@ static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) filt->addr = start; if (filt->range && !filt->size && !filt->sym_to) { filt->size = size; - no_size = !!size; + no_size = !size; } } @@ -1840,7 +1840,7 @@ static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) if (err) return err; filt->size = start + size - filt->addr; - no_size = !!size; + no_size = !size; } /* The very last symbol in kallsyms does not imply a particular size */ > + /* > + * When to has no size assume it's a end symbol. > + * This allows filters like _text / _end > + */ > + if (size == 0) > + filt->size = start - filt->addr; > } > > /* The very last symbol in kallsyms does not imply a particular size */ >