Commit f658deb9 authored by James Morse's avatar James Morse Committed by Zeng Heng
Browse files

x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl

maillist inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/snapshot/v6.7-rc2



---------------------------

thread_throttle_mode_init() is called by the architecture specific code
to make the 'thread_throttle_mode' file visible. The architecture specific
code has already set the membw.throttle_mode in the rdt_resource.

The architecture specific call isn't necessary, and creates an extra
interface between the architecture and resctrl.

Call thread_throttle_mode_init() from resctrl_setup(), check the
membw.throttle_mode on the MBA resource. This avoids an extra API
call.

Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent a89eebcf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ static bool __get_mem_config_intel(struct rdt_resource *r)
		r->membw.throttle_mode = THREAD_THROTTLE_PER_THREAD;
	else
		r->membw.throttle_mode = THREAD_THROTTLE_MAX;
	thread_throttle_mode_init();

	r->alloc_capable = true;

+0 −1
Original line number Diff line number Diff line
@@ -501,7 +501,6 @@ void cqm_handle_limbo(struct work_struct *work);
bool has_busy_rmid(struct rdt_domain *d);
void __check_limbo(struct rdt_domain *d, bool force_free);
void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
void __init thread_throttle_mode_init(void);
void mbm_config_rftype_init(const char *config);
void rdt_staged_configs_clear(void);
bool closid_allocated(unsigned int closid);
+8 −1
Original line number Diff line number Diff line
@@ -2068,10 +2068,15 @@ static struct rftype *rdtgroup_get_rftype_by_name(const char *name)
	return NULL;
}

void __init thread_throttle_mode_init(void)
static void __init thread_throttle_mode_init(void)
{
	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_MBA);
	struct rftype *rft;

	if (!r->alloc_capable ||
	    r->membw.throttle_mode == THREAD_THROTTLE_UNDEFINED)
		return;

	rft = rdtgroup_get_rftype_by_name("thread_throttle_mode");
	if (!rft)
		return;
@@ -4195,6 +4200,8 @@ int __init resctrl_init(void)

	rdtgroup_setup_default();

	thread_throttle_mode_init();

	ret = resctrl_mon_resource_init();
	if (ret)
		return ret;