[PATCH OLK-5.10 0/3] arm64/mpam: Extending MPAM features and bugfix
Extending the MPAM features and bugfix in OLK-5.10. Quanmin Yan (3): arm64/mpam: Add quirk to shrink MATA PMG range arm64/mpam: Add quirk for MPAM MSMON_MBWU monitor NRDY bit arm64/mpam: Allow MBMIN to be set to 0 arch/arm64/kernel/mpam/mpam_device.c | 33 +++++++++++++++++++++++---- arch/arm64/kernel/mpam/mpam_resctrl.c | 7 +++--- 2 files changed, 33 insertions(+), 7 deletions(-) -- 2.43.0
hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8421 -------------------------------- On certain specific chip platforms, the PMG function is not fully supported. Using a non-zero PMG as a monitoring resource can lead to the loss of write traffic statistics. Therefore, impose restrictions on the PMG usage range for such chips. Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- arch/arm64/kernel/mpam/mpam_device.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index 7de8e2cd8bd9..cc87e25769b1 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -54,6 +54,11 @@ static LIST_HEAD(mpam_all_devices); /* Classes are the set of MSCs that make up components of the same type. */ LIST_HEAD(mpam_classes); +static const struct midr_range hip12_cpus[] = { + MIDR_ALL_VERSIONS(MIDR_HISI_HIP12), + { /* sentinel */ } +}; + static DEFINE_MUTEX(mpam_cpuhp_lock); static int mpam_cpuhp_state; @@ -125,6 +130,14 @@ mpam_probe_update_sysprops(u16 max_partid, u16 max_pmg) mpam_sysprops.max_pmg : max_pmg; } +static int mpam_pmg_max_workaround(u32 hwfeatures) +{ + if (is_midr_in_range_list(read_cpuid_id(), hip12_cpus)) + return 0; + + return (hwfeatures & MPAMF_IDR_PMG_MAX_MASK) >> MPAMF_IDR_PMG_MAX_SHIFT; +} + static int mpam_device_probe(struct mpam_device *dev) { u64 idr; @@ -141,7 +154,7 @@ static int mpam_device_probe(struct mpam_device *dev) hwfeatures = mpam_read_reg(dev, MPAMF_IDR); max_partid = hwfeatures & MPAMF_IDR_PARTID_MAX_MASK; - max_pmg = (hwfeatures & MPAMF_IDR_PMG_MAX_MASK) >> MPAMF_IDR_PMG_MAX_SHIFT; + max_pmg = mpam_pmg_max_workaround(hwfeatures); dev->num_partid = max_partid + 1; dev->num_pmg = max_pmg + 1; -- 2.43.0
hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8421 -------------------------------- Fix the issue where the MSMON_MBWU monitor does not properly update statistics results on certain platforms due to the absence of NRDY bit functionality. On such platforms, when configuring a new partid, the NRDY bit remains 0, causing the monitor to remain 0 or the previous statistics result. For the specified chip vendors, assume the NRDY bit is set on the time configuration update and force the software to re-read the statistics result to ensure accurate data. Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- arch/arm64/kernel/mpam/mpam_device.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index cc87e25769b1..4ed99caa8052 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -1238,8 +1238,16 @@ static u32 mpam_device_read_csu_mon(struct mpam_device *dev, return mpam_read_reg(dev, MSMON_CSU); } +static bool mpam_dev_has_nrdy_bit(struct mpam_device *dev) +{ + if (mpam_has_feature(mpam_feat_msmon_mbwu, dev->features)) + return read_cpuid_implementor() != ARM_CPU_IMP_HISI; + + return true; +} + static u32 mpam_device_read_mbwu_mon(struct mpam_device *dev, - struct sync_args *args) + struct sync_args *args, bool *config_mismatch) { u16 mon; u32 clt, flt, cur_clt, cur_flt; @@ -1282,6 +1290,8 @@ static u32 mpam_device_read_mbwu_mon(struct mpam_device *dev, clt |= MSMON_CFG_CTL_EN; mpam_write_reg(dev, MSMON_CFG_MBWU_CTL, clt); wmb(); + + *config_mismatch = true; } return mpam_read_reg(dev, MSMON_MBWU); @@ -1292,6 +1302,7 @@ static int mpam_device_frob_mon(struct mpam_device *dev, { struct sync_args *args = ctx->args; u32 val; + bool config_mismatch = false; lockdep_assert_held(&dev->lock); @@ -1306,11 +1317,12 @@ static int mpam_device_frob_mon(struct mpam_device *dev, val = mpam_device_read_csu_mon(dev, args); else if (args->eventid == QOS_L3_MBM_LOCAL_EVENT_ID && mpam_has_feature(mpam_feat_msmon_mbwu, dev->features)) - val = mpam_device_read_mbwu_mon(dev, args); + val = mpam_device_read_mbwu_mon(dev, args, &config_mismatch); else return -EOPNOTSUPP; - if (val & MSMON___NRDY) + if (val & MSMON___NRDY || + (config_mismatch && !mpam_dev_has_nrdy_bit(dev))) return -EBUSY; val = val & MSMON___VALUE; -- 2.43.0
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8421 ------------------------------------------ Currently, the value of schemata's MBMIN cannot be set to 0, which prevents users from disabling the mbMin feature:
echo MB:0=0 > resctrl/schemata -bash: echo: write error: Invalid argument
Fix it by differentiating min_bw in parse_bw. Fixes: d329f67f844b ("arm64/mpam: update last_cmd_status in parse_cache() and parse_bw()") Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- arch/arm64/kernel/mpam/mpam_resctrl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index b3cc8c709787..b6f9cdb410ef 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -337,7 +337,7 @@ parse_bw(char *buf, struct resctrl_resource *r, struct resctrl_staged_config *cfg, enum resctrl_ctrl_type type) { - unsigned long data; + unsigned long data, min_bw = 0; struct raw_resctrl_resource *rr = r->res; if (cfg->have_new_ctrl) { @@ -353,10 +353,11 @@ parse_bw(char *buf, struct resctrl_resource *r, switch (rr->ctrl_features[type].evt) { case QOS_MBA_MAX_EVENT_ID: case QOS_MBA_PBM_EVENT_ID: + min_bw = r->mbw.min_bw; case QOS_MBA_MIN_EVENT_ID: - if (data < r->mbw.min_bw || data >= rr->ctrl_features[type].max_wd) { + if (data < min_bw || data >= rr->ctrl_features[type].max_wd) { rdt_last_cmd_printf("MB value %ld out of range [%d,%d]\n", data, - r->mbw.min_bw, rr->ctrl_features[type].max_wd - 1); + (int)min_bw, rr->ctrl_features[type].max_wd - 1); return -EINVAL; } data = roundup(data, r->mbw.bw_gran); -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/21250 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/N6S... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/21250 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/N6S...
participants (2)
-
patchwork bot -
Quanmin Yan