diff options
Diffstat (limited to 'include/linux/resctrl.h')
| -rw-r--r-- | include/linux/resctrl.h | 88 | 
1 files changed, 63 insertions, 25 deletions
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index a365f67131ec..b0875b99e811 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -2,6 +2,7 @@  #ifndef _RESCTRL_H  #define _RESCTRL_H +#include <linux/cacheinfo.h>  #include <linux/kernel.h>  #include <linux/list.h>  #include <linux/pid.h> @@ -58,11 +59,45 @@ struct resctrl_staged_config {  	bool			have_new_ctrl;  }; +enum resctrl_domain_type { +	RESCTRL_CTRL_DOMAIN, +	RESCTRL_MON_DOMAIN, +}; +  /** - * struct rdt_domain - group of CPUs sharing a resctrl resource + * struct rdt_domain_hdr - common header for different domain types   * @list:		all instances of this resource   * @id:			unique id for this instance + * @type:		type of this instance   * @cpu_mask:		which CPUs share this resource + */ +struct rdt_domain_hdr { +	struct list_head		list; +	int				id; +	enum resctrl_domain_type	type; +	struct cpumask			cpu_mask; +}; + +/** + * struct rdt_ctrl_domain - group of CPUs sharing a resctrl control resource + * @hdr:		common header for different domain types + * @plr:		pseudo-locked region (if any) associated with domain + * @staged_config:	parsed configuration to be applied + * @mbps_val:		When mba_sc is enabled, this holds the array of user + *			specified control values for mba_sc in MBps, indexed + *			by closid + */ +struct rdt_ctrl_domain { +	struct rdt_domain_hdr		hdr; +	struct pseudo_lock_region	*plr; +	struct resctrl_staged_config	staged_config[CDP_NUM_TYPES]; +	u32				*mbps_val; +}; + +/** + * struct rdt_mon_domain - group of CPUs sharing a resctrl monitor resource + * @hdr:		common header for different domain types + * @ci:			cache info for this domain   * @rmid_busy_llc:	bitmap of which limbo RMIDs are above threshold   * @mbm_total:		saved state for MBM total bandwidth   * @mbm_local:		saved state for MBM local bandwidth @@ -70,16 +105,10 @@ struct resctrl_staged_config {   * @cqm_limbo:		worker to periodically read CQM h/w counters   * @mbm_work_cpu:	worker CPU for MBM h/w counters   * @cqm_work_cpu:	worker CPU for CQM h/w counters - * @plr:		pseudo-locked region (if any) associated with domain - * @staged_config:	parsed configuration to be applied - * @mbps_val:		When mba_sc is enabled, this holds the array of user - *			specified control values for mba_sc in MBps, indexed - *			by closid   */ -struct rdt_domain { -	struct list_head		list; -	int				id; -	struct cpumask			cpu_mask; +struct rdt_mon_domain { +	struct rdt_domain_hdr		hdr; +	struct cacheinfo		*ci;  	unsigned long			*rmid_busy_llc;  	struct mbm_state		*mbm_total;  	struct mbm_state		*mbm_local; @@ -87,9 +116,6 @@ struct rdt_domain {  	struct delayed_work		cqm_limbo;  	int				mbm_work_cpu;  	int				cqm_work_cpu; -	struct pseudo_lock_region	*plr; -	struct resctrl_staged_config	staged_config[CDP_NUM_TYPES]; -	u32				*mbps_val;  };  /** @@ -150,16 +176,24 @@ struct resctrl_membw {  struct rdt_parse_data;  struct resctrl_schema; +enum resctrl_scope { +	RESCTRL_L2_CACHE = 2, +	RESCTRL_L3_CACHE = 3, +	RESCTRL_L3_NODE, +}; +  /**   * struct rdt_resource - attributes of a resctrl resource   * @rid:		The index of the resource   * @alloc_capable:	Is allocation available on this machine   * @mon_capable:	Is monitor feature available on this machine   * @num_rmid:		Number of RMIDs available - * @cache_level:	Which cache level defines scope of this resource + * @ctrl_scope:		Scope of this resource for control functions + * @mon_scope:		Scope of this resource for monitor functions   * @cache:		Cache allocation related data   * @membw:		If the component has bandwidth controls, their properties. - * @domains:		RCU list of all domains for this resource + * @ctrl_domains:	RCU list of all control domains for this resource + * @mon_domains:	RCU list of all monitor domains for this resource   * @name:		Name to use in "schemata" file.   * @data_width:		Character width of data when displaying   * @default_ctrl:	Specifies default cache cbm or memory B/W percent. @@ -174,17 +208,19 @@ struct rdt_resource {  	bool			alloc_capable;  	bool			mon_capable;  	int			num_rmid; -	int			cache_level; +	enum resctrl_scope	ctrl_scope; +	enum resctrl_scope	mon_scope;  	struct resctrl_cache	cache;  	struct resctrl_membw	membw; -	struct list_head	domains; +	struct list_head	ctrl_domains; +	struct list_head	mon_domains;  	char			*name;  	int			data_width;  	u32			default_ctrl;  	const char		*format_str;  	int			(*parse_ctrlval)(struct rdt_parse_data *data,  						 struct resctrl_schema *s, -						 struct rdt_domain *d); +						 struct rdt_ctrl_domain *d);  	struct list_head	evt_list;  	unsigned long		fflags;  	bool			cdp_capable; @@ -218,13 +254,15 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);   * Update the ctrl_val and apply this config right now.   * Must be called on one of the domain's CPUs.   */ -int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, +int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,  			    u32 closid, enum resctrl_conf_type t, u32 cfg_val); -u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, +u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_ctrl_domain *d,  			    u32 closid, enum resctrl_conf_type type); -int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d); -void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d); +int resctrl_online_ctrl_domain(struct rdt_resource *r, struct rdt_ctrl_domain *d); +int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_mon_domain *d); +void resctrl_offline_ctrl_domain(struct rdt_resource *r, struct rdt_ctrl_domain *d); +void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_mon_domain *d);  void resctrl_online_cpu(unsigned int cpu);  void resctrl_offline_cpu(unsigned int cpu); @@ -253,7 +291,7 @@ void resctrl_offline_cpu(unsigned int cpu);   * Return:   * 0 on success, or -EIO, -EINVAL etc on error.   */ -int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d, +int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,  			   u32 closid, u32 rmid, enum resctrl_event_id eventid,  			   u64 *val, void *arch_mon_ctx); @@ -286,7 +324,7 @@ static inline void resctrl_arch_rmid_read_context_check(void)   *   * This can be called from any CPU.   */ -void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d, +void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d,  			     u32 closid, u32 rmid,  			     enum resctrl_event_id eventid); @@ -299,7 +337,7 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d,   *   * This can be called from any CPU.   */ -void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_domain *d); +void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d);  extern unsigned int resctrl_rmid_realloc_threshold;  extern unsigned int resctrl_rmid_realloc_limit;  |