[PATCH OLK-6.6 0/2] lib/clear_user: ensure loop in __arch_clear_user cache-aligned v2

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. Cheng Jian (1): lib/clear_user: ensure loop in __arch_clear_user cache-aligned v2 Yang Yingliang (1): config: enable CONFIG_CLEAR_USER_WORKAROUND by default arch/arm64/Kconfig | 7 +++++++ arch/arm64/configs/openeuler_defconfig | 1 + arch/arm64/lib/clear_user.S | 3 +++ 3 files changed, 11 insertions(+) -- 2.25.1

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 -- 2.25.1

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8T1T8 CVE: NA -------------------------------- Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- arch/arm64/configs/openeuler_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index b697d115588d..c2afc0e43302 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -521,6 +521,7 @@ CONFIG_RANDOMIZE_BASE=y CONFIG_RANDOMIZE_MODULE_REGION_FULL=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_STACKPROTECTOR_PER_TASK=y +CONFIG_CLEAR_USER_WORKAROUND=y # end of Kernel Features # -- 2.25.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3724 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3724 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/P...
participants (2)
-
patchwork bot
-
Yang Yingliang