From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: 34278 CVE: NA
-------------------------------------------------
To make MPAM feature perfectly compatiable with resctrl sysfs provided by Intel-RDT, we are ready to carry out a large-scale refactoring.
We move mpam.c, mpam_ctrlmon.c and mpam_mon.c to the mpam/ subdirectory under arch/arm64/kernel directory, and rename mpam.c to mpam_resctrl.c, of which function is expected to fully take up the internal resctrl jobs including many new supports such as cdp(Code Data Prioritization) and new interaction style.
Original operations on resctrl sysfs toward resctrl resource will be remapped to operations with new structures.
Before we formally declare that we have accomplished entire refactoring jobs, MPAM driver under our implementation is incomplete.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/mpam/Makefile | 3 ++ arch/arm64/kernel/{ => mpam}/mpam_ctrlmon.c | 6 +--- arch/arm64/kernel/{ => mpam}/mpam_mon.c | 0 .../kernel/{mpam.c => mpam/mpam_resctrl.c} | 31 +++---------------- 5 files changed, 9 insertions(+), 33 deletions(-) create mode 100644 arch/arm64/kernel/mpam/Makefile rename arch/arm64/kernel/{ => mpam}/mpam_ctrlmon.c (98%) rename arch/arm64/kernel/{ => mpam}/mpam_mon.c (100%) rename arch/arm64/kernel/{mpam.c => mpam/mpam_resctrl.c} (97%)
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index d6a907297aac..ec0cf9543e21 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -63,7 +63,7 @@ arm64-obj-$(CONFIG_CRASH_CORE) += crash_core.o arm64-obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o arm64-obj-$(CONFIG_ARM64_SSBD) += ssbd.o arm64-obj-$(CONFIG_SDEI_WATCHDOG) += watchdog_sdei.o -arm64-obj-$(CONFIG_MPAM) += mpam.o mpam_ctrlmon.o mpam_mon.o +arm64-obj-$(CONFIG_MPAM) += mpam/
obj-y += $(arm64-obj-y) vdso/ probes/ obj-$(CONFIG_ARM64_ILP32) += vdso-ilp32/ diff --git a/arch/arm64/kernel/mpam/Makefile b/arch/arm64/kernel/mpam/Makefile new file mode 100644 index 000000000000..3492ff0a9d0f --- /dev/null +++ b/arch/arm64/kernel/mpam/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_MPAM) += mpam_resctrl.o mpam_mon.o \ + mpam_ctrlmon.o diff --git a/arch/arm64/kernel/mpam_ctrlmon.c b/arch/arm64/kernel/mpam/mpam_ctrlmon.c similarity index 98% rename from arch/arm64/kernel/mpam_ctrlmon.c rename to arch/arm64/kernel/mpam/mpam_ctrlmon.c index b62ab076bf30..22e701195b28 100644 --- a/arch/arm64/kernel/mpam_ctrlmon.c +++ b/arch/arm64/kernel/mpam/mpam_ctrlmon.c @@ -175,9 +175,6 @@ static int parse_line(char *line, struct resctrl_resource *r) goto next; } } - - rdt_last_cmd_printf("unknown domain (%lu)\n", dom_id); - return -EINVAL; }
@@ -231,7 +228,6 @@ ssize_t resctrl_group_schemata_write(struct kernfs_open_file *of, rdtgrp = resctrl_group_kn_lock_live(of->kn); if (!rdtgrp) { resctrl_group_kn_unlock(of->kn); - rdt_last_cmd_puts("directory was removed\n"); return -ENOENT; } rdt_last_cmd_clear(); @@ -440,7 +436,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, return ret; }
- /* [FIXME] Could we remove the MATCH_* param ? */ + /* Could we remove the MATCH_* param ? */ rr->mon_write(d, prgrp, true);
return ret; diff --git a/arch/arm64/kernel/mpam_mon.c b/arch/arm64/kernel/mpam/mpam_mon.c similarity index 100% rename from arch/arm64/kernel/mpam_mon.c rename to arch/arm64/kernel/mpam/mpam_mon.c diff --git a/arch/arm64/kernel/mpam.c b/arch/arm64/kernel/mpam/mpam_resctrl.c similarity index 97% rename from arch/arm64/kernel/mpam.c rename to arch/arm64/kernel/mpam/mpam_resctrl.c index 30900c08f0ef..38e5a551c9d5 100644 --- a/arch/arm64/kernel/mpam.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -91,9 +91,6 @@ static inline void mpam_node_assign_val(struct mpam_node *n, n->addr = hwpage_address; n->component_id = component_id; n->cpus_list = "0"; - - if (n->type == MPAM_RESOURCE_MC) - n->default_ctrl = MBA_MAX_WD; }
#define MPAM_NODE_NAME_SIZE (10) @@ -313,7 +310,7 @@ struct raw_resctrl_resource raw_resctrl_resources_all[] = { [MPAM_RESOURCE_MC] = { .msr_update = bw_wrmsr, .msr_read = bw_rdmsr, - .parse_ctrlval = parse_bw, /* [FIXME] add parse_bw() helper */ + .parse_ctrlval = parse_bw, /* add parse_bw() helper */ .format_str = "%d=%0*d", .mon_read = mbwu_read, .mon_write = mbwu_write, @@ -373,7 +370,6 @@ u64 bw_rdmsr(struct rdt_domain *d, int partid) }
/* - * [FIXME] * use pmg as monitor id * just use match_pardid only. */ @@ -510,7 +506,7 @@ static int mpam_online_cpu(unsigned int cpu) return 0; }
-/* [FIXME] remove related resource when cpu offline */ +/* remove related resource when cpu offline */ static int mpam_offline_cpu(unsigned int cpu) { return 0; @@ -552,20 +548,6 @@ void post_resctrl_mount(void)
static int reset_all_ctrls(struct resctrl_resource *r) { - struct raw_resctrl_resource *rr; - struct rdt_domain *d; - int partid; - - rr = (struct raw_resctrl_resource *)r->res; - for (partid = 0; partid < rr->num_partid; partid++) { - list_for_each_entry(d, &r->domains, list) { - d->new_ctrl = rr->default_ctrl; - d->ctrl_val[partid] = rr->default_ctrl; - d->have_new_ctrl = true; - rr->msr_update(d, partid); - } - } - return 0; }
@@ -863,7 +845,7 @@ static int resctrl_num_mon_show(struct kernfs_open_file *of, int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, cpumask_var_t tmpmask) { - rdt_last_cmd_puts("temporarily unsupported write cpus on mon_groups\n"); + pr_info("unsupported on mon_groups, please use ctrlmon groups\n"); return -EINVAL; }
@@ -1148,12 +1130,11 @@ static ssize_t resctrl_group_ctrlmon_write(struct kernfs_open_file *of,
if (!rdtgrp) { ret = -ENOENT; - rdt_last_cmd_puts("directory was removed\n"); goto unlock; }
if ((rdtgrp->flags & RDT_CTRLMON) && !ctrlmon) { - /* [FIXME] disable & remove mon_data dir */ + /* disable & remove mon_data dir */ rdtgrp->flags &= ~RDT_CTRLMON; resctrl_ctrlmon_disable(rdtgrp->mon.mon_data_kn, rdtgrp); } else if (!(rdtgrp->flags & RDT_CTRLMON) && ctrlmon) { @@ -1162,10 +1143,6 @@ static ssize_t resctrl_group_ctrlmon_write(struct kernfs_open_file *of, if (!ret) rdtgrp->flags |= RDT_CTRLMON; } else { - if (ctrlmon) - rdt_last_cmd_printf("ctrlmon has been enabled\n"); - else - rdt_last_cmd_printf("ctrlmon has been disabled\n"); ret = -ENOENT; }