[PATCH OLK-6.6 0/2] arm64/mpam: Fix MBWU monitor overflow handling

Zeng Heng (2): arm64/mpam: Fix MBWU monitor overflow handling arm64/mpam: Print MPAM register operation for debug drivers/platform/mpam/mpam_devices.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 2.25.1

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID29QH -------------------------------- Bandwidth counters need to run continuously to correctly reflect the bandwidth. When reading the previously configured MSMON_CFG_MBWU_CTL, software must recognize that the MSMON_CFG_x_CTL_OFLOW_STATUS bit may have been set by hardware because of the counter overflow. The existing logic incorrectly treats this bit as an indication that the monitor configuration has been changed and consequently zeros the MBWU statistics by mistake. Also fix the handling of overflow amount calculation. Fixes: 21ac9fc8f275 ("arm_mpam: Track bandwidth counter state for overflow and power management") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index c6279b91b3d7..556cdde88d13 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1016,7 +1016,7 @@ static void __ris_msmon_read(void *arg) read_msmon_ctl_flt_vals(m, &cur_ctl, &cur_flt); gen_msmon_ctl_flt_vals(m, &ctl_val, &flt_val); config_mismatch = cur_flt != flt_val || - cur_ctl != (ctl_val | MSMON_CFG_x_CTL_EN); + (cur_ctl & ~MSMON_CFG_x_CTL_OFLOW_STATUS) != (ctl_val | MSMON_CFG_x_CTL_EN); if (config_mismatch || reset_on_next_read) write_msmon_ctl_flt_vals(m, ctl_val, flt_val); @@ -1074,8 +1074,8 @@ static void __ris_msmon_read(void *arg) } /* Add any pre-overflow value to the mbwu_state->val */ - if (mbwu_state->prev_val > now) - overflow_val = mpam_msmon_overflow_val(ris) - mbwu_state->prev_val; + if (mbwu_state->prev_val > now && (cur_ctl & MSMON_CFG_x_CTL_OFLOW_STATUS)) + overflow_val = mpam_msmon_overflow_val(ris); mbwu_state->prev_val = now; mbwu_state->correction += overflow_val; -- 2.25.1

hulk inclusion category: cleanup bugzilla: https://gitee.com/openeuler/kernel/issues/ID29QH -------------------------------- To facilitate scoping the problem and making diagnostics easier, MPAM provides print logs for register operations. Enable this feature with the following command: echo 'file mpam_devices.c +p' > /sys/kernel/debug/dynamic_debug/control echo 8 > /proc/sys/kernel/printk Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 556cdde88d13..eca84342a5fe 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -114,12 +114,16 @@ static void __mpam_write_reg(struct mpam_msc *msc, u16 reg, u32 val) lockdep_assert_held_once(&msc->part_sel_lock); \ ____ret = __mpam_read_reg(msc, MPAMF_##reg); \ \ + pr_debug("par r: msc %d reg 0x%x val 0x%x\n", \ + msc->id, MPAMF_##reg, ____ret); \ ____ret; \ }) #define mpam_write_partsel_reg(msc, reg, val) \ ({ \ lockdep_assert_held_once(&msc->part_sel_lock); \ + pr_debug("par w: msc %d reg 0x%x val 0x%lx\n", \ + msc->id, MPAMCFG_##reg, (unsigned long)val); \ __mpam_write_reg(msc, MPAMCFG_##reg, val); \ }) @@ -130,12 +134,16 @@ static void __mpam_write_reg(struct mpam_msc *msc, u16 reg, u32 val) lockdep_assert_held_once(&msc->mon_sel_lock); \ ____ret = __mpam_read_reg(msc, MSMON_##reg); \ \ + pr_debug("mon r: msc %d reg 0x%x val 0x%x\n", \ + msc->id, MSMON_##reg, ____ret); \ ____ret; \ }) #define mpam_write_monsel_reg(msc, reg, val) \ ({ \ lockdep_assert_held_once(&msc->mon_sel_lock); \ + pr_debug("mon w: msc %d reg 0x%x val 0x%lx\n", \ + msc->id, MSMON_##reg, (unsigned long)val); \ __mpam_write_reg(msc, MSMON_##reg, val); \ }) @@ -471,6 +479,9 @@ static int mpam_ris_get_affinity(struct mpam_msc *msc, cpumask_t *affinity, cpumask_and(affinity, affinity, &msc->accessibility); + pr_debug("comp_id %d msc->id %d affinity %*pb\n", + comp->comp_id, msc->id, cpumask_pr_args(affinity)); + return 0; } -- 2.25.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/18459 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/XXG... 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://gitee.com/openeuler/kernel/pulls/18459 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/XXG...
participants (2)
-
patchwork bot
-
Zeng Heng