diff options
-rw-r--r-- | arch/x86/include/asm/intel_rdt_sched.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt.c | 26 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt.h | 18 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 33 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_schemata.c | 8 |
5 files changed, 45 insertions, 44 deletions
diff --git a/arch/x86/include/asm/intel_rdt_sched.h b/arch/x86/include/asm/intel_rdt_sched.h index 62a70bc85bce..4dee77b6de07 100644 --- a/arch/x86/include/asm/intel_rdt_sched.h +++ b/arch/x86/include/asm/intel_rdt_sched.h | |||
@@ -27,7 +27,7 @@ struct intel_pqr_state { | |||
27 | 27 | ||
28 | DECLARE_PER_CPU(struct intel_pqr_state, pqr_state); | 28 | DECLARE_PER_CPU(struct intel_pqr_state, pqr_state); |
29 | DECLARE_PER_CPU_READ_MOSTLY(int, cpu_closid); | 29 | DECLARE_PER_CPU_READ_MOSTLY(int, cpu_closid); |
30 | DECLARE_STATIC_KEY_FALSE(rdt_enable_key); | 30 | DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR | 33 | * intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR |
@@ -44,7 +44,7 @@ DECLARE_STATIC_KEY_FALSE(rdt_enable_key); | |||
44 | */ | 44 | */ |
45 | static inline void intel_rdt_sched_in(void) | 45 | static inline void intel_rdt_sched_in(void) |
46 | { | 46 | { |
47 | if (static_branch_likely(&rdt_enable_key)) { | 47 | if (static_branch_likely(&rdt_alloc_enable_key)) { |
48 | struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); | 48 | struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); |
49 | int closid; | 49 | int closid; |
50 | 50 | ||
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 08872e9e09c3..835e1ff8449f 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c | |||
@@ -173,8 +173,8 @@ static inline bool cache_alloc_hsw_probe(void) | |||
173 | r->default_ctrl = max_cbm; | 173 | r->default_ctrl = max_cbm; |
174 | r->cache.cbm_len = 20; | 174 | r->cache.cbm_len = 20; |
175 | r->cache.min_cbm_bits = 2; | 175 | r->cache.min_cbm_bits = 2; |
176 | r->capable = true; | 176 | r->alloc_capable = true; |
177 | r->enabled = true; | 177 | r->alloc_enabled = true; |
178 | 178 | ||
179 | return true; | 179 | return true; |
180 | } | 180 | } |
@@ -224,8 +224,8 @@ static bool rdt_get_mem_config(struct rdt_resource *r) | |||
224 | r->data_width = 3; | 224 | r->data_width = 3; |
225 | rdt_get_mba_infofile(r); | 225 | rdt_get_mba_infofile(r); |
226 | 226 | ||
227 | r->capable = true; | 227 | r->alloc_capable = true; |
228 | r->enabled = true; | 228 | r->alloc_enabled = true; |
229 | 229 | ||
230 | return true; | 230 | return true; |
231 | } | 231 | } |
@@ -242,8 +242,8 @@ static void rdt_get_cache_config(int idx, struct rdt_resource *r) | |||
242 | r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1; | 242 | r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1; |
243 | r->data_width = (r->cache.cbm_len + 3) / 4; | 243 | r->data_width = (r->cache.cbm_len + 3) / 4; |
244 | rdt_get_cache_infofile(r); | 244 | rdt_get_cache_infofile(r); |
245 | r->capable = true; | 245 | r->alloc_capable = true; |
246 | r->enabled = true; | 246 | r->alloc_enabled = true; |
247 | } | 247 | } |
248 | 248 | ||
249 | static void rdt_get_cdp_l3_config(int type) | 249 | static void rdt_get_cdp_l3_config(int type) |
@@ -255,12 +255,12 @@ static void rdt_get_cdp_l3_config(int type) | |||
255 | r->cache.cbm_len = r_l3->cache.cbm_len; | 255 | r->cache.cbm_len = r_l3->cache.cbm_len; |
256 | r->default_ctrl = r_l3->default_ctrl; | 256 | r->default_ctrl = r_l3->default_ctrl; |
257 | r->data_width = (r->cache.cbm_len + 3) / 4; | 257 | r->data_width = (r->cache.cbm_len + 3) / 4; |
258 | r->capable = true; | 258 | r->alloc_capable = true; |
259 | /* | 259 | /* |
260 | * By default, CDP is disabled. CDP can be enabled by mount parameter | 260 | * By default, CDP is disabled. CDP can be enabled by mount parameter |
261 | * "cdp" during resctrl file system mount time. | 261 | * "cdp" during resctrl file system mount time. |
262 | */ | 262 | */ |
263 | r->enabled = false; | 263 | r->alloc_enabled = false; |
264 | } | 264 | } |
265 | 265 | ||
266 | static int get_cache_id(int cpu, int level) | 266 | static int get_cache_id(int cpu, int level) |
@@ -422,7 +422,7 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) | |||
422 | 422 | ||
423 | d->id = id; | 423 | d->id = id; |
424 | 424 | ||
425 | if (domain_setup_ctrlval(r, d)) { | 425 | if (r->alloc_capable && domain_setup_ctrlval(r, d)) { |
426 | kfree(d); | 426 | kfree(d); |
427 | return; | 427 | return; |
428 | } | 428 | } |
@@ -464,7 +464,7 @@ static int intel_rdt_online_cpu(unsigned int cpu) | |||
464 | struct rdt_resource *r; | 464 | struct rdt_resource *r; |
465 | 465 | ||
466 | mutex_lock(&rdtgroup_mutex); | 466 | mutex_lock(&rdtgroup_mutex); |
467 | for_each_capable_rdt_resource(r) | 467 | for_each_alloc_capable_rdt_resource(r) |
468 | domain_add_cpu(cpu, r); | 468 | domain_add_cpu(cpu, r); |
469 | /* The cpu is set in default rdtgroup after online. */ | 469 | /* The cpu is set in default rdtgroup after online. */ |
470 | cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask); | 470 | cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask); |
@@ -480,7 +480,7 @@ static int intel_rdt_offline_cpu(unsigned int cpu) | |||
480 | struct rdt_resource *r; | 480 | struct rdt_resource *r; |
481 | 481 | ||
482 | mutex_lock(&rdtgroup_mutex); | 482 | mutex_lock(&rdtgroup_mutex); |
483 | for_each_capable_rdt_resource(r) | 483 | for_each_alloc_capable_rdt_resource(r) |
484 | domain_remove_cpu(cpu, r); | 484 | domain_remove_cpu(cpu, r); |
485 | list_for_each_entry(rdtgrp, &rdt_all_groups, rdtgroup_list) { | 485 | list_for_each_entry(rdtgrp, &rdt_all_groups, rdtgroup_list) { |
486 | if (cpumask_test_and_clear_cpu(cpu, &rdtgrp->cpu_mask)) | 486 | if (cpumask_test_and_clear_cpu(cpu, &rdtgrp->cpu_mask)) |
@@ -501,7 +501,7 @@ static __init void rdt_init_padding(void) | |||
501 | struct rdt_resource *r; | 501 | struct rdt_resource *r; |
502 | int cl; | 502 | int cl; |
503 | 503 | ||
504 | for_each_capable_rdt_resource(r) { | 504 | for_each_alloc_capable_rdt_resource(r) { |
505 | cl = strlen(r->name); | 505 | cl = strlen(r->name); |
506 | if (cl > max_name_width) | 506 | if (cl > max_name_width) |
507 | max_name_width = cl; | 507 | max_name_width = cl; |
@@ -565,7 +565,7 @@ static int __init intel_rdt_late_init(void) | |||
565 | return ret; | 565 | return ret; |
566 | } | 566 | } |
567 | 567 | ||
568 | for_each_capable_rdt_resource(r) | 568 | for_each_alloc_capable_rdt_resource(r) |
569 | pr_info("Intel RDT %s allocation detected\n", r->name); | 569 | pr_info("Intel RDT %s allocation detected\n", r->name); |
570 | 570 | ||
571 | return 0; | 571 | return 0; |
diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index 0e4852d68faf..29630af30c38 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h | |||
@@ -135,8 +135,8 @@ struct rdt_membw { | |||
135 | 135 | ||
136 | /** | 136 | /** |
137 | * struct rdt_resource - attributes of an RDT resource | 137 | * struct rdt_resource - attributes of an RDT resource |
138 | * @enabled: Is this feature enabled on this machine | 138 | * @alloc_enabled: Is allocation enabled on this machine |
139 | * @capable: Is this feature available on this machine | 139 | * @alloc_capable: Is allocation available on this machine |
140 | * @name: Name to use in "schemata" file | 140 | * @name: Name to use in "schemata" file |
141 | * @num_closid: Number of CLOSIDs available | 141 | * @num_closid: Number of CLOSIDs available |
142 | * @cache_level: Which cache level defines scope of this resource | 142 | * @cache_level: Which cache level defines scope of this resource |
@@ -152,8 +152,8 @@ struct rdt_membw { | |||
152 | * @parse_ctrlval: Per resource function pointer to parse control values | 152 | * @parse_ctrlval: Per resource function pointer to parse control values |
153 | */ | 153 | */ |
154 | struct rdt_resource { | 154 | struct rdt_resource { |
155 | bool enabled; | 155 | bool alloc_enabled; |
156 | bool capable; | 156 | bool alloc_capable; |
157 | char *name; | 157 | char *name; |
158 | int num_closid; | 158 | int num_closid; |
159 | int cache_level; | 159 | int cache_level; |
@@ -181,7 +181,7 @@ extern struct mutex rdtgroup_mutex; | |||
181 | 181 | ||
182 | extern struct rdt_resource rdt_resources_all[]; | 182 | extern struct rdt_resource rdt_resources_all[]; |
183 | extern struct rdtgroup rdtgroup_default; | 183 | extern struct rdtgroup rdtgroup_default; |
184 | DECLARE_STATIC_KEY_FALSE(rdt_enable_key); | 184 | DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); |
185 | 185 | ||
186 | int __init rdtgroup_init(void); | 186 | int __init rdtgroup_init(void); |
187 | 187 | ||
@@ -196,15 +196,15 @@ enum { | |||
196 | RDT_NUM_RESOURCES, | 196 | RDT_NUM_RESOURCES, |
197 | }; | 197 | }; |
198 | 198 | ||
199 | #define for_each_capable_rdt_resource(r) \ | 199 | #define for_each_alloc_capable_rdt_resource(r) \ |
200 | for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\ | 200 | for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\ |
201 | r++) \ | 201 | r++) \ |
202 | if (r->capable) | 202 | if (r->alloc_capable) |
203 | 203 | ||
204 | #define for_each_enabled_rdt_resource(r) \ | 204 | #define for_each_alloc_enabled_rdt_resource(r) \ |
205 | for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\ | 205 | for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\ |
206 | r++) \ | 206 | r++) \ |
207 | if (r->enabled) | 207 | if (r->alloc_enabled) |
208 | 208 | ||
209 | /* CPUID.(EAX=10H, ECX=ResID=1).EAX */ | 209 | /* CPUID.(EAX=10H, ECX=ResID=1).EAX */ |
210 | union cpuid_0x10_1_eax { | 210 | union cpuid_0x10_1_eax { |
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 3273e88ab29d..ce63d1011e03 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <asm/intel_rdt_sched.h> | 35 | #include <asm/intel_rdt_sched.h> |
36 | #include "intel_rdt.h" | 36 | #include "intel_rdt.h" |
37 | 37 | ||
38 | DEFINE_STATIC_KEY_FALSE(rdt_enable_key); | 38 | DEFINE_STATIC_KEY_FALSE(rdt_alloc_enable_key); |
39 | static struct kernfs_root *rdt_root; | 39 | static struct kernfs_root *rdt_root; |
40 | struct rdtgroup rdtgroup_default; | 40 | struct rdtgroup rdtgroup_default; |
41 | LIST_HEAD(rdt_all_groups); | 41 | LIST_HEAD(rdt_all_groups); |
@@ -66,7 +66,7 @@ static void closid_init(void) | |||
66 | int rdt_min_closid = 32; | 66 | int rdt_min_closid = 32; |
67 | 67 | ||
68 | /* Compute rdt_min_closid across all resources */ | 68 | /* Compute rdt_min_closid across all resources */ |
69 | for_each_enabled_rdt_resource(r) | 69 | for_each_alloc_enabled_rdt_resource(r) |
70 | rdt_min_closid = min(rdt_min_closid, r->num_closid); | 70 | rdt_min_closid = min(rdt_min_closid, r->num_closid); |
71 | 71 | ||
72 | closid_free_map = BIT_MASK(rdt_min_closid) - 1; | 72 | closid_free_map = BIT_MASK(rdt_min_closid) - 1; |
@@ -638,7 +638,7 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) | |||
638 | return PTR_ERR(kn_info); | 638 | return PTR_ERR(kn_info); |
639 | kernfs_get(kn_info); | 639 | kernfs_get(kn_info); |
640 | 640 | ||
641 | for_each_enabled_rdt_resource(r) { | 641 | for_each_alloc_enabled_rdt_resource(r) { |
642 | kn_subdir = kernfs_create_dir(kn_info, r->name, | 642 | kn_subdir = kernfs_create_dir(kn_info, r->name, |
643 | kn_info->mode, r); | 643 | kn_info->mode, r); |
644 | if (IS_ERR(kn_subdir)) { | 644 | if (IS_ERR(kn_subdir)) { |
@@ -718,14 +718,15 @@ static int cdp_enable(void) | |||
718 | struct rdt_resource *r_l3 = &rdt_resources_all[RDT_RESOURCE_L3]; | 718 | struct rdt_resource *r_l3 = &rdt_resources_all[RDT_RESOURCE_L3]; |
719 | int ret; | 719 | int ret; |
720 | 720 | ||
721 | if (!r_l3->capable || !r_l3data->capable || !r_l3code->capable) | 721 | if (!r_l3->alloc_capable || !r_l3data->alloc_capable || |
722 | !r_l3code->alloc_capable) | ||
722 | return -EINVAL; | 723 | return -EINVAL; |
723 | 724 | ||
724 | ret = set_l3_qos_cfg(r_l3, true); | 725 | ret = set_l3_qos_cfg(r_l3, true); |
725 | if (!ret) { | 726 | if (!ret) { |
726 | r_l3->enabled = false; | 727 | r_l3->alloc_enabled = false; |
727 | r_l3data->enabled = true; | 728 | r_l3data->alloc_enabled = true; |
728 | r_l3code->enabled = true; | 729 | r_l3code->alloc_enabled = true; |
729 | } | 730 | } |
730 | return ret; | 731 | return ret; |
731 | } | 732 | } |
@@ -734,11 +735,11 @@ static void cdp_disable(void) | |||
734 | { | 735 | { |
735 | struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3]; | 736 | struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3]; |
736 | 737 | ||
737 | r->enabled = r->capable; | 738 | r->alloc_enabled = r->alloc_capable; |
738 | 739 | ||
739 | if (rdt_resources_all[RDT_RESOURCE_L3DATA].enabled) { | 740 | if (rdt_resources_all[RDT_RESOURCE_L3DATA].alloc_enabled) { |
740 | rdt_resources_all[RDT_RESOURCE_L3DATA].enabled = false; | 741 | rdt_resources_all[RDT_RESOURCE_L3DATA].alloc_enabled = false; |
741 | rdt_resources_all[RDT_RESOURCE_L3CODE].enabled = false; | 742 | rdt_resources_all[RDT_RESOURCE_L3CODE].alloc_enabled = false; |
742 | set_l3_qos_cfg(r, false); | 743 | set_l3_qos_cfg(r, false); |
743 | } | 744 | } |
744 | } | 745 | } |
@@ -834,7 +835,7 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, | |||
834 | /* | 835 | /* |
835 | * resctrl file system can only be mounted once. | 836 | * resctrl file system can only be mounted once. |
836 | */ | 837 | */ |
837 | if (static_branch_unlikely(&rdt_enable_key)) { | 838 | if (static_branch_unlikely(&rdt_alloc_enable_key)) { |
838 | dentry = ERR_PTR(-EBUSY); | 839 | dentry = ERR_PTR(-EBUSY); |
839 | goto out; | 840 | goto out; |
840 | } | 841 | } |
@@ -858,7 +859,7 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, | |||
858 | if (IS_ERR(dentry)) | 859 | if (IS_ERR(dentry)) |
859 | goto out_destroy; | 860 | goto out_destroy; |
860 | 861 | ||
861 | static_branch_enable(&rdt_enable_key); | 862 | static_branch_enable(&rdt_alloc_enable_key); |
862 | goto out; | 863 | goto out; |
863 | 864 | ||
864 | out_destroy: | 865 | out_destroy: |
@@ -986,11 +987,11 @@ static void rdt_kill_sb(struct super_block *sb) | |||
986 | mutex_lock(&rdtgroup_mutex); | 987 | mutex_lock(&rdtgroup_mutex); |
987 | 988 | ||
988 | /*Put everything back to default values. */ | 989 | /*Put everything back to default values. */ |
989 | for_each_enabled_rdt_resource(r) | 990 | for_each_alloc_enabled_rdt_resource(r) |
990 | reset_all_ctrls(r); | 991 | reset_all_ctrls(r); |
991 | cdp_disable(); | 992 | cdp_disable(); |
992 | rmdir_all_sub(); | 993 | rmdir_all_sub(); |
993 | static_branch_disable(&rdt_enable_key); | 994 | static_branch_disable(&rdt_alloc_enable_key); |
994 | kernfs_kill_sb(sb); | 995 | kernfs_kill_sb(sb); |
995 | mutex_unlock(&rdtgroup_mutex); | 996 | mutex_unlock(&rdtgroup_mutex); |
996 | } | 997 | } |
@@ -1129,7 +1130,7 @@ out: | |||
1129 | 1130 | ||
1130 | static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) | 1131 | static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) |
1131 | { | 1132 | { |
1132 | if (rdt_resources_all[RDT_RESOURCE_L3DATA].enabled) | 1133 | if (rdt_resources_all[RDT_RESOURCE_L3DATA].alloc_enabled) |
1133 | seq_puts(seq, ",cdp"); | 1134 | seq_puts(seq, ",cdp"); |
1134 | return 0; | 1135 | return 0; |
1135 | } | 1136 | } |
diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c index 8cef1c8e223a..952156c2688d 100644 --- a/arch/x86/kernel/cpu/intel_rdt_schemata.c +++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c | |||
@@ -192,7 +192,7 @@ static int rdtgroup_parse_resource(char *resname, char *tok, int closid) | |||
192 | { | 192 | { |
193 | struct rdt_resource *r; | 193 | struct rdt_resource *r; |
194 | 194 | ||
195 | for_each_enabled_rdt_resource(r) { | 195 | for_each_alloc_enabled_rdt_resource(r) { |
196 | if (!strcmp(resname, r->name) && closid < r->num_closid) | 196 | if (!strcmp(resname, r->name) && closid < r->num_closid) |
197 | return parse_line(tok, r); | 197 | return parse_line(tok, r); |
198 | } | 198 | } |
@@ -221,7 +221,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, | |||
221 | 221 | ||
222 | closid = rdtgrp->closid; | 222 | closid = rdtgrp->closid; |
223 | 223 | ||
224 | for_each_enabled_rdt_resource(r) { | 224 | for_each_alloc_enabled_rdt_resource(r) { |
225 | list_for_each_entry(dom, &r->domains, list) | 225 | list_for_each_entry(dom, &r->domains, list) |
226 | dom->have_new_ctrl = false; | 226 | dom->have_new_ctrl = false; |
227 | } | 227 | } |
@@ -237,7 +237,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, | |||
237 | goto out; | 237 | goto out; |
238 | } | 238 | } |
239 | 239 | ||
240 | for_each_enabled_rdt_resource(r) { | 240 | for_each_alloc_enabled_rdt_resource(r) { |
241 | ret = update_domains(r, closid); | 241 | ret = update_domains(r, closid); |
242 | if (ret) | 242 | if (ret) |
243 | goto out; | 243 | goto out; |
@@ -274,7 +274,7 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of, | |||
274 | rdtgrp = rdtgroup_kn_lock_live(of->kn); | 274 | rdtgrp = rdtgroup_kn_lock_live(of->kn); |
275 | if (rdtgrp) { | 275 | if (rdtgrp) { |
276 | closid = rdtgrp->closid; | 276 | closid = rdtgrp->closid; |
277 | for_each_enabled_rdt_resource(r) { | 277 | for_each_alloc_enabled_rdt_resource(r) { |
278 | if (closid < r->num_closid) | 278 | if (closid < r->num_closid) |
279 | show_doms(s, r, closid); | 279 | show_doms(s, r, closid); |
280 | } | 280 | } |