
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICUMVC -------------------------------- Within MPAM's shared-resource pool, different types frequently vary in quantity and specification. To present a uniform partition and monitoring interface, the driver traditionally constrains every resource set to the smallest common denominator, leaving much of the underlying hardware idle and wasted. To maximize utilization of a designated resource for single-type scenarios, allow enabling that resource exclusively. Therefore, we extend the boot parameter to initialize only specified resource type while ignoring all others. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/kernel/cpufeature.c | 10 ++++++++++ drivers/acpi/arm64/mpam.c | 5 +++++ fs/resctrl/monitor.c | 25 ++++++++++++++++++------- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 859236125cb1..c4d4ab854e81 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -880,6 +880,7 @@ static inline bool cpus_support_mpam(void) } bool mpam_detect_is_enabled(void); +bool mpam_only_enable_mb(void); static inline bool system_supports_haft(void) { diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 672accbd5b4a..f8c225c90439 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2363,9 +2363,19 @@ bool mpam_detect_is_enabled(void) return mpam_force_enabled; } +static bool __read_mostly mpam_mb_only; +bool mpam_only_enable_mb(void) +{ + return mpam_mb_only; +} + static int __init mpam_setup(char *str) { mpam_force_enabled = true; + + if (str && !strcmp(str, "mb_only")) + mpam_mb_only = true; + return 0; } early_param("arm64.mpam", mpam_setup); diff --git a/drivers/acpi/arm64/mpam.c b/drivers/acpi/arm64/mpam.c index de866e711be2..277e7d2bc58b 100644 --- a/drivers/acpi/arm64/mpam.c +++ b/drivers/acpi/arm64/mpam.c @@ -120,6 +120,11 @@ static int acpi_mpam_parse_resource(struct acpi_mpam_msc_node *tbl_msc, off_t offset; int level; + if (mpam_only_enable_mb()) { + if (res->locator_type != ACPI_MPAM_LOCATION_TYPE_MEMORY) + return 0; + } + /* * Class IDs are somewhat arbitrary, but need to be co-ordinated. * 0-N are caches, diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 66ebfaa26e28..d10497013638 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -790,9 +790,6 @@ static int dom_data_init(struct rdt_resource *r) static void dom_data_exit(struct rdt_resource *r) { - if (!r->mon_capable) - return; - mutex_lock(&rdtgroup_mutex); if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) { kfree(closid_num_dirty_rmid); @@ -807,10 +804,15 @@ static void dom_data_exit(struct rdt_resource *r) int resctrl_mon_resource_init(void) { - struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); - int ret; + struct rdt_resource *r; + int i, ret; - if (!r->mon_capable) + for (i = 0; i < RDT_NUM_RESOURCES; i++) { + r = resctrl_arch_get_resource(i); + if (r->mon_capable) + break; + } + if (i == RDT_NUM_RESOURCES) return 0; ret = dom_data_init(r); @@ -822,7 +824,16 @@ int resctrl_mon_resource_init(void) void resctrl_mon_resource_exit(void) { - struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); + struct rdt_resource *r; + int i; + + for (i = 0; i < RDT_NUM_RESOURCES; i++) { + r = resctrl_arch_get_resource(i); + if (r->mon_capable) + break; + } + if (i == RDT_NUM_RESOURCES) + return; dom_data_exit(r); } -- 2.25.1