lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7474e11b-6bd5-515d-0ebf-883d0656a359@arm.com>
Date:   Wed, 26 Jan 2022 11:27:16 +0000
From:   James Clark <james.clark@....com>
To:     German Gomez <german.gomez@....com>, linux-kernel@...r.kernel.org,
        linux-perf-users@...r.kernel.org, acme@...nel.org
Cc:     Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH] perf tools: apply correct label to user/kernel symbols in
 branch mode



On 26/01/2022 10:59, German Gomez wrote:
> In branch mode, the branch symbols were being displayed with incorrect
> cpumode labels. So fix this.
> 
> For example, before:
>   # perf record -b -a -- sleep 1
>   # perf report -b
> 
>   Overhead  Command  Source Shared Object  Source Symbol               Target Symbol
>      0.08%  swapper  [kernel.kallsyms]     [k] rcu_idle_enter          [k] cpuidle_enter_state
>  ==> 0.08%  cmd0     [kernel.kallsyms]     [.] psi_group_change        [.] psi_group_change
>      0.08%  cmd1     [kernel.kallsyms]     [k] psi_group_change        [k] psi_group_change
> 
> After:
>   # perf report -b
> 
>   Overhead  Command  Source Shared Object  Source Symbol               Target Symbol
>      0.08%  swapper  [kernel.kallsyms]     [k] rcu_idle_enter          [k] cpuidle_enter_state
>      0.08%  cmd0     [kernel.kallsyms]     [k] psi_group_change        [k] pei_group_change
>      0.08%  cmd1     [kernel.kallsyms]     [k] psi_group_change        [k] psi_group_change
> 
> Signed-off-by: German Gomez <german.gomez@....com>
> ---
>  tools/perf/util/machine.c    | 2 ++
>  tools/perf/util/map_symbol.h | 1 +
>  tools/perf/util/sort.c       | 4 ++--
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 3901440ae..ef564a5cf 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2072,6 +2072,7 @@ static void ip__resolve_ams(struct thread *thread,
>  
>  	ams->addr = ip;
>  	ams->al_addr = al.addr;
> +	ams->al_level = al.level;
>  	ams->ms.maps = al.maps;
>  	ams->ms.sym = al.sym;
>  	ams->ms.map = al.map;
> @@ -2091,6 +2092,7 @@ static void ip__resolve_data(struct thread *thread,
>  
>  	ams->addr = addr;
>  	ams->al_addr = al.addr;
> +	ams->al_level = al.level;
>  	ams->ms.maps = al.maps;
>  	ams->ms.sym = al.sym;
>  	ams->ms.map = al.map;
> diff --git a/tools/perf/util/map_symbol.h b/tools/perf/util/map_symbol.h
> index 7d22ade08..e08817b0c 100644
> --- a/tools/perf/util/map_symbol.h
> +++ b/tools/perf/util/map_symbol.h
> @@ -18,6 +18,7 @@ struct addr_map_symbol {
>  	struct map_symbol ms;
>  	u64	      addr;
>  	u64	      al_addr;
> +	char	      al_level;
>  	u64	      phys_addr;
>  	u64	      data_page_size;
>  };
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index cfba8c337..2da081ef5 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -915,7 +915,7 @@ static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
>  		struct addr_map_symbol *from = &he->branch_info->from;
>  
>  		return _hist_entry__sym_snprintf(&from->ms, from->al_addr,
> -						 he->level, bf, size, width);
> +						 from->al_level, bf, size, width);
>  	}
>  
>  	return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
> @@ -928,7 +928,7 @@ static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
>  		struct addr_map_symbol *to = &he->branch_info->to;
>  
>  		return _hist_entry__sym_snprintf(&to->ms, to->al_addr,
> -						 he->level, bf, size, width);
> +						 to->al_level, bf, size, width);
>  	}
>  
>  	return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
> 

Looks good to me, I didn't see any other usages where it could be broken.

Reviewed-by: James Clark <james.clark@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ