lkml.org 
[lkml]   [2018]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH V2 04/22] x86/intel_rdt: Introduce test to determine if closid is in use
Date
During CAT feature discovery the capacity bitmasks (CBMs) associated
with all the classes of service are initialized to all ones, even if the
class of service is not in use. Introduce a test that can be used to
determine if a class of service is in use. This test enables code
interested in parsing the CBMs to know if its values are meaningful or
can be ignored.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
arch/x86/kernel/cpu/intel_rdt.h | 1 +
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 6 ++++++
2 files changed, 7 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index 146a8090bb58..8f5ded384e19 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -435,6 +435,7 @@ int rdtgroup_kn_set_ugid(struct kernfs_node *kn);
struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
int closid_alloc(void);
void closid_free(int closid);
+bool closid_allocated(unsigned int closid);
int update_domains(struct rdt_resource *r, int closid);
int alloc_rmid(void);
void free_rmid(u32 rmid);
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 2a14867a14f7..5698d66b6892 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -126,6 +126,12 @@ void closid_free(int closid)
closid_free_map |= 1 << closid;
}

+/* closid_allocated - test if provided closid is in use */
+bool closid_allocated(unsigned int closid)
+{
+ return (closid_free_map & (1 << closid)) == 0;
+}
+
/* set uid and gid of rdtgroup dirs and files to that of the creator */
int rdtgroup_kn_set_ugid(struct kernfs_node *kn)
{
--
2.13.6
\
 
 \ /
  Last update: 2018-02-14 00:54    [W:0.169 / U:6.364 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site