Re: [PATCH 07/24] x86/resctrl: Label the resources with their configuration type

From: Reinette Chatre
Date: Tue Nov 17 2020 - 17:30:37 EST


Hi James,

On 10/30/2020 9:11 AM, James Morse wrote:
Before the name for the schema can be generated, the type of the
configuration being applied to the resource needs to be known. Label
all the entries in rdt_resources_all[], and copy that value in to struct

s/in to/into/ or s/in to/to/ ?

resctrl_schema.


This commit message does not explain why it is needed to copy this value.

Subsequent patches will generate the schema names in what will become
the fs code. Eventually the fs code will generate pairs of CODE/DATA if
the platform supports CDP for this resource.

Explaining how the copy is a step towards accomplishing this goal would be very helpful.


Signed-off-by: James Morse <james.morse@xxxxxxx>
---
arch/x86/kernel/cpu/resctrl/core.c | 7 +++++++
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 +
include/linux/resctrl.h | 8 ++++++++
4 files changed, 17 insertions(+)



diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 682e84aebd14..6c87a81946b1 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -367,6 +367,7 @@ struct rdt_parse_data {
* @mon_scale: cqm counter * mon_scale = occupancy in bytes
*/
struct rdt_hw_resource {
+ enum resctrl_conf_type conf_type;
struct rdt_resource resctrl;

Missing an accompanying kernel-doc entry?

int num_closid;
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 1bd785b1920c..628e5eb4d7a9 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -2141,6 +2141,7 @@ static int create_schemata_list(void)
s->res = r;
s->num_closid = resctrl_arch_get_num_closid(r);

Above seems to be last user of this helper remaining ... why is helper needed instead of something similar to below?

+ s->conf_type = resctrl_to_arch_res(r)->conf_type;
INIT_LIST_HEAD(&s->list);
list_add(&s->list, &resctrl_all_schema);
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index b32152968bca..20d8b6dd4af4 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -15,6 +15,12 @@ int proc_resctrl_show(struct seq_file *m,
#endif
+enum resctrl_conf_type {
+ CDP_BOTH,
+ CDP_CODE,
+ CDP_DATA,
+};
+
/**
* struct rdt_domain - group of cpus sharing an RDT resource
* @list: all instances of this resource
@@ -165,11 +171,13 @@ struct rdt_resource {
/**
* @list: Member of resctrl's schema list
+ * @cdp_type: Whether this entry is for code/data/both

Typo? This is fixed in the next patch so that hunk could be merged here.

* @res: The rdt_resource for this entry
* @num_closid Number of CLOSIDs available for this resource
*/
struct resctrl_schema {
struct list_head list;
+ enum resctrl_conf_type conf_type;
struct rdt_resource *res;
u32 num_closid;
};


Reinette