tools/testing/selftests/resctrl/resctrl.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/resctrl/resctrl.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/resctrl/resctrl.h
Extension
.h
Size
8841 bytes
Lines
247
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct fill_buf_param {
	size_t		buf_size;
	bool		memflush;
};

/*
 * user_params:		User supplied parameters
 * @cpu:		CPU number to which the benchmark will be bound to
 * @bits:		Number of bits used for cache allocation size
 * @benchmark_cmd:	Benchmark command to run during (some of the) tests
 * @fill_buf:		Pointer to user provided parameters for "fill_buf",
 *			NULL if user did not provide parameters and test
 *			specific defaults should be used.
 */
struct user_params {
	int cpu;
	int bits;
	const char *benchmark_cmd[BENCHMARK_ARGS];
	const struct fill_buf_param *fill_buf;
};

/*
 * resctrl_test:	resctrl test definition
 * @name:		Test name
 * @group:		Test group - a common name for tests that share some characteristic
 *			(e.g., L3 CAT test belongs to the CAT group). Can be NULL
 * @resource:		Resource to test (e.g., MB, L3, L2, etc.)
 * @vendor_specific:	Bitmask for vendor-specific tests (can be 0 for universal tests)
 * @disabled:		Test is disabled
 * @feature_check:	Callback to check required resctrl features
 * @run_test:		Callback to run the test
 * @cleanup:		Callback to cleanup after the test
 */
struct resctrl_test {
	const char	*name;
	const char	*group;
	const char	*resource;
	unsigned int	vendor_specific;
	bool		disabled;
	bool		(*feature_check)(const struct resctrl_test *test);
	int		(*run_test)(const struct resctrl_test *test,
				    const struct user_params *uparams);
	void		(*cleanup)(void);
};

/*
 * resctrl_val_param:	resctrl test parameters
 * @ctrlgrp:		Name of the control monitor group (con_mon grp)
 * @mongrp:		Name of the monitor group (mon grp)
 * @filename:		Name of file to which the o/p should be written
 * @init:		Callback function to initialize test environment
 * @setup:		Callback function to setup per test run environment
 * @measure:		Callback that performs the measurement (a single test)
 * @fill_buf:		Parameters for default "fill_buf" benchmark.
 *			Initialized with user provided parameters, possibly
 *			adapted to be relevant to the test. If user does
 *			not provide parameters for "fill_buf" nor a
 *			replacement benchmark then initialized with defaults
 *			appropriate for test. NULL if user provided
 *			benchmark.
 */
struct resctrl_val_param {
	const char		*ctrlgrp;
	const char		*mongrp;
	char			filename[64];
	unsigned long		mask;
	int			num_of_runs;
	int			(*init)(const struct resctrl_test *test,
					const struct user_params *uparams,
					const struct resctrl_val_param *param,
					int domain_id);
	int			(*setup)(const struct resctrl_test *test,
					 const struct user_params *uparams,
					 struct resctrl_val_param *param);
	int			(*measure)(const struct user_params *uparams,
					   struct resctrl_val_param *param,
					   pid_t bm_pid);
	struct fill_buf_param	*fill_buf;
};

/*
 * Memory location that consumes values compiler must not optimize away.
 * Volatile ensures writes to this location cannot be optimized away by
 * compiler.
 */
extern volatile int *value_sink;

extern int snc_unreliable;

extern char llc_occup_path[1024];

Annotation

Implementation Notes