x86/resctrl: Kill off alloc_enabled
authorJames Morse <james.morse@arm.com>
Fri, 2 Sep 2022 15:48:09 +0000 (15:48 +0000)
committerBorislav Petkov <bp@suse.de>
Thu, 22 Sep 2022 12:34:33 +0000 (14:34 +0200)
rdt_resources_all[] used to have extra entries for L2CODE/L2DATA.
These were hidden from resctrl by the alloc_enabled value.

Now that the L2/L2CODE/L2DATA resources have been merged together,
alloc_enabled doesn't mean anything, it always has the same value as
alloc_capable which indicates allocation is supported by this resource.

Remove alloc_enabled and its helpers.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jamie Iles <quic_jiles@quicinc.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Xin Hao <xhao@linux.alibaba.com>
Tested-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20220902154829.30399-2-james.morse@arm.com
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/pseudo_lock.c
arch/x86/kernel/cpu/resctrl/rdtgroup.c
include/linux/resctrl.h

index bb1c3f5..2f87177 100644 (file)
@@ -147,7 +147,6 @@ static inline void cache_alloc_hsw_probe(void)
        r->cache.shareable_bits = 0xc0000;
        r->cache.min_cbm_bits = 2;
        r->alloc_capable = true;
-       r->alloc_enabled = true;
 
        rdt_alloc_capable = true;
 }
@@ -211,7 +210,6 @@ static bool __get_mem_config_intel(struct rdt_resource *r)
        thread_throttle_mode_init();
 
        r->alloc_capable = true;
-       r->alloc_enabled = true;
 
        return true;
 }
@@ -242,7 +240,6 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r)
        r->data_width = 4;
 
        r->alloc_capable = true;
-       r->alloc_enabled = true;
 
        return true;
 }
@@ -261,7 +258,6 @@ static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r)
        r->cache.shareable_bits = ebx & r->default_ctrl;
        r->data_width = (r->cache.cbm_len + 3) / 4;
        r->alloc_capable = true;
-       r->alloc_enabled = true;
 }
 
 static void rdt_get_cdp_config(int level)
index 1d64718..53f3d27 100644 (file)
@@ -459,10 +459,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable);
        for_each_rdt_resource(r)                                              \
                if (r->mon_capable)
 
-#define for_each_alloc_enabled_rdt_resource(r)                               \
-       for_each_rdt_resource(r)                                              \
-               if (r->alloc_enabled)
-
 #define for_each_mon_enabled_rdt_resource(r)                                 \
        for_each_rdt_resource(r)                                              \
                if (r->mon_enabled)
index 4d83989..d961ae3 100644 (file)
@@ -837,7 +837,7 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d)
         * First determine which cpus have pseudo-locked regions
         * associated with them.
         */
-       for_each_alloc_enabled_rdt_resource(r) {
+       for_each_alloc_capable_rdt_resource(r) {
                list_for_each_entry(d_i, &r->domains, list) {
                        if (d_i->plr)
                                cpumask_or(cpu_with_psl, cpu_with_psl,
index f276aff..526eb93 100644 (file)
@@ -1756,7 +1756,7 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
        if (ret)
                goto out_destroy;
 
-       /* loop over enabled controls, these are all alloc_enabled */
+       /* loop over enabled controls, these are all alloc_capable */
        list_for_each_entry(s, &resctrl_schema_all, list) {
                r = s->res;
                fflags =  r->fflags | RF_CTRL_INFO;
@@ -2106,7 +2106,7 @@ static int schemata_list_create(void)
        struct rdt_resource *r;
        int ret = 0;
 
-       for_each_alloc_enabled_rdt_resource(r) {
+       for_each_alloc_capable_rdt_resource(r) {
                if (resctrl_arch_get_cdp_enabled(r->rid)) {
                        ret = schemata_list_add(r, CDP_CODE);
                        if (ret)
@@ -2452,7 +2452,7 @@ static void rdt_kill_sb(struct super_block *sb)
        set_mba_sc(false);
 
        /*Put everything back to default values. */
-       for_each_alloc_enabled_rdt_resource(r)
+       for_each_alloc_capable_rdt_resource(r)
                reset_all_ctrls(r);
        cdp_disable_all();
        rmdir_all_sub();
index 21deb52..386ab3a 100644 (file)
@@ -130,7 +130,6 @@ struct resctrl_schema;
 /**
  * struct rdt_resource - attributes of a resctrl resource
  * @rid:               The index of the resource
- * @alloc_enabled:     Is allocation enabled on this machine
  * @mon_enabled:       Is monitoring enabled for this feature
  * @alloc_capable:     Is allocation available on this machine
  * @mon_capable:       Is monitor feature available on this machine
@@ -150,7 +149,6 @@ struct resctrl_schema;
  */
 struct rdt_resource {
        int                     rid;
-       bool                    alloc_enabled;
        bool                    mon_enabled;
        bool                    alloc_capable;
        bool                    mon_capable;