From 73ee91fc44dca7ecb53dcfca3ca54eebe499ac32 Mon Sep 17 00:00:00 2001 From: Santosh Mardi Date: Mon, 2 Nov 2020 12:27:35 +0530 Subject: [PATCH 1/2] drivers: soc: qcom: read current counter value before PMU save Call perf_event_read_local() to update current counter value in hw_perf_event structure before saving PMU snapshot to shared memory. Change-Id: Id5945cd6b6c9fab6f87917224b5b5f54dca5ef9c Signed-off-by: Santosh Mardi --- drivers/soc/qcom/rimps_memlat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/soc/qcom/rimps_memlat.c b/drivers/soc/qcom/rimps_memlat.c index 7e22b37fcfe3..8cc14f4df437 100644 --- a/drivers/soc/qcom/rimps_memlat.c +++ b/drivers/soc/qcom/rimps_memlat.c @@ -632,6 +632,8 @@ static void save_cpugrp_pmu_events(struct memlat_cpu_grp *cpu_grp, u8 cpu) !cpus_data->common_evs[i]) continue; + perf_event_read_local(cpus_data->common_evs[i], + &ev_count, NULL, NULL); ev_count = local64_read(&cpus_data->common_evs[i]->hw.prev_count); store_event_val(ev_count, hw_id, cpu); } @@ -651,6 +653,9 @@ static void save_mon_pmu_events(struct memlat_mon *mon, u8 cpu) if (hw_id == INVALID_PMU_HW_IDX || !ev_data->mon_evs[i]) continue; + + perf_event_read_local(ev_data->mon_evs[i], + &ev_count, NULL, NULL); ev_count = local64_read(&ev_data->mon_evs[i]->hw.prev_count); store_event_val(ev_count, hw_id, cpu); } From 25253a27055e51e249f0daad0d24bc8101cf441c Mon Sep 17 00:00:00 2001 From: Santosh Mardi Date: Mon, 2 Nov 2020 15:54:58 +0530 Subject: [PATCH 2/2] devfreq: delete l2wb feature pmu events during governor stop Delete l2wb and l3 access pmu events when the governor is stopped. Change-Id: If443cb6b53e2ad43ebee04a1fc3274a31b05e5b9 Signed-off-by: Santosh Mardi --- drivers/devfreq/arm-memlat-mon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/arm-memlat-mon.c b/drivers/devfreq/arm-memlat-mon.c index 6c1c4f177efa..4e15ae446816 100644 --- a/drivers/devfreq/arm-memlat-mon.c +++ b/drivers/devfreq/arm-memlat-mon.c @@ -657,8 +657,13 @@ static void stop_hwmon(struct memlat_hwmon *hw) unsigned int idx = cpu - cpumask_first(&mon->cpus); struct dev_stats *devstats = to_devstats(mon, cpu); - if (mon->miss_ev) + if (mon->miss_ev) { delete_event(&mon->miss_ev[idx]); + if (mon->wb_ev) + delete_event(&mon->wb_ev[idx]); + if (mon->access_ev) + delete_event(&mon->access_ev[idx]); + } devstats->inst_count = 0; devstats->mem_count = 0; devstats->freq = 0;