]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/intel_rdt: Make information files resource specific
authorVikas Shivappa <vikas.shivappa@linux.intel.com>
Sat, 8 Apr 2017 00:33:54 +0000 (17:33 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 14 Apr 2017 14:10:08 +0000 (16:10 +0200)
Cache allocation and memory bandwidth allocation require different
information files in the resctrl/info directory, but the current
implementation does not allow to have files per resource.

Add the necessary fields to the resource struct and assign the files
dynamically depending on the resource type.

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: vikas.shivappa@intel.com
Link: http://lkml.kernel.org/r/1491611637-20417-6-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/asm/intel_rdt.h
arch/x86/kernel/cpu/intel_rdt.c
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

index 0620fc957e599230ff45a3c3f6b495e5138583f6..b0f0a600c7391a964b8ca771ed1b11593d27a06a 100644 (file)
@@ -150,6 +150,8 @@ struct rdt_membw {
  * @data_width:                Character width of data when displaying
  * @domains:           All domains for this resource
  * @cache:             Cache allocation related data
+ * @info_files:                resctrl info files for the resource
+ * @nr_info_files:     Number of info files
  */
 struct rdt_resource {
        bool                    enabled;
@@ -167,8 +169,12 @@ struct rdt_resource {
                struct rdt_cache        cache;
                struct rdt_membw        membw;
        };
+       struct rftype           *info_files;
+       int                     nr_info_files;
 };
 
+void rdt_get_cache_infofile(struct rdt_resource *r);
+
 extern struct mutex rdtgroup_mutex;
 
 extern struct rdt_resource rdt_resources_all[];
index ae1aec16a674efd061670ed088a8ae61beca4d4f..b387e04885becbb31f152157b97e13fbe6bd9900 100644 (file)
@@ -221,6 +221,7 @@ static void rdt_get_cache_config(int idx, struct rdt_resource *r)
        r->cache.cbm_len = eax.split.cbm_len + 1;
        r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
        r->data_width = (r->cache.cbm_len + 3) / 4;
+       rdt_get_cache_infofile(r);
        r->capable = true;
        r->enabled = true;
 }
index 3ec230baab91189145c90c1effb72c5e050cb9c6..65d957b965671a1418002724d488af4b8fc79e6d 100644 (file)
@@ -540,7 +540,7 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of,
 }
 
 /* rdtgroup information files for one cache resource. */
-static struct rftype res_info_files[] = {
+static struct rftype res_cache_info_files[] = {
        {
                .name           = "num_closids",
                .mode           = 0444,
@@ -561,11 +561,18 @@ static struct rftype res_info_files[] = {
        },
 };
 
+void rdt_get_cache_infofile(struct rdt_resource *r)
+{
+       r->info_files = res_cache_info_files;
+       r->nr_info_files = ARRAY_SIZE(res_cache_info_files);
+}
+
 static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
 {
        struct kernfs_node *kn_subdir;
+       struct rftype *res_info_files;
        struct rdt_resource *r;
-       int ret;
+       int ret, len;
 
        /* create the directory */
        kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL);
@@ -584,8 +591,11 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
                ret = rdtgroup_kn_set_ugid(kn_subdir);
                if (ret)
                        goto out_destroy;
-               ret = rdtgroup_add_files(kn_subdir, res_info_files,
-                                        ARRAY_SIZE(res_info_files));
+
+               res_info_files = r->info_files;
+               len = r->nr_info_files;
+
+               ret = rdtgroup_add_files(kn_subdir, res_info_files, len);
                if (ret)
                        goto out_destroy;
                kernfs_activate(kn_subdir);