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:   Thu, 10 Jan 2019 10:54:50 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 3/4] perf record: apply affinity masks when reading
 mmap buffers

On Thu, Jan 10, 2019 at 12:41:55PM +0300, Alexey Budankov wrote:
> On 09.01.2019 19:53, Jiri Olsa wrote:
> > On Wed, Jan 09, 2019 at 12:38:23PM +0300, Alexey Budankov wrote:
> > 
> > SNIP
> > 
> >> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> >> index e5220790f1fb..ee0230eed635 100644
> >> --- a/tools/perf/util/mmap.c
> >> +++ b/tools/perf/util/mmap.c
> >> @@ -377,6 +377,24 @@ void perf_mmap__munmap(struct perf_mmap *map)
> >>  	auxtrace_mmap__munmap(&map->auxtrace_mmap);
> >>  }
> >>  
> >> +static void perf_mmap__setup_affinity_mask(struct perf_mmap *map, struct mmap_params *mp)
> >> +{
> >> +	int c, cpu, nr_cpus, node;
> >> +
> >> +	CPU_ZERO(&map->affinity_mask);
> >> +	if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1) {
> >> +		nr_cpus = cpu_map__nr(mp->cpu_map);
> >> +		node = cpu__get_node(map->cpu);
> >> +		for (c = 0; c < nr_cpus; c++) {
> >> +			cpu = mp->cpu_map->map[c]; /* map c index to online cpu index */
> >> +			if (cpu__get_node(cpu) == node)
> >> +				CPU_SET(cpu, &map->affinity_mask);
> > 
> > should we do that from from all possible cpus task (perf record)
> > can run on, instead of mp->cpu_map, which might be only subset
> > (-C ... option)
> 
> That is how it should be and because mp->cpu_map depends on -C option value 
> in this patch set version it requires to be corrected, possibly like this:
> 
> struct mmap_params mp = {
> 		.nr_cblocks	= nr_cblocks,
> 		.affinity	= affinity,
> 		.cpu_map	= cpu_map__new(NULL) /* builds struct cpu_map from /sys/devices/system/cpu/online */
> 	}; 
> and 
> 	if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1 && mp->cpu_map)
> 
> Thanks!
> 
> > 
> > also node -> cpu_map is static configuration, we could prepare
> > this map ahead (like cpunode_map) and just assign it in here
> > based on node index
> 
> It makes sense and either way is possible. However the static configuration 
> looks a bit trickier because it incurs additional mask objects duplication 
> and conversion from struct cpu_map to cpu_set_t still remains the same.

ok, please at least put that node mask creation into separate function

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ