aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Shivappa <vikas.shivappa@linux.intel.com>2017-04-03 17:44:17 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-04-05 11:22:31 -0400
commitde016df88f23a5ab0cec3a8e05f6066388725b9e (patch)
tree33964914d31b503dea6765c233d57c884e8e0485
parentc4026b7b95a4b852e404afa2cd7720866159d118 (diff)
x86/intel_rdt: Update schemata read to show data in tabular format
The schemata file displays data from different resources on all domains. Its cumbersome to read since they are not tabular and data/names could be of different widths. Make the schemata file to display data in a tabular format thereby making it nice and simple to read. Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com> Cc: ravi.v.shankar@intel.com Cc: tony.luck@intel.com Cc: fenghua.yu@intel.com Cc: peterz@infradead.org Cc: vikas.shivappa@intel.com Cc: h.peter.anvin@intel.com Link: http://lkml.kernel.org/r/1491255857-17213-4-git-send-email-vikas.shivappa@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/include/asm/intel_rdt.h4
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.c30
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_schemata.c5
3 files changed, 37 insertions, 2 deletions
diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h
index d7705270c401..3f313991c0b3 100644
--- a/arch/x86/include/asm/intel_rdt.h
+++ b/arch/x86/include/asm/intel_rdt.h
@@ -40,6 +40,8 @@ struct rdtgroup {
40/* List of all resource groups */ 40/* List of all resource groups */
41extern struct list_head rdt_all_groups; 41extern struct list_head rdt_all_groups;
42 42
43extern int max_name_width, max_data_width;
44
43int __init rdtgroup_init(void); 45int __init rdtgroup_init(void);
44 46
45/** 47/**
@@ -73,6 +75,7 @@ struct rftype {
73 * @name: Name to use in "schemata" file 75 * @name: Name to use in "schemata" file
74 * @num_closid: Number of CLOSIDs available 76 * @num_closid: Number of CLOSIDs available
75 * @max_cbm: Largest Cache Bit Mask allowed 77 * @max_cbm: Largest Cache Bit Mask allowed
78 * @data_width: Character width of data when displaying
76 * @min_cbm_bits: Minimum number of consecutive bits to be set 79 * @min_cbm_bits: Minimum number of consecutive bits to be set
77 * in a cache bit mask 80 * in a cache bit mask
78 * @domains: All domains for this resource 81 * @domains: All domains for this resource
@@ -90,6 +93,7 @@ struct rdt_resource {
90 int cbm_len; 93 int cbm_len;
91 int min_cbm_bits; 94 int min_cbm_bits;
92 u32 max_cbm; 95 u32 max_cbm;
96 int data_width;
93 struct list_head domains; 97 struct list_head domains;
94 int msr_base; 98 int msr_base;
95 int cache_level; 99 int cache_level;
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index 329b8876b984..70a3307fd592 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -39,6 +39,12 @@ DEFINE_PER_CPU_READ_MOSTLY(int, cpu_closid);
39 39
40#define domain_init(id) LIST_HEAD_INIT(rdt_resources_all[id].domains) 40#define domain_init(id) LIST_HEAD_INIT(rdt_resources_all[id].domains)
41 41
42/*
43 * Used to store the max resource name width and max resource data width
44 * to display the schemata in a tabular format
45 */
46int max_name_width, max_data_width;
47
42struct rdt_resource rdt_resources_all[] = { 48struct rdt_resource rdt_resources_all[] = {
43 { 49 {
44 .name = "L3", 50 .name = "L3",
@@ -140,6 +146,7 @@ static void rdt_get_config(int idx, struct rdt_resource *r)
140 r->num_closid = edx.split.cos_max + 1; 146 r->num_closid = edx.split.cos_max + 1;
141 r->cbm_len = eax.split.cbm_len + 1; 147 r->cbm_len = eax.split.cbm_len + 1;
142 r->max_cbm = BIT_MASK(eax.split.cbm_len + 1) - 1; 148 r->max_cbm = BIT_MASK(eax.split.cbm_len + 1) - 1;
149 r->data_width = (r->cbm_len + 3) / 4;
143 r->capable = true; 150 r->capable = true;
144 r->enabled = true; 151 r->enabled = true;
145} 152}
@@ -152,6 +159,7 @@ static void rdt_get_cdp_l3_config(int type)
152 r->num_closid = r_l3->num_closid / 2; 159 r->num_closid = r_l3->num_closid / 2;
153 r->cbm_len = r_l3->cbm_len; 160 r->cbm_len = r_l3->cbm_len;
154 r->max_cbm = r_l3->max_cbm; 161 r->max_cbm = r_l3->max_cbm;
162 r->data_width = (r->cbm_len + 3) / 4;
155 r->capable = true; 163 r->capable = true;
156 /* 164 /*
157 * By default, CDP is disabled. CDP can be enabled by mount parameter 165 * By default, CDP is disabled. CDP can be enabled by mount parameter
@@ -160,6 +168,26 @@ static void rdt_get_cdp_l3_config(int type)
160 r->enabled = false; 168 r->enabled = false;
161} 169}
162 170
171/**
172 * Choose a width for the resource name
173 * and resource data based on the resource that has
174 * widest name and cbm.
175 */
176static void rdt_init_padding(void)
177{
178 struct rdt_resource *r;
179 int cl;
180
181 for_each_enabled_rdt_resource(r) {
182 cl = strlen(r->name);
183 if (cl > max_name_width)
184 max_name_width = cl;
185
186 if (r->data_width > max_data_width)
187 max_data_width = r->data_width;
188 }
189}
190
163static inline bool get_rdt_resources(void) 191static inline bool get_rdt_resources(void)
164{ 192{
165 bool ret = false; 193 bool ret = false;
@@ -184,6 +212,8 @@ static inline bool get_rdt_resources(void)
184 ret = true; 212 ret = true;
185 } 213 }
186 214
215 rdt_init_padding();
216
187 return ret; 217 return ret;
188} 218}
189 219
diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c
index 52e83eabd9b7..8594db455aa1 100644
--- a/arch/x86/kernel/cpu/intel_rdt_schemata.c
+++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c
@@ -203,11 +203,12 @@ static void show_doms(struct seq_file *s, struct rdt_resource *r, int closid)
203 struct rdt_domain *dom; 203 struct rdt_domain *dom;
204 bool sep = false; 204 bool sep = false;
205 205
206 seq_printf(s, "%s:", r->name); 206 seq_printf(s, "%*s:", max_name_width, r->name);
207 list_for_each_entry(dom, &r->domains, list) { 207 list_for_each_entry(dom, &r->domains, list) {
208 if (sep) 208 if (sep)
209 seq_puts(s, ";"); 209 seq_puts(s, ";");
210 seq_printf(s, "%d=%x", dom->id, dom->cbm[closid]); 210 seq_printf(s, "%d=%0*x", dom->id, max_data_width,
211 dom->cbm[closid]);
211 sep = true; 212 sep = true;
212 } 213 }
213 seq_puts(s, "\n"); 214 seq_puts(s, "\n");