Skip to content
Snippets Groups Projects
Commit bb6a8bef authored by Yang Yingliang's avatar Yang Yingliang Committed by 谢秀奇
Browse files

arm64: arch_timer: Disable CNTVCT_EL0 trap if workaround is enabled


hulk inclusion
category: performance
bugzilla: 16082
CVE: NA

-------------------------------------------------

It costs very much time to read CNTVCT_EL0, if a cntvct workaround
and CNTVCT_EL0 trap is enabled. To decrease the read time, we disable
CNTVCT_EL0 trap and do the cntvct workaround in the VDSO by adding
vdso_fix.

Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarXuefeng Wang <wxf.wang@hisilicon.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 32c9eecb
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,7 @@ static bool arch_timer_c3stop;
static bool arch_timer_mem_use_virtual;
static bool arch_counter_suspend_stop;
static bool vdso_default = true;
DEFINE_STATIC_KEY_FALSE(vdso_fix);
static cpumask_t evtstrm_available = CPU_MASK_NONE;
static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
......@@ -550,8 +551,9 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
* change both the default value and the vdso itself.
*/
if (wa->read_cntvct_el0) {
clocksource_counter.archdata.vdso_direct = false;
vdso_default = false;
clocksource_counter.archdata.vdso_direct = true;
vdso_default = true;
static_branch_enable(&vdso_fix);
}
}
......@@ -855,7 +857,8 @@ static void arch_counter_set_user_access(void)
* need to be workaround. The vdso may have been already
* disabled though.
*/
if (arch_timer_this_cpu_has_cntvct_wa())
if (arch_timer_this_cpu_has_cntvct_wa() &&
!static_branch_unlikely(&vdso_fix))
pr_info("CPU%d: Trapping CNTVCT access\n", smp_processor_id());
else
cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment