From: Vikas Shivappa <vikas.shivappa@linux.intel.com>
To: vikas.shivappa@intel.com
Cc: vikas.shivappa@linux.intel.com, x86@kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
mingo@kernel.org, peterz@infradead.org, tj@kernel.org,
matt.fleming@intel.com, will.auld@intel.com,
kanaka.d.juvva@intel.com, glenn.p.williamson@intel.com,
mtosatti@redhat.com
Subject: [PATCH 5/6] x86/intel_rdt: Class of service management for code data prioritization
Date: Sun, 23 Aug 2015 15:46:41 -0700 [thread overview]
Message-ID: <1440370002-30618-6-git-send-email-vikas.shivappa@linux.intel.com> (raw)
In-Reply-To: <1440370002-30618-1-git-send-email-vikas.shivappa@linux.intel.com>
Add support to manage CLOSid(class of service id) for code data
prioritization(CDP). Includes allocating, freeing closid and closid_get
and closid_put.
During mount if the mode is changed between cdp and cache allocation
only, all the CLOSids are freed. When a new cgroup is created it
inherits its parents CLOSid in CDP just like in Cache allocation.
---
arch/x86/kernel/cpu/intel_rdt.c | 127 +++++++++++++++++++++++++---------------
1 file changed, 81 insertions(+), 46 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index 155ac51..285db1e 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -166,6 +166,85 @@ static void closcbm_map_dump(void)
}
}
+static void closid_map_init(void)
+{
+ u32 maxid = boot_cpu_data.x86_cache_max_closid;
+
+ bitmap_zero(rdtss_info.closmap, maxid);
+}
+
+static inline void closid_get(u32 closid)
+{
+ lockdep_assert_held(&rdt_group_mutex);
+
+ if (!rdtss_info.cdp_enable)
+ cat_cm_map[closid].clos_refcnt++;
+ else
+ cdp_cm_map[closid].clos_refcnt++;
+}
+
+static int closid_alloc(struct intel_rdt *ir)
+{
+ u32 maxid;
+ u32 id;
+
+ lockdep_assert_held(&rdt_group_mutex);
+
+ maxid = boot_cpu_data.x86_cache_max_closid;
+ id = find_next_zero_bit(rdtss_info.closmap, maxid, 0);
+ if (id == maxid)
+ return -ENOSPC;
+
+ set_bit(id, rdtss_info.closmap);
+ closid_get(id);
+ ir->closid = id;
+
+ return 0;
+}
+
+static inline void closid_free(u32 closid)
+{
+ clear_bit(closid, rdtss_info.closmap);
+ if (!rdtss_info.cdp_enable) {
+ cat_cm_map[closid].cache_mask = 0;
+ } else {
+ cdp_cm_map[closid].dcache_mask = 0;
+ cdp_cm_map[closid].icache_mask = 0;
+ }
+}
+
+static inline void closid_cat_put(u32 closid)
+{
+ struct cat_clos_mask_map *ccm = &cat_cm_map[closid];
+
+ lockdep_assert_held(&rdt_group_mutex);
+ if (WARN_ON(!ccm->clos_refcnt))
+ return;
+
+ if (!--ccm->clos_refcnt)
+ closid_free(closid);
+}
+
+static inline void closid_cdp_put(u32 closid)
+{
+ struct cdp_clos_mask_map *ccm = &cdp_cm_map[closid];
+
+ lockdep_assert_held(&rdt_group_mutex);
+ if (WARN_ON(!ccm->clos_refcnt))
+ return;
+
+ if (!--ccm->clos_refcnt)
+ closid_free(closid);
+}
+
+static inline void closid_put(u32 closid)
+{
+ if (!rdtss_info.cdp_enable)
+ closid_cat_put(closid);
+ else
+ closid_cdp_put(closid);
+}
+
static void cdp_cm_map_reset(int maxid, unsigned long max_cbm_mask)
{
size_t sizeb;
@@ -266,6 +345,8 @@ static void rdt_css_mount(void* info)
else
cdp_disable();
+ closid_map_init();
+
rdtss_info.cdp_enable = enable_cdp;
mutex_unlock(&rdt_group_mutex);
}
@@ -288,52 +369,6 @@ static inline void rdt_cdp_init(int cdp_maxid, unsigned long max_cbm_mask)
rdtss_info.cdp_supported = true;
}
-static inline void closid_get(u32 closid)
-{
- struct cat_clos_mask_map *ccm = &cat_cm_map[closid];
-
- lockdep_assert_held(&rdt_group_mutex);
-
- ccm->clos_refcnt++;
-}
-
-static int closid_alloc(struct intel_rdt *ir)
-{
- u32 maxid;
- u32 id;
-
- lockdep_assert_held(&rdt_group_mutex);
-
- maxid = boot_cpu_data.x86_cache_max_closid;
- id = find_next_zero_bit(rdtss_info.closmap, maxid, 0);
- if (id == maxid)
- return -ENOSPC;
-
- set_bit(id, rdtss_info.closmap);
- closid_get(id);
- ir->closid = id;
-
- return 0;
-}
-
-static inline void closid_free(u32 closid)
-{
- clear_bit(closid, rdtss_info.closmap);
- cat_cm_map[closid].cache_mask = 0;
-}
-
-static inline void closid_put(u32 closid)
-{
- struct cat_clos_mask_map *ccm = &cat_cm_map[closid];
-
- lockdep_assert_held(&rdt_group_mutex);
- if (WARN_ON(!ccm->clos_refcnt))
- return;
-
- if (!--ccm->clos_refcnt)
- closid_free(closid);
-}
-
void __intel_rdt_sched_in(void)
{
struct intel_pqr_state *state = this_cpu_ptr(&pqr_state);
--
1.9.1
next prev parent reply other threads:[~2015-08-23 22:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-23 22:46 [PATCH V1 0/6] cgroup,x86/intel_rdt : *pre h/w* Intel code data prioritization support and cgroup changes Vikas Shivappa
2015-08-23 22:46 ` [PATCH 1/6] cgroup: Adds cgroup_destroy_children Vikas Shivappa
2015-08-23 22:46 ` [PATCH 2/6] cgroup: Add css_mount and css_umount Vikas Shivappa
2015-08-23 22:46 ` [PATCH 3/6] x86/intel_rdt: Intel Code Data Prioritization detection Vikas Shivappa
2015-08-23 22:46 ` [PATCH 4/6] x86/intel_rdt: Adds support to enable CDP Vikas Shivappa
2015-08-23 22:46 ` Vikas Shivappa [this message]
2015-08-23 22:46 ` [PATCH 6/6] x86/intel_rdt: Support dcache and icache mask for Code data prioritization Vikas Shivappa
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=1440370002-30618-6-git-send-email-vikas.shivappa@linux.intel.com \
--to=vikas.shivappa@linux.intel.com \
--cc=glenn.p.williamson@intel.com \
--cc=hpa@zytor.com \
--cc=kanaka.d.juvva@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=mingo@kernel.org \
--cc=mtosatti@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=vikas.shivappa@intel.com \
--cc=will.auld@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox