From d5bee15004a0ee6e06e32b679982d27110f966aa Mon Sep 17 00:00:00 2001 From: Gu Zitao Date: Fri, 27 Sep 2024 10:09:15 +0800 Subject: [PATCH 1/2] anolis: sw64: ensure sw64 handle PF_IO_WORKER in copy_thread() ANBZ: #4688 In the arch addition of PF_IO_WORKER, it missed sw64 for some reason. Fix that up, ensuring sw64 handle PF_IO_WORKER like it do PF_KTHREAD in copy_thread(). Fixes: 4727dc20e042 ("arch: setup PF_IO_WORKER threads like PF_KTHREAD") Signed-off-by: Gu Zitao Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sw_64/kernel/process.c b/arch/sw_64/kernel/process.c index a678ef1da19a..60b899c4ace6 100644 --- a/arch/sw_64/kernel/process.c +++ b/arch/sw_64/kernel/process.c @@ -79,7 +79,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, p->thread.sp = (unsigned long) childregs - STACKFRAME_SIZE; - if (unlikely(p->flags & PF_KTHREAD)) { + if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); p->thread.ra = (unsigned long) ret_from_kernel_thread; -- Gitee From 2fa8776cf37bc46fac3b7a1d67011e77b0ed62ae Mon Sep 17 00:00:00 2001 From: Gu Zitao Date: Fri, 27 Sep 2024 10:10:27 +0800 Subject: [PATCH 2/2] anolis: sw64: fix function ret_to_user() ANBZ: #4688 The 'and' instruction only support 8-bit immediate value, which is not suitable for us to calculate _TIF_WORK_MASK, because _TIF_WORK_MASK is not only 8-bit. So, fix it. Signed-off-by: Gu Zitao Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/kernel/entry_c3.S | 3 ++- arch/sw_64/kernel/entry_c4.S | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/sw_64/kernel/entry_c3.S b/arch/sw_64/kernel/entry_c3.S index df8bff5d09b3..faa7f953efa8 100644 --- a/arch/sw_64/kernel/entry_c3.S +++ b/arch/sw_64/kernel/entry_c3.S @@ -236,7 +236,8 @@ ret_from_sys_call: beq $0, restore_all ret_to_user: ldw $17, TI_FLAGS($8) - and $17, _TIF_WORK_MASK, $2 + ldi $2, _TIF_WORK_MASK + and $17, $2, $2 beq $2, restore_all ldi $16, STACKFRAME_SIZE($sp) call $26, do_notify_resume diff --git a/arch/sw_64/kernel/entry_c4.S b/arch/sw_64/kernel/entry_c4.S index 219016ef05b2..16f72e3e7bf5 100644 --- a/arch/sw_64/kernel/entry_c4.S +++ b/arch/sw_64/kernel/entry_c4.S @@ -414,7 +414,8 @@ ret_from_sys_call: beq $0, restore_all ret_to_user: ldw $17, TI_FLAGS($8) - and $17, _TIF_WORK_MASK, $2 + ldi $2, _TIF_WORK_MASK + and $17, $2, $2 beq $2, restore_all ldi $16, STACKFRAME_SIZE($sp) call $26, do_notify_resume -- Gitee