Commit afe2133a authored by James Morse's avatar James Morse Committed by Wenkuan Wang
Browse files

x86/resctrl: Merge mon_capable and mon_enabled

mainline inclusion
from mainline-v6.1-rc1
commit bab6ee73
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9U2JC


CVE: NA

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

mon_enabled and mon_capable are always set as a pair by
rdt_get_mon_l3_config().

There is no point having two values.

Merge them together.

Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarJamie Iles <quic_jiles@quicinc.com>
Reviewed-by: default avatarShaopeng Tan <tan.shaopeng@fujitsu.com>
Reviewed-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Tested-by: default avatarXin Hao <xhao@linux.alibaba.com>
Tested-by: default avatarShaopeng Tan <tan.shaopeng@fujitsu.com>
Tested-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20220902154829.30399-3-james.morse@arm.com



Conflicts:
	include/linux/resctrl.h

Signed-off-by: default avatarWenkuan Wang <Wenkuan.Wang@amd.com>
parent 9d83068b
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -469,10 +469,6 @@ static inline struct rdt_resource *resctrl_inc(struct rdt_resource *res)
	for_each_rdt_resource(r)					      \
		if (r->alloc_enabled)

#define for_each_mon_enabled_rdt_resource(r)				      \
	for_each_rdt_resource(r)					      \
		if (r->mon_enabled)

/* CPUID.(EAX=10H, ECX=ResID=1).EAX */
union cpuid_0x10_1_eax {
	struct {
+0 −1
Original line number Diff line number Diff line
@@ -741,7 +741,6 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
	l3_mon_evt_init(r);

	r->mon_capable = true;
	r->mon_enabled = true;

	return 0;
}
+4 −4
Original line number Diff line number Diff line
@@ -2083,7 +2083,7 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
			goto out_destroy;
	}

	for_each_mon_enabled_rdt_resource(r) {
	for_each_mon_capable_rdt_resource(r) {
		fflags =  r->fflags | RF_MON_INFO;
		sprintf(name, "%s_MON", r->name);
		ret = rdtgroup_mkdir_info_resdir(r, name, fflags);
@@ -2740,7 +2740,7 @@ void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, unsigned int dom_id)
	struct rdtgroup *prgrp, *crgrp;
	char name[32];

	if (!r->mon_enabled)
	if (!r->mon_capable)
		return;

	list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
@@ -2808,7 +2808,7 @@ void mkdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
	struct rdtgroup *prgrp, *crgrp;
	struct list_head *head;

	if (!r->mon_enabled)
	if (!r->mon_capable)
		return;

	list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
@@ -2878,7 +2878,7 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
	 * Create the subdirectories for each domain. Note that all events
	 * in a domain like L3 are grouped into a resource whose domain is L3
	 */
	for_each_mon_enabled_rdt_resource(r) {
	for_each_mon_capable_rdt_resource(r) {
		ret = mkdir_mondata_subdir_alldom(kn, r, prgrp);
		if (ret)
			goto out_destroy;
+0 −2
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ struct rdt_parse_data;
 * struct rdt_resource - attributes of a resctrl resource
 * @rid:		The index of the resource
 * @alloc_enabled:	Is allocation enabled on this machine
 * @mon_enabled:	Is monitoring enabled for this feature
 * @alloc_capable:	Is allocation available on this machine
 * @mon_capable:	Is monitor feature available on this machine
 * @num_rmid:		Number of RMIDs available
@@ -133,7 +132,6 @@ struct rdt_parse_data;
struct rdt_resource {
	int			rid;
	bool			alloc_enabled;
	bool			mon_enabled;
	bool			alloc_capable;
	bool			mon_capable;
	int			num_rmid;