Skip to content

Commit 5dc1d5c

Browse files
aeglKAGA-KOKO
authored andcommitted
x86/intel_rdt: Simplify info and base file lists
The info directory files and base files need to be different for each resource like cache and Memory bandwidth. With in each resource, the files would be further different for monitoring and ctrl. This leads to a lot of different static array declarations given that we are adding resctrl monitoring. Simplify this to one common list of files and then declare a set of flags to choose the files based on the resource, whether it is info or base and if it is control type file. This is as a preparation to include monitoring based info and base files. No functional change. [Vikas: Extended the flags to have few bits per category like resource, info/base etc] Signed-off-by: Tony luck <tony.luck@intel.com> Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: ravi.v.shankar@intel.com Cc: fenghua.yu@intel.com Cc: peterz@infradead.org Cc: eranian@google.com Cc: vikas.shivappa@intel.com Cc: ak@linux.intel.com Cc: davidcc@google.com Cc: reinette.chatre@intel.com Link: http://lkml.kernel.org/r/1501017287-28083-11-git-send-email-vikas.shivappa@linux.intel.com
1 parent edf6fa1 commit 5dc1d5c

3 files changed

Lines changed: 112 additions & 104 deletions

File tree

‎arch/x86/kernel/cpu/intel_rdt.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct rdt_resource rdt_resources_all[] = {
8383
},
8484
.parse_ctrlval = parse_cbm,
8585
.format_str = "%d=%0*x",
86+
.fflags = RFTYPE_RES_CACHE,
8687
},
8788
[RDT_RESOURCE_L3DATA] =
8889
{
@@ -98,6 +99,7 @@ struct rdt_resource rdt_resources_all[] = {
9899
},
99100
.parse_ctrlval = parse_cbm,
100101
.format_str = "%d=%0*x",
102+
.fflags = RFTYPE_RES_CACHE,
101103
},
102104
[RDT_RESOURCE_L3CODE] =
103105
{
@@ -113,6 +115,7 @@ struct rdt_resource rdt_resources_all[] = {
113115
},
114116
.parse_ctrlval = parse_cbm,
115117
.format_str = "%d=%0*x",
118+
.fflags = RFTYPE_RES_CACHE,
116119
},
117120
[RDT_RESOURCE_L2] =
118121
{
@@ -128,6 +131,7 @@ struct rdt_resource rdt_resources_all[] = {
128131
},
129132
.parse_ctrlval = parse_cbm,
130133
.format_str = "%d=%0*x",
134+
.fflags = RFTYPE_RES_CACHE,
131135
},
132136
[RDT_RESOURCE_MBA] =
133137
{
@@ -138,6 +142,7 @@ struct rdt_resource rdt_resources_all[] = {
138142
.cache_level = 3,
139143
.parse_ctrlval = parse_bw,
140144
.format_str = "%d=%*d",
145+
.fflags = RFTYPE_RES_MB,
141146
},
142147
};
143148

@@ -233,7 +238,6 @@ static bool rdt_get_mem_config(struct rdt_resource *r)
233238
return false;
234239
}
235240
r->data_width = 3;
236-
rdt_get_mba_infofile(r);
237241

238242
r->alloc_capable = true;
239243
r->alloc_enabled = true;
@@ -252,7 +256,6 @@ static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r)
252256
r->cache.cbm_len = eax.split.cbm_len + 1;
253257
r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
254258
r->data_width = (r->cache.cbm_len + 3) / 4;
255-
rdt_get_cache_infofile(r);
256259
r->alloc_capable = true;
257260
r->alloc_enabled = true;
258261
}

‎arch/x86/kernel/cpu/intel_rdt.h‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ struct rdtgroup {
6262
/* rftype.flags */
6363
#define RFTYPE_FLAGS_CPUS_LIST 1
6464

65+
/*
66+
* Define the file type flags for base and info directories.
67+
*/
68+
#define RFTYPE_INFO BIT(0)
69+
#define RFTYPE_BASE BIT(1)
70+
#define RF_CTRLSHIFT 4
71+
#define RFTYPE_CTRL BIT(RF_CTRLSHIFT)
72+
#define RFTYPE_RES_CACHE BIT(8)
73+
#define RFTYPE_RES_MB BIT(9)
74+
#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
75+
#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL)
76+
6577
/* List of all resource groups */
6678
extern struct list_head rdt_all_groups;
6779

@@ -75,6 +87,7 @@ int __init rdtgroup_init(void);
7587
* @mode: Access mode
7688
* @kf_ops: File operations
7789
* @flags: File specific RFTYPE_FLAGS_* flags
90+
* @fflags: File specific RF_* or RFTYPE_* flags
7891
* @seq_show: Show content of the file
7992
* @write: Write to the file
8093
*/
@@ -83,6 +96,7 @@ struct rftype {
8396
umode_t mode;
8497
struct kernfs_ops *kf_ops;
8598
unsigned long flags;
99+
unsigned long fflags;
86100

87101
int (*seq_show)(struct kernfs_open_file *of,
88102
struct seq_file *sf, void *v);
@@ -181,13 +195,12 @@ static inline bool is_llc_occupancy_enabled(void)
181195
* @data_width: Character width of data when displaying
182196
* @domains: All domains for this resource
183197
* @cache: Cache allocation related data
184-
* @info_files: resctrl info files for the resource
185-
* @nr_info_files: Number of info files
186198
* @format_str: Per resource format string to show domain value
187199
* @parse_ctrlval: Per resource function pointer to parse control values
188200
* @evt_list: List of monitoring events
189201
* @num_rmid: Number of RMIDs available
190202
* @mon_scale: cqm counter * mon_scale = occupancy in bytes
203+
* @fflags: flags to choose base and info files
191204
*/
192205
struct rdt_resource {
193206
bool alloc_enabled;
@@ -205,18 +218,15 @@ struct rdt_resource {
205218
struct list_head domains;
206219
struct rdt_cache cache;
207220
struct rdt_membw membw;
208-
struct rftype *info_files;
209-
int nr_info_files;
210221
const char *format_str;
211222
int (*parse_ctrlval) (char *buf, struct rdt_resource *r,
212223
struct rdt_domain *d);
213224
struct list_head evt_list;
214225
int num_rmid;
215226
unsigned int mon_scale;
227+
unsigned long fflags;
216228
};
217229

218-
void rdt_get_cache_infofile(struct rdt_resource *r);
219-
void rdt_get_mba_infofile(struct rdt_resource *r);
220230
int parse_cbm(char *buf, struct rdt_resource *r, struct rdt_domain *d);
221231
int parse_bw(char *buf, struct rdt_resource *r, struct rdt_domain *d);
222232

0 commit comments

Comments
 (0)