From 8b7da8b02ced3ed99161250398593b202561bf05 Mon Sep 17 00:00:00 2001 From: Ze Zuo Date: Tue, 22 Jul 2025 11:20:29 +0800 Subject: [PATCH 1/2] mm_monitor/mm_spe: Fix SPE boost enablement and continuation handling hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICNW85 CVE: NA ---------------------------------------------------------------------- This patch addresses two issues related to the SPE (Statistical Profiling Extension) boost feature: 1. The SPE boost feature was being enabled on supporting hardware even when the 'enable_mm_spe_boost' command line parameter wasn't passed. This violates the explicit opt-in design and may cause unintended performance impacts. 2. During continuation scenarios, the SPE boost feature register wasn't being properly reset, which could lead to the feature remaining active when it shouldn't be. The fix ensures: - SPE boost is only enabled when explicitly requested via cmdline - The feature register is properly reset during continuation Fixes: b963a30f4ded ("arm-spe: Add kernel cmdline option to enable SPE boost") Signed-off-by: Ze Zuo --- drivers/arm/mm_monitor/mm_spe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/arm/mm_monitor/mm_spe.c b/drivers/arm/mm_monitor/mm_spe.c index 73fa4acdc998..ef6d16273f85 100644 --- a/drivers/arm/mm_monitor/mm_spe.c +++ b/drivers/arm/mm_monitor/mm_spe.c @@ -332,7 +332,7 @@ int mm_spe_start(void) isb(); write_sysreg_s(reg, SYS_PMSCR_EL1); - if (spe->support_boost_spe) { + if (spe->support_boost_spe && mm_spe_boost_enable) { reg = arm_spe_to_htpg(); isb(); write_sysreg_s(reg, SYS_OMHTPG_EL1); @@ -345,6 +345,12 @@ void mm_spe_continue(void) { int reg; + if (spe->support_boost_spe && mm_spe_boost_enable) { + reg = arm_spe_to_htpg(); + isb(); + write_sysreg_s(reg, SYS_OMHTPG_EL1); + } + mm_spe_buffer_init(); reg = mm_spe_to_pmscr(); @@ -445,7 +451,7 @@ static void mm_spe_sample_para_init(void) spe->min_latency = 120; - if (spe->support_boost_spe) + if (spe->support_boost_spe && mm_spe_boost_enable) arm_spe_boost_spe_para_init(); } -- Gitee From 209230d80a5d591aef87771955fdb9ed69a55f1b Mon Sep 17 00:00:00 2001 From: Ze Zuo Date: Tue, 22 Jul 2025 11:20:30 +0800 Subject: [PATCH 2/2] mm_monitor/mm_spe: Embed boost events within SPE packets hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICNW85 CVE: NA ---------------------------------------------------------------------- This patch embeds boost events within SPE packets to: 1.Avoid disrupting standard SPE packet streams 2.Ensure backward compatibility with existing SPE analyzers The embedding is achieved by using reserved bits in the SPE headers, following the architecture specification. Fixes: 9081b8b4bfef ("arm-spe: Boost SPE add TLB hot page and remote access tracking") Signed-off-by: Ze Zuo --- drivers/arm/mm_monitor/mm_spe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/arm/mm_monitor/mm_spe.c b/drivers/arm/mm_monitor/mm_spe.c index ef6d16273f85..c742388850d4 100644 --- a/drivers/arm/mm_monitor/mm_spe.c +++ b/drivers/arm/mm_monitor/mm_spe.c @@ -414,7 +414,7 @@ static void arm_spe_boost_spe_para_init(void) { struct boost_spe_contol *boost_spe = &spe->boost_spe; - boost_spe->record_sel = 1; + boost_spe->record_sel = 0; boost_spe->pop_uop_sel = 0; boost_spe->rmt_acc_pa_flt_en = 0; boost_spe->rmt_acc_en = 1; -- Gitee