fs/resctrl/internal.h

Source file repositories/reference/linux-study-clean/fs/resctrl/internal.h

File Facts

System
Linux kernel
Corpus path
fs/resctrl/internal.h
Extension
.h
Size
15691 bytes
Lines
520
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rdt_fs_context {
	struct kernfs_fs_context	kfc;
	bool				enable_cdpl2;
	bool				enable_cdpl3;
	bool				enable_mba_mbps;
	bool				enable_debug;
};

static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
{
	struct kernfs_fs_context *kfc = fc->fs_private;

	return container_of(kfc, struct rdt_fs_context, kfc);
}

/**
 * struct mon_evt - Properties of a monitor event
 * @evtid:		event id
 * @rid:		resource id for this event
 * @name:		name of the event
 * @evt_cfg:		Event configuration value that represents the
 *			memory transactions (e.g., READS_TO_LOCAL_MEM,
 *			READS_TO_REMOTE_MEM) being tracked by @evtid.
 *			Only valid if @evtid is an MBM event.
 * @configurable:	true if the event is configurable
 * @any_cpu:		true if the event can be read from any CPU
 * @is_floating_point:	event values are displayed in floating point format
 * @binary_bits:	number of fixed-point binary bits from architecture,
 *			only valid if @is_floating_point is true
 * @enabled:		true if the event is enabled
 * @arch_priv:		Architecture private data for this event.
 *			The @arch_priv provided by the architecture via
 *			resctrl_enable_mon_event().
 */
struct mon_evt {
	enum resctrl_event_id	evtid;
	enum resctrl_res_level	rid;
	char			*name;
	u32			evt_cfg;
	bool			configurable;
	bool			any_cpu;
	bool			is_floating_point;
	unsigned int		binary_bits;
	bool			enabled;
	void			*arch_priv;
};

extern struct mon_evt mon_event_all[QOS_NUM_EVENTS];

#define for_each_mon_event(mevt) for (mevt = &mon_event_all[QOS_FIRST_EVENT];	\
				      mevt < &mon_event_all[QOS_NUM_EVENTS]; mevt++)

/* Limit for mon_evt::binary_bits */
#define MAX_BINARY_BITS	27

/**
 * struct mon_data - Monitoring details for each event file.
 * @list:            Member of the global @mon_data_kn_priv_list list.
 * @rid:             Resource id associated with the event file.
 * @evt:             Event structure associated with the event file.
 * @sum:             Set for RDT_RESOURCE_L3 when event must be summed
 *                   across multiple domains.
 * @domid:           When @sum is zero this is the domain to which
 *                   the event file belongs. When @sum is one this
 *                   is the id of the L3 cache that all domains to be
 *                   summed share.
 *
 * Pointed to by the kernfs kn->priv field of monitoring event files.
 * Readers and writers must hold rdtgroup_mutex.
 */
struct mon_data {
	struct list_head	list;
	enum resctrl_res_level	rid;
	struct mon_evt		*evt;
	int			domid;
	bool			sum;
};

/**
 * struct rmid_read - Data passed across smp_call*() to read event count.
 * @rgrp:  Resource group for which the counter is being read. If it is a parent
 *	   resource group then its event count is summed with the count from all
 *	   its child resource groups.
 * @r:	   Resource describing the properties of the event being read.
 * @hdr:   Header of domain that the counter should be read from. If NULL then
 *	   sum all domains in @r sharing L3 @ci.id
 * @evt:   Which monitor event to read.
 * @first: Initialize MBM counter when true.
 * @ci:    Cacheinfo for L3. Only set when @hdr is NULL. Used when summing
 *	   domains.

Annotation

Implementation Notes