[PATCH OLK-6.6 0/2] fs/resctrl: Enqueue mon_event_count() forcefully for MPAM

Zeng Heng (2): fs/resctrl: Enqueue mon_event_count() forcefully for MPAM arm64/mpam: Ensure the err variable is initialized drivers/platform/mpam/mpam_devices.c | 8 ++++---- fs/resctrl/ctrlmondata.c | 2 +- include/linux/resctrl.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) -- 2.25.1

smp_call_function_any() doesn't allow nested calls, since it runs in interrupt context, and nesting would trigger a warning due to interrupt disabled. In mon_event_read(), when all CPUs of the target domain are in TICK-NOHZ mode, no house-keeping cpu can invoke smp_call_on_cpu(). When the IPI fallback is used on machines where MPAM needs to make an access on multiple CPUs, the counter read will always fail. Therefore, must use smp_call_on_cpu() to invoke mon_event_read() in a thread context to ensure the success of MPAM counter read. Fixes: 158e5bec7d72 ("x86/resctrl: Queue mon_event_read() instead of sending an IPI") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/ctrlmondata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 3f0380a2386a..bf87eed826ff 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -507,7 +507,7 @@ void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, * MPAM's resctrl_arch_rmid_read() is unable to read the * counters on some platforms if its called in irq context. */ - if (tick_nohz_full_cpu(cpu)) + if (tick_nohz_full_cpu(cpu) && !IS_ENABLED(CONFIG_ARM64_MPAM)) smp_call_function_any(&d->cpu_mask, mon_event_count, rr, 1); else smp_call_on_cpu(cpu, smp_mon_event_count, rr, false); -- 2.25.1

Ensure that err variables are initialized to 0 to avoid returning uninitialized values. Fixes: bb66b4d115e5 ("arm_mpam: Add mpam_msmon_read() to read monitor value") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 8 ++++---- include/linux/resctrl.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 95ce8eb79e2f..661fa7938358 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1061,7 +1061,7 @@ static void __ris_msmon_read(void *arg) static int _msmon_read(struct mpam_component *comp, struct mon_read *arg) { - int err, idx; + int err = 0, idx; bool read_again; u64 wait_jiffies; struct mpam_msc *msc; @@ -1610,7 +1610,8 @@ static int __setup_ppi(struct mpam_msc *msc) for_each_cpu(cpu, &msc->accessibility) { struct mpam_msc *empty = *per_cpu_ptr(msc->error_dev_id, cpu); if (empty != NULL) { - pr_err_once("%s shares PPI with %s!\n", dev_name(&msc->pdev->dev), + pr_err_once("%s shares PPI with %s!\n", + dev_name(&msc->pdev->dev), dev_name(&empty->pdev->dev)); return -EBUSY; } @@ -1630,7 +1631,6 @@ static int mpam_msc_setup_error_irq(struct mpam_msc *msc) /* Allocate and initialise the percpu device pointer for PPI */ if (irq_is_percpu(irq)) - return __setup_ppi(msc); /* sanity check: shared interrupts can be routed anywhere? */ @@ -1700,7 +1700,7 @@ static int mpam_dt_parse_resource(struct mpam_msc *msc, struct device_node *np, static int mpam_dt_parse_resources(struct mpam_msc *msc, void *ignored) { - int err, num_ris = 0; + int err = 0, num_ris = 0; const u32 *ris_idx_p; struct device_node *iter, *np; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index e2e63b3bd508..958b1f39d016 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -315,9 +315,9 @@ static inline u32 resctrl_get_config_index(u32 closid, case CDP_NONE: return closid; case CDP_CODE: - return (closid * 2) + 1; + return (closid * 2) + 1; case CDP_DATA: - return (closid * 2); + return (closid * 2); } } -- 2.25.1

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