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]
Date:	Wed, 9 Sep 2015 21:41:18 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
CC:	Ingo Molnar <mingo@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	"Hunter, Adrian" <adrian.hunter@...el.com>,
	Borislav Petkov <bp@...e.de>, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...nel.org>,
	"Stephane Eranian" <eranian@...gle.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: RE: [PATCH 04/13] perf env: Introduce read_cpu_topology_map() method


> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index
> 151b8310ac70..d4c8aa2f4db7 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -415,8 +415,6 @@ struct cpu_topo {
>  	u32 thread_sib;
>  	char **core_siblings;
>  	char **thread_siblings;
> -	int *core_id;
> -	int *phy_pkg_id;
>  };
> 
>  static int build_cpu_topo(struct cpu_topo *tp, int cpu) @@ -479,9 +477,6
> @@ try_threads:
>  	}
>  	ret = 0;
>  done:
> -	tp->core_id[cpu] = cpu_map__get_core_id(cpu);
> -	tp->phy_pkg_id[cpu] = cpu_map__get_socket_id(cpu);
> -
>  	if(fp)
>  		fclose(fp);
>  	free(buf);
> @@ -509,7 +504,7 @@ static struct cpu_topo *build_cpu_topology(void)
>  	struct cpu_topo *tp;
>  	void *addr;
>  	u32 nr, i;
> -	size_t sz, sz_id;
> +	size_t sz;
>  	long ncpus;
>  	int ret = -1;
> 
> @@ -520,9 +515,8 @@ static struct cpu_topo *build_cpu_topology(void)
>  	nr = (u32)(ncpus & UINT_MAX);
> 
>  	sz = nr * sizeof(char *);
> -	sz_id = nr * sizeof(int);
> 
> -	addr = calloc(1, sizeof(*tp) + 2 * sz + 2 * sz_id);
> +	addr = calloc(1, sizeof(*tp) + 2 * sz);
>  	if (!addr)
>  		return NULL;
> 
> @@ -532,10 +526,6 @@ static struct cpu_topo *build_cpu_topology(void)
>  	tp->core_siblings = addr;
>  	addr += sz;
>  	tp->thread_siblings = addr;
> -	addr += sz;
> -	tp->core_id = addr;
> -	addr += sz_id;
> -	tp->phy_pkg_id = addr;
> 
>  	for (i = 0; i < nr; i++) {
>  		ret = build_cpu_topo(tp, i);
> @@ -554,7 +544,7 @@ static int write_cpu_topology(int fd, struct
> perf_header *h __maybe_unused,  {
>  	struct cpu_topo *tp;
>  	u32 i;
> -	int ret;
> +	int ret, j;
> 
>  	tp = build_cpu_topology();
>  	if (!tp)
> @@ -579,11 +569,15 @@ static int write_cpu_topology(int fd, struct
> perf_header *h __maybe_unused,
>  			break;
>  	}
> 
> -	for (i = 0; i < tp->cpu_nr; i++) {
> -		ret = do_write(fd, &tp->core_id[i], sizeof(int));
> +	perf_env__read_cpu_topology_map(&perf_env);
> +

I think we need to handle error here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ