acpm_dvfs: Remove sched_clock() calls
Calling the architected timer adds nontrivial overhead as observed in perf top, especially since the DVFS functions are hot paths. Remove all of the sched_clock() calls since they're unneeded by ACPM. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Signed-off-by: Nahuel Gómez <nahuelgomez329@gmail.com>
This commit is contained in:
parent
a5f833d5c7
commit
f5e2e1c94e
1 changed files with 5 additions and 29 deletions
|
@ -22,10 +22,8 @@ int exynos_acpm_set_rate(unsigned int id, unsigned long rate, bool fast_switch)
|
||||||
{
|
{
|
||||||
struct ipc_config config;
|
struct ipc_config config;
|
||||||
unsigned int cmd[4];
|
unsigned int cmd[4];
|
||||||
unsigned long long before, after, latency;
|
|
||||||
unsigned int ch;
|
unsigned int ch;
|
||||||
int ret;
|
int ret;
|
||||||
u32 start_time = acpm_get_peri_timer();
|
|
||||||
|
|
||||||
config.cmd = cmd;
|
config.cmd = cmd;
|
||||||
config.response = !fast_switch;
|
config.response = !fast_switch;
|
||||||
|
@ -33,21 +31,16 @@ int exynos_acpm_set_rate(unsigned int id, unsigned long rate, bool fast_switch)
|
||||||
config.cmd[0] = id;
|
config.cmd[0] = id;
|
||||||
config.cmd[1] = (unsigned int)rate;
|
config.cmd[1] = (unsigned int)rate;
|
||||||
config.cmd[2] = fast_switch ? FREQ_REQ_FAST : FREQ_REQ;
|
config.cmd[2] = fast_switch ? FREQ_REQ_FAST : FREQ_REQ;
|
||||||
config.cmd[3] = (start_time == 0xFFFF) ? 0 : start_time;
|
config.cmd[3] = 0;
|
||||||
|
|
||||||
ch = fast_switch ? acpm_dvfs.fast_ch_num : acpm_dvfs.ch_num;
|
ch = fast_switch ? acpm_dvfs.fast_ch_num : acpm_dvfs.ch_num;
|
||||||
|
|
||||||
#if defined(CONFIG_EXYNOS_DEBUG_FREQ)
|
#if defined(CONFIG_EXYNOS_DEBUG_FREQ)
|
||||||
secdbg_freq_check(id, rate);
|
secdbg_freq_check(id, rate);
|
||||||
#endif
|
#endif
|
||||||
before = sched_clock();
|
|
||||||
ret = acpm_ipc_send_data(ch, &config);
|
ret = acpm_ipc_send_data(ch, &config);
|
||||||
after = sched_clock();
|
|
||||||
latency = after - before;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s:[%d] latency = %llu ret = %d",
|
pr_err("%s:[%d] ret = %d", __func__, id, ret);
|
||||||
__func__, id, latency, ret);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(exynos_acpm_set_rate);
|
EXPORT_SYMBOL_GPL(exynos_acpm_set_rate);
|
||||||
|
@ -56,7 +49,6 @@ int exynos_acpm_set_init_freq(unsigned int dfs_id, unsigned long freq)
|
||||||
{
|
{
|
||||||
struct ipc_config config;
|
struct ipc_config config;
|
||||||
unsigned int cmd[4];
|
unsigned int cmd[4];
|
||||||
unsigned long long before, after, latency;
|
|
||||||
int ret, id;
|
int ret, id;
|
||||||
|
|
||||||
id = GET_IDX(dfs_id);
|
id = GET_IDX(dfs_id);
|
||||||
|
@ -69,14 +61,9 @@ int exynos_acpm_set_init_freq(unsigned int dfs_id, unsigned long freq)
|
||||||
config.cmd[2] = DATA_INIT;
|
config.cmd[2] = DATA_INIT;
|
||||||
config.cmd[3] = SET_INIT_FREQ;
|
config.cmd[3] = SET_INIT_FREQ;
|
||||||
|
|
||||||
before = sched_clock();
|
|
||||||
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
||||||
after = sched_clock();
|
|
||||||
latency = after - before;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s:[%d] latency = %llu ret = %d",
|
pr_err("%s:[%d] ret = %d", __func__, id, ret);
|
||||||
__func__, id, latency, ret);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(exynos_acpm_set_init_freq);
|
EXPORT_SYMBOL_GPL(exynos_acpm_set_init_freq);
|
||||||
|
@ -85,7 +72,6 @@ unsigned long exynos_acpm_get_rate(unsigned int id)
|
||||||
{
|
{
|
||||||
struct ipc_config config;
|
struct ipc_config config;
|
||||||
unsigned int cmd[4];
|
unsigned int cmd[4];
|
||||||
unsigned long long before, after, latency;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
config.cmd = cmd;
|
config.cmd = cmd;
|
||||||
|
@ -96,14 +82,9 @@ unsigned long exynos_acpm_get_rate(unsigned int id)
|
||||||
config.cmd[2] = FREQ_GET;
|
config.cmd[2] = FREQ_GET;
|
||||||
config.cmd[3] = 0;
|
config.cmd[3] = 0;
|
||||||
|
|
||||||
before = sched_clock();
|
|
||||||
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
||||||
after = sched_clock();
|
|
||||||
latency = after - before;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s:[%d] latency = %llu ret = %d", __func__,
|
pr_err("%s:[%d] ret = %d", __func__, id, ret);
|
||||||
id, latency, ret);
|
|
||||||
|
|
||||||
return config.cmd[1];
|
return config.cmd[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +92,6 @@ int exynos_acpm_set_volt_margin(unsigned int id, int volt)
|
||||||
{
|
{
|
||||||
struct ipc_config config;
|
struct ipc_config config;
|
||||||
unsigned int cmd[4];
|
unsigned int cmd[4];
|
||||||
unsigned long long before, after, latency;
|
|
||||||
int ret;
|
int ret;
|
||||||
struct vclk *vclk;
|
struct vclk *vclk;
|
||||||
|
|
||||||
|
@ -123,13 +103,9 @@ int exynos_acpm_set_volt_margin(unsigned int id, int volt)
|
||||||
config.cmd[2] = MARGIN_REQ;
|
config.cmd[2] = MARGIN_REQ;
|
||||||
config.cmd[3] = 0;
|
config.cmd[3] = 0;
|
||||||
|
|
||||||
before = sched_clock();
|
|
||||||
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
ret = acpm_ipc_send_data(acpm_dvfs.ch_num, &config);
|
||||||
after = sched_clock();
|
|
||||||
latency = after - before;
|
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s:[%d] latency = %llu ret = %d",
|
pr_err("%s:[%d] ret = %d", __func__, id, ret);
|
||||||
__func__, id, latency, ret);
|
|
||||||
|
|
||||||
vclk = cmucal_get_node(id);
|
vclk = cmucal_get_node(id);
|
||||||
if (vclk) {
|
if (vclk) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue