All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com
Cc: vikas.shivappa@linux.intel.com, dave.hansen@intel.com,
	mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Reinette Chatre <reinette.chatre@intel.com>
Subject: [RFC PATCH 05/20] x86/intel_rdt: Print more accurate pseudo-locking availability
Date: Mon, 13 Nov 2017 08:39:28 -0800	[thread overview]
Message-ID: <a8e0d13db652a7ca123639582bb96a57cd6dff55.1510568528.git.reinette.chatre@intel.com> (raw)
In-Reply-To: <cover.1510568528.git.reinette.chatre@intel.com>
In-Reply-To: <cover.1510568528.git.reinette.chatre@intel.com>

A region of cache is considered available for pseudo-locking when:
 * Cache area is in use by default COS.
 * Cache area is NOT in use by any other (other than default) COS.
 * Cache area is not shared with any other entity. Specifically, the
   cache area does not appear in "Bitmask of Shareable Resource with Other
   executing entities" found in EBX during CAT enumeration.
 * Cache area is not currently pseudo-locked.

At this time the first three tests are possible and we update the "avail"
file associated with pseudo-locking to print a more accurate reflection
of pseudo-locking availability.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 62 ++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
index ad8b97747024..a787a103c432 100644
--- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
+++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
@@ -26,9 +26,69 @@
 
 static struct kernfs_node *pseudo_lock_kn;
 
+/**
+ * pseudo_lock_avail_get - return bitmask of cache available for locking
+ * @r: resource to which this cache instance belongs
+ * @d: domain representing the cache instance
+ *
+ * Availability for pseudo-locking is determined as follows:
+ * * Cache area is in use by default COS.
+ * * Cache area is NOT in use by any other (other than default) COS.
+ * * Cache area is not shared with any other entity. Specifically, the
+ *   cache area does not appear in "Bitmask of Shareable Resource with Other
+ *   executing entities" found in EBX during CAT enumeration.
+ *
+ * Below is also required to determine availability and will be
+ * added in later:
+ * * Cache area is not currently pseudo-locked.
+ *
+ * LOCKING:
+ * rdtgroup_mutex is expected to be held when called
+ *
+ * RETURNS:
+ * Bitmask representing region of cache that can be locked, zero if nothing
+ * available.
+ */
+static u32 pseudo_lock_avail_get(struct rdt_resource *r, struct rdt_domain *d)
+{
+	u32 avail;
+	int i;
+
+	lockdep_assert_held(&rdtgroup_mutex);
+
+	avail = d->ctrl_val[0];
+	for (i = 1; i < r->num_closid; i++) {
+		if (closid_allocated(i))
+			avail &= ~d->ctrl_val[i];
+	}
+	avail &= ~r->cache.shareable_bits;
+
+	return avail;
+}
+
 static int pseudo_lock_avail_show(struct seq_file *sf, void *v)
 {
-	seq_puts(sf, "0\n");
+	struct rdt_resource *r;
+	struct rdt_domain *d;
+	bool sep;
+
+	mutex_lock(&rdtgroup_mutex);
+
+	for_each_alloc_enabled_rdt_resource(r) {
+		sep = false;
+		seq_printf(sf, "%s:", r->name);
+		list_for_each_entry(d, &r->domains, list) {
+			if (sep)
+				seq_puts(sf, ";");
+			seq_printf(sf, "%d=%x", d->id,
+				   pseudo_lock_avail_get(r, d));
+			sep = true;
+		}
+		seq_puts(sf, "\n");
+	}
+
+	mutex_unlock(&rdtgroup_mutex);
+
 	return 0;
 }
 
-- 
2.13.5

  parent reply	other threads:[~2017-11-14  0:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 16:39 [RFC PATCH 00/20] Intel(R) Resource Director Technology Cache Pseudo-Locking enabling Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 01/20] x86/intel_rdt: Documentation for Cache Pseudo-Locking Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 02/20] x86/intel_rdt: Make useful functions available internally Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 03/20] x86/intel_rdt: Introduce hooks to create pseudo-locking files Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 04/20] x86/intel_rdt: Introduce test to determine if closid is in use Reinette Chatre
2017-11-13 16:39 ` Reinette Chatre [this message]
2017-11-13 16:39 ` [RFC PATCH 06/20] x86/intel_rdt: Create pseudo-locked regions Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 07/20] x86/intel_rdt: Connect pseudo-locking directory to operations Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 08/20] x86/intel_rdt: Introduce pseudo-locking resctrl files Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 09/20] x86/intel_rdt: Discover supported platforms via prefetch disable bits Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 10/20] x86/intel_rdt: Disable pseudo-locking if CDP enabled Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 11/20] x86/intel_rdt: Associate pseudo-locked regions with its domain Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 12/20] x86/intel_rdt: Support CBM checking from value and character buffer Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 13/20] x86/intel_rdt: Support schemata write - pseudo-locking core Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 14/20] x86/intel_rdt: Enable testing for pseudo-locked region Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 15/20] x86/intel_rdt: Prevent new allocations from pseudo-locked regions Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 16/20] x86/intel_rdt: Create debugfs files for pseudo-locking testing Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 17/20] x86/intel_rdt: Create character device exposing pseudo-locked region Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 18/20] x86/intel_rdt: More precise L2 hit/miss measurements Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 19/20] x86/intel_rdt: Support L3 cache performance event of Broadwell Reinette Chatre
2017-11-13 16:39 ` [RFC PATCH 20/20] x86/intel_rdt: Limit C-states dynamically when pseudo-locking active Reinette Chatre
2017-11-18  0:48 ` [RFC PATCH 00/20] Intel(R) Resource Director Technology Cache Pseudo-Locking enabling Thomas Gleixner
2017-11-18  6:42   ` Reinette Chatre
2018-01-14 22:54     ` Thomas Gleixner
2018-01-15 16:23       ` Hindman, Gavin
2018-01-16 11:38         ` Thomas Gleixner
2018-01-17  0:53           ` Reinette Chatre
2018-02-12 19:07           ` Reinette Chatre
2018-02-13 10:27             ` Thomas Gleixner

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=a8e0d13db652a7ca123639582bb96a57cd6dff55.1510568528.git.reinette.chatre@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vikas.shivappa@linux.intel.com \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.