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: <20190120181925.GC8591@krava>
Date:   Sun, 20 Jan 2019 19:19:25 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Stephane Eranian <eranian@...gle.com>
Cc:     linux-kernel@...r.kernel.org, acme@...hat.com,
        peterz@...radead.org, mingo@...e.hu, ak@...ux.intel.com,
        kan.liang@...el.com
Subject: Re: [PATCH] perf tools: handle TOPOLOGY headers with no CPU

On Sat, Jan 19, 2019 at 12:12:39AM -0800, Stephane Eranian wrote:
> This patch fixes an issue in cpumap.c when used with the
> TOPOLOGY header. In some configurations, some NUMA nodes may
> have no CPU (empty cpulist). Yet a cpumap map must be created
> otherwise perf abort with an error. This patch handles this
> case by creating a dummy map.
> 
> Before:
> $ perf record -o - -e cycles noploop 2 | perf script -i -
> 0x6e8 [0x6c]: failed to process type: 80
> 
> After:
> $ perf record -o - -e cycles noploop 2 | perf script -i -
> noploop for 2 seconds
> 
> Signed-off-by: Stephane Eranian <eranian@...gle.com>

Acked-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka

> ---
>  tools/perf/util/cpumap.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index 1ccbd3342069..383674f448fc 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -134,7 +134,12 @@ struct cpu_map *cpu_map__new(const char *cpu_list)
>  	if (!cpu_list)
>  		return cpu_map__read_all_cpu_map();
>  
> -	if (!isdigit(*cpu_list))
> +	/*
> +	 * must handle the case of empty cpumap to cover
> +	 * TOPOLOGY header for NUMA nodes with no CPU
> +	 * ( e.g., because of CPU hotplug)
> +	 */
> +	if (!isdigit(*cpu_list) && *cpu_list != '\0')
>  		goto out;
>  
>  	while (isdigit(*cpu_list)) {
> @@ -181,8 +186,10 @@ struct cpu_map *cpu_map__new(const char *cpu_list)
>  
>  	if (nr_cpus > 0)
>  		cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
> -	else
> +	else if (*cpu_list != '\0')
>  		cpus = cpu_map__default_new();
> +	else
> +		cpus = cpu_map__dummy_new();
>  invalid:
>  	free(tmp_cpus);
>  out:
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ