PM / devfreq: export functions to allow freeing of pmu counters

Memlat and compute governors are made immutable to avoid governor
switch at run time as the devices using these governors are tightly
coupled with hardware features. These governors allocate pmu counters
to count various events used in the algorithm. These counters are
allocated exclusively for algorithm's use.

This leaves limited counters available for other uses in the system
such as profiling in user space using perf tool. Add and export a
function in devfreq memlat governor to remove immutable flag to allow
governor switch, which in turn can free pmu counters.

Similarly add and export a function in rimps_memlat driver to
free pmu counters.

The intended use of these functions is to be called by test modules
to allow freeing of pmu counters at runtime.

Change-Id: I243a3201368d5a82aeaf820e775cdc1aecdfea07
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
This commit is contained in:
Santosh Mardi 2020-11-23 20:53:29 +05:30 committed by Gerrit - the friendly Code Review server
parent 3e84ab94dd
commit 2055929c91
2 changed files with 25 additions and 0 deletions

View File

@ -451,6 +451,16 @@ static struct devfreq_governor devfreq_gov_compute = {
.event_handler = devfreq_memlat_ev_handler,
};
void memlat_set_immutable_flag(unsigned int flag)
{
unsigned int *memlat_ptr = (unsigned int *)&devfreq_gov_memlat.immutable;
unsigned int *compute_ptr = (unsigned int *)&devfreq_gov_compute.immutable;
*memlat_ptr = flag;
*compute_ptr = flag;
}
EXPORT_SYMBOL(memlat_set_immutable_flag);
#define NUM_COLS 2
static struct core_dev_map *init_core_dev_map(struct device *dev,
struct device_node *of_node,

View File

@ -807,6 +807,21 @@ static int memlat_event_cpu_hp_init(void)
return ret;
}
void rimps_force_free_pmu_events(unsigned int flag)
{
unsigned int cpu;
get_online_cpus();
for_each_possible_cpu(cpu) {
if (flag)
memlat_event_hotplug_going_down(cpu);
else
memlat_event_hotplug_coming_up(cpu);
}
put_online_cpus();
}
EXPORT_SYMBOL(rimps_force_free_pmu_events);
static int memlat_idle_notif(struct notifier_block *nb,
unsigned long action,
void *data)