Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1574674

Re: [PATCH 2/2] perf tools: Support end symbols with no size for filters

From Adrian Hunter <adrian.hunter@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf tools: Support end symbols with no size for filters
Date 2017-02-06 14:30 +0100
Message-ID <t7RwK-5sW-23@gated-at.bofh.it> (permalink)
References <t6UmZ-7Sg-3@gated-at.bofh.it> <t6UmZ-7Sg-1@gated-at.bofh.it>
Organization Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki

Show all headers | View raw


On 04/02/17 00:18, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> 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 <ak@linux.intel.com>
> ---
>  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 */
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf/core: Allow global address filtering for kernel code Andi Kleen <andi@firstfloor.org> - 2017-02-03 23:20 +0100
  [PATCH 2/2] perf tools: Support end symbols with no size for filters Andi Kleen <andi@firstfloor.org> - 2017-02-03 23:20 +0100
    Re: [PATCH 2/2] perf tools: Support end symbols with no size for  filters Adrian Hunter <adrian.hunter@intel.com> - 2017-02-06 14:30 +0100
      Re: [PATCH 2/2] perf tools: Support end symbols with no size for  filters Andi Kleen <ak@linux.intel.com> - 2017-02-10 00:10 +0100

csiph-web