Unverified Commit e909f976 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3724 lib/clear_user: ensure loop in __arch_clear_user cache-aligned v2

Merge Pull Request from: @ci-robot 
 
PR sync from: Yang Yingliang <yangyingliang@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/PW4CR3L42VTHR64ESRT3J5E2QAUFOWY6/ 
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


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I8T1T8 
 
Link:https://gitee.com/openeuler/kernel/pulls/3724

 

Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 5adc926f 65db9842
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2303,6 +2303,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"
+1 −0
Original line number Diff line number Diff line
@@ -525,6 +525,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

#
+3 −0
Original line number Diff line number Diff line
@@ -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