Skip to content

Commit c793da8

Browse files
rchatreKAGA-KOKO
authored andcommitted
x86/intel_rdt: Global closid helper to support future fixes
The number of CLOSIDs supported by a system is the minimum number of CLOSIDs supported by any of its resources. Care should be taken when iterating over the CLOSIDs of a resource since it may be that the number of CLOSIDs supported on the system is less than the number of CLOSIDs supported by the resource. Introduce a helper function that can be used to query the number of CLOSIDs that is supported by all resources, irrespective of how many CLOSIDs are supported by a particular resource. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: "H Peter Anvin" <hpa@zytor.com> Cc: "Tony Luck" <tony.luck@intel.com> Cc: "Xiaochen Shen" <xiaochen.shen@intel.com> Cc: "Chen Yu" <yu.c.chen@intel.com> Link: https://lkml.kernel.org/r/1537048707-76280-4-git-send-email-fenghua.yu@intel.com
1 parent f968dc1 commit c793da8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/x86/kernel/cpu/intel_rdt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp);
544544
void rdtgroup_pseudo_lock_remove(struct rdtgroup *rdtgrp);
545545
struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
546546
int update_domains(struct rdt_resource *r, int closid);
547+
int closids_supported(void);
547548
void closid_free(int closid);
548549
int alloc_rmid(void);
549550
void free_rmid(u32 rmid);

arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ void rdt_last_cmd_printf(const char *fmt, ...)
9797
* limited as the number of resources grows.
9898
*/
9999
static int closid_free_map;
100+
static int closid_free_map_len;
101+
102+
int closids_supported(void)
103+
{
104+
return closid_free_map_len;
105+
}
100106

101107
static void closid_init(void)
102108
{
@@ -111,6 +117,7 @@ static void closid_init(void)
111117

112118
/* CLOSID 0 is always reserved for the default group */
113119
closid_free_map &= ~1;
120+
closid_free_map_len = rdt_min_closid;
114121
}
115122

116123
static int closid_alloc(void)

0 commit comments

Comments
 (0)