From 8d5b07501328f4099232285c0cb2de1829ee1888 Mon Sep 17 00:00:00 2001 From: Zeng Heng Date: Tue, 29 Jul 2025 14:23:52 +0800 Subject: [PATCH 1/2] fs/resctrl: Enqueue mon_event_count() forcefully for MPAM hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICPI9I -------------------------------- 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 --- 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); -- Gitee From d6150a87d1d9097833b3307a74718f19b95ed673 Mon Sep 17 00:00:00 2001 From: Zeng Heng Date: Tue, 29 Jul 2025 14:23:53 +0800 Subject: [PATCH 2/2] arm64/mpam: Ensure the err variable is initialized hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAJUN4 -------------------------------- 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 --- 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 21ca76695d3e..19e2153652eb 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1057,7 +1057,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; @@ -1606,7 +1606,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; } @@ -1626,7 +1627,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? */ @@ -1696,7 +1696,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); } } -- Gitee