[tip:x86/cache] x86/intel_rdt: Associate mode with each RDT resource group

2018-06-23 Thread tip-bot for Reinette Chatre
Commit-ID:  472ef09b40c5802a2e014ae2503ad8619486f9e6
Gitweb: https://git.kernel.org/tip/472ef09b40c5802a2e014ae2503ad8619486f9e6
Author: Reinette Chatre 
AuthorDate: Fri, 22 Jun 2018 15:41:55 -0700
Committer:  Thomas Gleixner 
CommitDate: Sat, 23 Jun 2018 13:03:41 +0200

x86/intel_rdt: Associate mode with each RDT resource group

Each RDT resource group is associated with a mode that will reflect
the level of sharing of its allocations. The default, shareable, will be
associated with each resource group on creation since it is zero and
resource groups are created with kzalloc. The managing of the mode of a
resource group will follow. The default resource group always remain
though so ensure that it is reset to the default mode when the resctrl
filesystem is unmounted.

Also introduce a utility that can be used to determine the mode of a
resource group when it is searched for based on its class of service.

Signed-off-by: Reinette Chatre 
Signed-off-by: Thomas Gleixner 
Cc: fenghua...@intel.com
Cc: tony.l...@intel.com
Cc: vikas.shiva...@linux.intel.com
Cc: gavin.hind...@intel.com
Cc: jithu.jos...@intel.com
Cc: dave.han...@intel.com
Cc: h...@zytor.com
Link: 
https://lkml.kernel.org/r/797e4e1de4e4fcdf5b5e0039354d6a28079e2015.1529706536.git.reinette.cha...@intel.com

---
 arch/x86/kernel/cpu/intel_rdt.h  |  3 +++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 ++
 2 files changed, 25 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index fef254e85da4..482dd6d3b8c5 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -122,6 +122,7 @@ struct mongroup {
  * @type:  indicates type of this rdtgroup - either
  * monitor only or ctrl_mon group
  * @mon:   mongroup related data
+ * @mode:  mode of resource group
  */
 struct rdtgroup {
struct kernfs_node  *kn;
@@ -132,6 +133,7 @@ struct rdtgroup {
atomic_twaitcount;
enum rdt_group_type type;
struct mongroup mon;
+   enum rdtgrp_modemode;
 };
 
 /* rdtgroup.flags */
@@ -461,6 +463,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off);
 int rdtgroup_schemata_show(struct kernfs_open_file *of,
   struct seq_file *s, void *v);
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
 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 fa668f967062..4a72061df7cd 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -126,6 +126,27 @@ static void closid_free(int closid)
closid_free_map |= 1 << closid;
 }
 
+/**
+ * rdtgroup_mode_by_closid - Return mode of resource group with closid
+ * @closid: closid if the resource group
+ *
+ * Each resource group is associated with a @closid. Here the mode
+ * of a resource group can be queried by searching for it using its closid.
+ *
+ * Return: mode as  rdtgrp_mode of resource group with closid @closid
+ */
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid)
+{
+   struct rdtgroup *rdtgrp;
+
+   list_for_each_entry(rdtgrp, _all_groups, rdtgroup_list) {
+   if (rdtgrp->closid == closid)
+   return rdtgrp->mode;
+   }
+
+   return RDT_NUM_MODES;
+}
+
 /* set uid and gid of rdtgroup dirs and files to that of the creator */
 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn)
 {
@@ -1491,6 +1512,7 @@ static void rdt_kill_sb(struct super_block *sb)
reset_all_ctrls(r);
cdp_disable_all();
rmdir_all_sub();
+   rdtgroup_default.mode = RDT_MODE_SHAREABLE;
static_branch_disable_cpuslocked(_alloc_enable_key);
static_branch_disable_cpuslocked(_mon_enable_key);
static_branch_disable_cpuslocked(_enable_key);


[tip:x86/cache] x86/intel_rdt: Associate mode with each RDT resource group

2018-06-23 Thread tip-bot for Reinette Chatre
Commit-ID:  472ef09b40c5802a2e014ae2503ad8619486f9e6
Gitweb: https://git.kernel.org/tip/472ef09b40c5802a2e014ae2503ad8619486f9e6
Author: Reinette Chatre 
AuthorDate: Fri, 22 Jun 2018 15:41:55 -0700
Committer:  Thomas Gleixner 
CommitDate: Sat, 23 Jun 2018 13:03:41 +0200

x86/intel_rdt: Associate mode with each RDT resource group

Each RDT resource group is associated with a mode that will reflect
the level of sharing of its allocations. The default, shareable, will be
associated with each resource group on creation since it is zero and
resource groups are created with kzalloc. The managing of the mode of a
resource group will follow. The default resource group always remain
though so ensure that it is reset to the default mode when the resctrl
filesystem is unmounted.

Also introduce a utility that can be used to determine the mode of a
resource group when it is searched for based on its class of service.

Signed-off-by: Reinette Chatre 
Signed-off-by: Thomas Gleixner 
Cc: fenghua...@intel.com
Cc: tony.l...@intel.com
Cc: vikas.shiva...@linux.intel.com
Cc: gavin.hind...@intel.com
Cc: jithu.jos...@intel.com
Cc: dave.han...@intel.com
Cc: h...@zytor.com
Link: 
https://lkml.kernel.org/r/797e4e1de4e4fcdf5b5e0039354d6a28079e2015.1529706536.git.reinette.cha...@intel.com

---
 arch/x86/kernel/cpu/intel_rdt.h  |  3 +++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 ++
 2 files changed, 25 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index fef254e85da4..482dd6d3b8c5 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -122,6 +122,7 @@ struct mongroup {
  * @type:  indicates type of this rdtgroup - either
  * monitor only or ctrl_mon group
  * @mon:   mongroup related data
+ * @mode:  mode of resource group
  */
 struct rdtgroup {
struct kernfs_node  *kn;
@@ -132,6 +133,7 @@ struct rdtgroup {
atomic_twaitcount;
enum rdt_group_type type;
struct mongroup mon;
+   enum rdtgrp_modemode;
 };
 
 /* rdtgroup.flags */
@@ -461,6 +463,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off);
 int rdtgroup_schemata_show(struct kernfs_open_file *of,
   struct seq_file *s, void *v);
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
 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 fa668f967062..4a72061df7cd 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -126,6 +126,27 @@ static void closid_free(int closid)
closid_free_map |= 1 << closid;
 }
 
+/**
+ * rdtgroup_mode_by_closid - Return mode of resource group with closid
+ * @closid: closid if the resource group
+ *
+ * Each resource group is associated with a @closid. Here the mode
+ * of a resource group can be queried by searching for it using its closid.
+ *
+ * Return: mode as  rdtgrp_mode of resource group with closid @closid
+ */
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid)
+{
+   struct rdtgroup *rdtgrp;
+
+   list_for_each_entry(rdtgrp, _all_groups, rdtgroup_list) {
+   if (rdtgrp->closid == closid)
+   return rdtgrp->mode;
+   }
+
+   return RDT_NUM_MODES;
+}
+
 /* set uid and gid of rdtgroup dirs and files to that of the creator */
 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn)
 {
@@ -1491,6 +1512,7 @@ static void rdt_kill_sb(struct super_block *sb)
reset_all_ctrls(r);
cdp_disable_all();
rmdir_all_sub();
+   rdtgroup_default.mode = RDT_MODE_SHAREABLE;
static_branch_disable_cpuslocked(_alloc_enable_key);
static_branch_disable_cpuslocked(_mon_enable_key);
static_branch_disable_cpuslocked(_enable_key);


[tip:x86/cache] x86/intel_rdt: Associate mode with each RDT resource group

2018-06-19 Thread tip-bot for Reinette Chatre
Commit-ID:  5363fc10521acb00c4bdc19ab9e2482db12b5514
Gitweb: https://git.kernel.org/tip/5363fc10521acb00c4bdc19ab9e2482db12b5514
Author: Reinette Chatre 
AuthorDate: Tue, 29 May 2018 05:57:28 -0700
Committer:  Thomas Gleixner 
CommitDate: Wed, 20 Jun 2018 00:56:27 +0200

x86/intel_rdt: Associate mode with each RDT resource group

Each RDT resource group is associated with a mode that will reflect
the level of sharing of its allocations. The default, shareable, will be
associated with each resource group on creation since it is zero and
resource groups are created with kzalloc. The managing of the mode of a
resource group will follow. The default resource group always remain
though so ensure that it is reset to the default mode when the resctrl
filesystem is unmounted.

Also introduce a utility that can be used to determine the mode of a
resource group when it is searched for based on its class of service.

Signed-off-by: Reinette Chatre 
Signed-off-by: Thomas Gleixner 
Cc: fenghua...@intel.com
Cc: tony.l...@intel.com
Cc: vikas.shiva...@linux.intel.com
Cc: gavin.hind...@intel.com
Cc: jithu.jos...@intel.com
Cc: dave.han...@intel.com
Cc: h...@zytor.com
Link: 
https://lkml.kernel.org/r/2f1844c590a87f96b8b948d5d6da54b532d25888.1527593970.git.reinette.cha...@intel.com

---
 arch/x86/kernel/cpu/intel_rdt.h  |  3 +++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 ++
 2 files changed, 25 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index c08eee73ecd3..7ff1f633bebe 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -122,6 +122,7 @@ struct mongroup {
  * @type:  indicates type of this rdtgroup - either
  * monitor only or ctrl_mon group
  * @mon:   mongroup related data
+ * @mode:  mode of resource group
  */
 struct rdtgroup {
struct kernfs_node  *kn;
@@ -132,6 +133,7 @@ struct rdtgroup {
atomic_twaitcount;
enum rdt_group_type type;
struct mongroup mon;
+   enum rdtgrp_modemode;
 };
 
 /* rdtgroup.flags */
@@ -461,6 +463,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off);
 int rdtgroup_schemata_show(struct kernfs_open_file *of,
   struct seq_file *s, void *v);
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
 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 749856a2e736..70d7846041fe 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -126,6 +126,27 @@ static void closid_free(int closid)
closid_free_map |= 1 << closid;
 }
 
+/**
+ * rdtgroup_mode_by_closid - Return mode of resource group with closid
+ * @closid: closid if the resource group
+ *
+ * Each resource group is associated with a @closid. Here the mode
+ * of a resource group can be queried by searching for it using its closid.
+ *
+ * Return: mode as  rdtgrp_mode of resource group with closid @closid
+ */
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid)
+{
+   struct rdtgroup *rdtgrp;
+
+   list_for_each_entry(rdtgrp, _all_groups, rdtgroup_list) {
+   if (rdtgrp->closid == closid)
+   return rdtgrp->mode;
+   }
+
+   return RDT_NUM_MODES;
+}
+
 /* set uid and gid of rdtgroup dirs and files to that of the creator */
 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn)
 {
@@ -1483,6 +1504,7 @@ static void rdt_kill_sb(struct super_block *sb)
reset_all_ctrls(r);
cdp_disable_all();
rmdir_all_sub();
+   rdtgroup_default.mode = RDT_MODE_SHAREABLE;
static_branch_disable_cpuslocked(_alloc_enable_key);
static_branch_disable_cpuslocked(_mon_enable_key);
static_branch_disable_cpuslocked(_enable_key);


[tip:x86/cache] x86/intel_rdt: Associate mode with each RDT resource group

2018-06-19 Thread tip-bot for Reinette Chatre
Commit-ID:  5363fc10521acb00c4bdc19ab9e2482db12b5514
Gitweb: https://git.kernel.org/tip/5363fc10521acb00c4bdc19ab9e2482db12b5514
Author: Reinette Chatre 
AuthorDate: Tue, 29 May 2018 05:57:28 -0700
Committer:  Thomas Gleixner 
CommitDate: Wed, 20 Jun 2018 00:56:27 +0200

x86/intel_rdt: Associate mode with each RDT resource group

Each RDT resource group is associated with a mode that will reflect
the level of sharing of its allocations. The default, shareable, will be
associated with each resource group on creation since it is zero and
resource groups are created with kzalloc. The managing of the mode of a
resource group will follow. The default resource group always remain
though so ensure that it is reset to the default mode when the resctrl
filesystem is unmounted.

Also introduce a utility that can be used to determine the mode of a
resource group when it is searched for based on its class of service.

Signed-off-by: Reinette Chatre 
Signed-off-by: Thomas Gleixner 
Cc: fenghua...@intel.com
Cc: tony.l...@intel.com
Cc: vikas.shiva...@linux.intel.com
Cc: gavin.hind...@intel.com
Cc: jithu.jos...@intel.com
Cc: dave.han...@intel.com
Cc: h...@zytor.com
Link: 
https://lkml.kernel.org/r/2f1844c590a87f96b8b948d5d6da54b532d25888.1527593970.git.reinette.cha...@intel.com

---
 arch/x86/kernel/cpu/intel_rdt.h  |  3 +++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 ++
 2 files changed, 25 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index c08eee73ecd3..7ff1f633bebe 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -122,6 +122,7 @@ struct mongroup {
  * @type:  indicates type of this rdtgroup - either
  * monitor only or ctrl_mon group
  * @mon:   mongroup related data
+ * @mode:  mode of resource group
  */
 struct rdtgroup {
struct kernfs_node  *kn;
@@ -132,6 +133,7 @@ struct rdtgroup {
atomic_twaitcount;
enum rdt_group_type type;
struct mongroup mon;
+   enum rdtgrp_modemode;
 };
 
 /* rdtgroup.flags */
@@ -461,6 +463,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off);
 int rdtgroup_schemata_show(struct kernfs_open_file *of,
   struct seq_file *s, void *v);
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
 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 749856a2e736..70d7846041fe 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -126,6 +126,27 @@ static void closid_free(int closid)
closid_free_map |= 1 << closid;
 }
 
+/**
+ * rdtgroup_mode_by_closid - Return mode of resource group with closid
+ * @closid: closid if the resource group
+ *
+ * Each resource group is associated with a @closid. Here the mode
+ * of a resource group can be queried by searching for it using its closid.
+ *
+ * Return: mode as  rdtgrp_mode of resource group with closid @closid
+ */
+enum rdtgrp_mode rdtgroup_mode_by_closid(int closid)
+{
+   struct rdtgroup *rdtgrp;
+
+   list_for_each_entry(rdtgrp, _all_groups, rdtgroup_list) {
+   if (rdtgrp->closid == closid)
+   return rdtgrp->mode;
+   }
+
+   return RDT_NUM_MODES;
+}
+
 /* set uid and gid of rdtgroup dirs and files to that of the creator */
 static int rdtgroup_kn_set_ugid(struct kernfs_node *kn)
 {
@@ -1483,6 +1504,7 @@ static void rdt_kill_sb(struct super_block *sb)
reset_all_ctrls(r);
cdp_disable_all();
rmdir_all_sub();
+   rdtgroup_default.mode = RDT_MODE_SHAREABLE;
static_branch_disable_cpuslocked(_alloc_enable_key);
static_branch_disable_cpuslocked(_mon_enable_key);
static_branch_disable_cpuslocked(_enable_key);