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:   Mon, 11 Nov 2019 14:31:00 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     jolsa@...nel.org, acme@...nel.org, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v5 11/13] perf stat: Use affinity for reading

On Thu, Nov 07, 2019 at 10:16:44AM -0800, Andi Kleen wrote:

SNIP

> @@ -325,15 +318,34 @@ static int read_counter(struct evsel *counter, struct timespec *rs)
>  static void read_counters(struct timespec *rs)
>  {
>  	struct evsel *counter;
> -	int ret;
> +	struct affinity affinity;
> +	int i, ncpus, cpu;
> +
> +	if (affinity__setup(&affinity) < 0)
> +		return;
> +
> +	ncpus = evsel_list->core.all_cpus->nr;
> +	if (!(target__has_cpu(&target) && !target__has_per_thread(&target)))
> +		ncpus = 1;
> +	evlist__for_each_cpu (evsel_list, i, cpu) {
> +		if (i >= ncpus)
> +			break;
> +		affinity__set(&affinity, cpu);
> +
> +		evlist__for_each_entry(evsel_list, counter) {
> +			if (evsel__cpu_iter_skip(counter, cpu))
> +				continue;
> +			counter->err = read_counter(counter, rs, counter->cpu_iter - 1);

this will be overwritten by another cpu attempt,
so the check below won't get triggered properly

should we just break in case of error in here?

> +		}
> +	}
> +	affinity__cleanup(&affinity);
>  
>  	evlist__for_each_entry(evsel_list, counter) {
> -		ret = read_counter(counter, rs);
> -		if (ret)
> +		if (counter->err)
>  			pr_debug("failed to read counter %s\n", counter->name);
> -
> -		if (ret == 0 && perf_stat_process_counter(&stat_config, counter))
> +		if (counter->err == 0 && perf_stat_process_counter(&stat_config, counter))
>  			pr_warning("failed to process counter %s\n", counter->name);
> +		counter->err = 0;
>  	}
>  }
>  

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ