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, 17 Feb 2016 10:27:11 -0800 (PST)
From:	Vikas Shivappa <vikas.shivappa@...el.com>
To:	Thomas Gleixner <tglx@...utronix.de>
cc:	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
	Stephane Eranian <eranian@...gle.com>,
	Matt Fleming <matt@...eblueprint.co.uk>,
	Vikas Shivappa <vikas.shivappa@...el.com>
Subject: Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu
 lookups



On Wed, 17 Feb 2016, Thomas Gleixner wrote:

> On Wed, 17 Feb 2016, Thomas Gleixner wrote:
>
>> CQM is a strict per package facility. Use the proper cpumasks to lookup the
>> readers.
>
> Sorry for the noise. PEBKAC: quilt refresh missing. Correct version below.
>
> Thanks,
>
> 	tglx
>
> 8<----------
>
> Subject: x86/perf/cqm: Get rid of the silly for_each_cpu lookups
> From: Thomas Gleixner <tglx@...utronix.de>
> Date: Sun, 14 Feb 2016 23:09:06 +0100
>
> CQM is a strict per package facility. Use the proper cpumasks to lookup the
> readers.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> arch/x86/kernel/cpu/perf_event_intel_cqm.c |   34 ++++++++++-------------------
> 1 file changed, 12 insertions(+), 22 deletions(-)
>
> --- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
> @@ -1244,15 +1244,12 @@ static struct pmu intel_cqm_pmu = {
>
> static inline void cqm_pick_event_reader(int cpu)
> {
> -	int phys_id = topology_physical_package_id(cpu);
> -	int i;
> +	int reader;
>
> -	for_each_cpu(i, &cqm_cpumask) {
> -		if (phys_id == topology_physical_package_id(i))
> -			return;	/* already got reader for this socket */
> -	}
> -
> -	cpumask_set_cpu(cpu, &cqm_cpumask);
> +	/* First online cpu in package becomes the reader */
> +	reader = cpumask_any_and(topology_core_cpumask(cpu), &cqm_cpumask);
> +	if (reader >= nr_cpu_ids)
> +		cpumask_set_cpu(cpu, &cqm_cpumask);

I was confused by the topology_core_cpumask naming as its really the mask of all 
cpus in the same package. I sent a patch for cqm and rapl to fix this looping 
when you had given the same feedback during CAt patches review , 
but they have never made it so far due to CAT patch issues.

Would it be better to resend the rapl (looks like perf_uncore has same loop) 
fixes separately ?

Thanks,
Vikas

> }
>
> static void intel_cqm_cpu_starting(unsigned int cpu)
> @@ -1270,24 +1267,17 @@ static void intel_cqm_cpu_starting(unsig
>
> static void intel_cqm_cpu_exit(unsigned int cpu)
> {
> -	int phys_id = topology_physical_package_id(cpu);
> -	int i;
> +	int target;
>
> -	/*
> -	 * Is @cpu a designated cqm reader?
> -	 */
> +	/* Is @cpu the current cqm reader for this package ? */
> 	if (!cpumask_test_and_clear_cpu(cpu, &cqm_cpumask))
> 		return;
>
> -	for_each_online_cpu(i) {
> -		if (i == cpu)
> -			continue;
> -
> -		if (phys_id == topology_physical_package_id(i)) {
> -			cpumask_set_cpu(i, &cqm_cpumask);
> -			break;
> -		}
> -	}
> +	/* Find another online reader in this package */
> +	target = cpumask_any_but(topology_core_cpumask(cpu), cpu);
> +
> +	if (target < nr_cpu_ids)
> +		cpumask_set_cpu(target, &cqm_cpumask);
> }
>
> static int intel_cqm_cpu_notifier(struct notifier_block *nb,
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ