linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Matt Fleming <matt@console-pimps.org>
Cc: Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Matt Fleming <matt.fleming@intel.com>
Subject: Re: [PATCH 11/11] perf/x86/intel: Perform rotation on Intel CQM RMIDs
Date: Wed, 8 Oct 2014 20:08:14 +0200	[thread overview]
Message-ID: <20141008180814.GH4750@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <1411567455-31264-12-git-send-email-matt@console-pimps.org>

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()?

  parent reply	other threads:[~2014-10-08 18:08 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 14:04 [PATCH 00/11] perf: Intel Cache QoS Monitoring support Matt Fleming
2014-09-24 14:04 ` [PATCH 01/11] perf stat: Fix AGGR_CORE segfault on multi-socket system Matt Fleming
2014-09-24 14:04 ` [PATCH 02/11] perf tools: Refactor unit and scale function parameters Matt Fleming
2014-09-29  9:21   ` Jiri Olsa
2014-10-03  5:25   ` [tip:perf/core] " tip-bot for Matt Fleming
2014-09-24 14:04 ` [PATCH 03/11] perf tools: Parse event per-package info files Matt Fleming
2014-09-24 14:04 ` [PATCH 04/11] perf: Make perf_cgroup_from_task() global Matt Fleming
2014-10-07 18:51   ` Peter Zijlstra
2014-10-08 10:27     ` Matt Fleming
2014-09-24 14:04 ` [PATCH 05/11] perf: Add ->count() function to read per-package counters Matt Fleming
2014-09-24 14:04 ` [PATCH 06/11] perf: Move cgroup init before PMU ->event_init() Matt Fleming
2014-10-07 19:34   ` Peter Zijlstra
2014-10-08 10:32     ` Matt Fleming
2014-10-08 10:49       ` Peter Zijlstra
2014-09-24 14:04 ` [PATCH 07/11] x86: Add support for Intel Cache QoS Monitoring (CQM) detection Matt Fleming
2014-09-24 14:04 ` [PATCH 08/11] perf/x86/intel: Add Intel Cache QoS Monitoring support Matt Fleming
2014-09-24 16:40   ` Andi Kleen
2014-09-24 20:27     ` Matt Fleming
2014-09-24 20:39       ` Andi Kleen
2014-09-29 18:51         ` Matt Fleming
2014-10-07 19:43   ` Peter Zijlstra
2014-10-08 10:36     ` Matt Fleming
2014-10-08 12:15       ` Matt Fleming
2014-10-08 14:47         ` Peter Zijlstra
2014-10-08 20:51           ` Peter Zijlstra
2014-09-24 14:04 ` [PATCH 09/11] perf/x86/intel: Implement LRU monitoring ID allocation for CQM Matt Fleming
2014-10-08  9:51   ` Peter Zijlstra
2014-10-08 10:53     ` Matt Fleming
2014-09-24 14:04 ` [PATCH 10/11] perf/x86/intel: Support task events with Intel CQM Matt Fleming
2014-09-24 14:45   ` Matt Fleming
2014-10-08 10:01   ` Peter Zijlstra
2014-10-08 11:07   ` Peter Zijlstra
2014-10-08 12:10     ` Matt Fleming
2014-10-08 14:49       ` Peter Zijlstra
2014-10-10 12:02         ` Matt Fleming
2014-10-10 14:02           ` Peter Zijlstra
2014-10-10 10:54     ` Peter Zijlstra
2014-10-10 11:10       ` Matt Fleming
2014-09-24 14:04 ` [PATCH 11/11] perf/x86/intel: Perform rotation on Intel CQM RMIDs Matt Fleming
2014-10-08 11:19   ` Peter Zijlstra
2014-10-08 11:56     ` Matt Fleming
2014-10-08 18:08   ` Peter Zijlstra [this message]
2014-10-08 19:02     ` Thomas Gleixner
2014-10-08 19:59       ` Matt Fleming
2014-10-08 18:10   ` Peter Zijlstra
2014-10-08 20:04     ` Matt Fleming
  -- strict thread matches above, loose matches on Subject: below --
2014-10-01 14:36 [PATCH v2 00/11] perf: Intel Cache QoS Monitoring support Matt Fleming
2014-10-01 14:36 ` [PATCH 11/11] perf/x86/intel: Perform rotation on Intel CQM RMIDs Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141008180814.GH4750@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matt@console-pimps.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).