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] [day] [month] [year] [list]
Message-ID: <20191106163431.GQ30214@krava>
Date:   Wed, 6 Nov 2019 17:34:31 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v4 9/9] perf stat: Use affinity for enabling/disabling
 events

On Mon, Nov 04, 2019 at 04:25:22PM -0800, Andi Kleen wrote:

SNIP

>  }
>  
>  static int perf_evsel__run_ioctl(struct perf_evsel *evsel,
> -				 int ioc,  void *arg)
> +				 int ioc,  void *arg,
> +				 int cpu)
>  {
> -	int cpu, thread;
> +	int thread;
>  
> -	for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) {
> -		for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) {
> -			int fd = FD(evsel, cpu, thread),
> -			    err = ioctl(fd, ioc, arg);
> +	for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) {
> +		int fd = FD(evsel, cpu, thread),
> +		    err = ioctl(fd, ioc, arg);
>  
> -			if (err)
> -				return err;
> -		}
> +		if (err)
> +			return err;
>  	}
>  
>  	return 0;
>  }
>  
> +int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu)
> +{
> +	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0, cpu);
> +}
> +
>  int perf_evsel__enable(struct perf_evsel *evsel)
>  {
> -	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0);
> +	int i;
> +	int err = 0;
> +
> +	for (i = 0; i < evsel->cpus->nr && !err; i++)
> +		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0, i);
> +	return err;
> +}
> +
> +int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu)
> +{
> +	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0, cpu);
>  }
>  
>  int perf_evsel__disable(struct perf_evsel *evsel)
>  {
> -	return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0);
> +	int i;
> +	int err = 0;
> +
> +	for (i = 0; i < evsel->cpus->nr && !err; i++)
> +		err = perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0, i);
> +	return err;
>  }
>  
>  int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter)
>  {
> -	return perf_evsel__run_ioctl(evsel,
> +	int err = 0, i;
> +
> +	for (i = 0; i < evsel->cpus->nr && !err; i++)
> +		err = perf_evsel__run_ioctl(evsel,
>  				     PERF_EVENT_IOC_SET_FILTER,
> -				     (void *)filter);
> +				     (void *)filter, i);
> +	return err;
>  }

please move the new function additions to separate patches

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ