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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141008180814.GH4750@worktop.programming.kicks-ass.net>
Date:	Wed, 8 Oct 2014 20:08:14 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Matt Fleming <matt@...sole-pimps.org>
Cc:	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel@...r.kernel.org, "H. Peter Anvin" <hpa@...or.com>,
	Matt Fleming <matt.fleming@...el.com>
Subject: Re: [PATCH 11/11] perf/x86/intel: Perform rotation on Intel CQM RMIDs

On Wed, Sep 24, 2014 at 03:04:15PM +0100, Matt Fleming wrote:
> +	preempt_disable();
> +	list_for_each_entry(entry, &cqm_rmid_limbo_lru, list) {
> +		for_each_cpu(cpu, &cqm_cpumask) {
> +			unsigned long *map;
> +
> +			map = &limbo_bitmap[cpu * BITS_TO_LONGS(nr_bits)];
> +			set_bit(entry->rmid, map);
> +		}
> +	}
> +
> +	/*
> +	 * Test whether an RMID is free for each package.
> +	 */
> +	smp_call_function_many(&cqm_cpumask, intel_cqm_stable, &info, true);
> +
> +	/*
> +	 * Convert all cpu bitmaps into a single bitmap by ANDing all of
> +	 * them together. If we've still got any bits set that indicates
> +	 * an RMID is now unused on all cpus.
> +	 */
> +	bitmap_fill(free_bitmap, nr_bits);
> +	for_each_cpu(cpu, &cqm_cpumask) {
> +		unsigned long *map;
> +
> +		map = &limbo_bitmap[cpu * BITS_TO_LONGS(nr_bits)];
> +		bitmap_and(free_bitmap, free_bitmap, map, nr_bits);
> +	}
> +
> +	if (!bitmap_empty(free_bitmap, nr_bits)) {
> +		int i = -1;
> +
> +		for (; i = find_next_bit(free_bitmap, nr_bits, i+1),
> +			i < nr_bits;) {
> +			entry = __rmid_entry(i);
> +
> +			list_del(&entry->list);	/* remove from limbo */
> +
> +			/*
> +			 * The rotation RMID gets priority if it's
> +			 * currently invalid. In which case, skip adding
> +			 * the RMID to the the free lru.
> +			 */
> +			if (!__rmid_valid(intel_cqm_rotation_rmid)) {
> +				intel_cqm_rotation_rmid = i;
> +				continue;
> +			}
> +
> +			/*
> +			 * If we have groups waiting for RMIDs, hand
> +			 * them one now.
> +			 */
> +			raw_spin_lock_irq(&cache_lock);
> +			list_for_each_entry(event, &cache_groups,
> +					    hw.cqm_groups_entry) {
> +				if (__rmid_valid(event->hw.cqm_rmid))
> +					continue;
> +
> +				intel_cqm_xchg_rmid(event, i);
> +				entry = NULL;
> +				break;
> +			}
> +			raw_spin_unlock_irq(&cache_lock);
> +
> +			if (!entry)
> +				continue;
> +
> +			/*
> +			 * Otherwise place it onto the free list.
> +			 */
> +			list_add_tail(&entry->list, &cqm_rmid_free_lru);
> +		}
> +	}
> +
> +	preempt_enable();

Why is all that under preempt_disable()?
--
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