From: Cheng Jian cj.chengjian@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8T1T8 CVE: NA
--------------------------------
We must ensure that the following four instructions are cache-aligned. Otherwise, it will cause problems with the performance of libMicro pread.
1: # uao_user_alternative 9f, str, sttr, xzr, x0, 8 str xzr, [x0], #8 nop subs x1, x1, #8 b.pl 1b
with this patch:
prc thr usecs/call samples errors cnt/samp size pread_z100 1 1 5.88400 807 0 1 102400
The result of pread can range from 5 to 9 depending on the alignment performance of this function.
Signed-off-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- arch/arm64/Kconfig | 7 +++++++ arch/arm64/lib/clear_user.S | 3 +++ 2 files changed, 10 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 42079bfdf40a..e559c0fa2bad 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2275,6 +2275,13 @@ config UNWIND_PATCH_PAC_INTO_SCS select UNWIND_TABLES select DYNAMIC_SCS
+config CLEAR_USER_WORKAROUND + bool "Enable clear user workaround" + depends on ARCH_HISI + default n + help + It has better performance while make sttr instruction 32-aligned in __arch_clear_user(). + endmenu # "Kernel Features"
menu "Boot options" diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S index a5a5f5b97b17..4ae880287167 100644 --- a/arch/arm64/lib/clear_user.S +++ b/arch/arm64/lib/clear_user.S @@ -24,6 +24,9 @@ SYM_FUNC_START(__arch_clear_user) add x2, x0, x1 subs x1, x1, #8 b.mi 2f +#ifdef CONFIG_CLEAR_USER_WORKAROUND + .align 5 +#endif 1: USER(9f, sttr xzr, [x0]) add x0, x0, #8