I've left this to ~rot~ age out in the sun for a while, apologies for that.
One early new-year resolution for me is to maintain a shorter resend
timeout on this.
This is the continuation of [1] where I'm hunting down
preempt_schedule_irq() callers because of [2]. I've looked at users of
preempt_schedule_irq(), and made sure they didn't have one of those useless
loops. The list of offenders is:
$ grep -r -I "preempt_schedule_irq" arch/ | cut -d/ -f2 | sort | uniq
arc
arm
arm64
c6x
csky
h8300
ia64
m68k
microblaze
mips
nds32
nios2
parisc
powerpc
riscv
s390
sh
sparc
x86
xtensa
Regarding that loop, archs seem to fall in 3 categories:
A) Those that don't have the loop
B) Those that have a small need_resched() loop around the
preempt_schedule_irq() callsite
C) Those that branch to some more generic code further up the entry code
and eventually branch back to preempt_schedule_irq()
arc, m68k, nios2 fall in A)
sparc, ia64, s390 fall in C)
all the others fall in B)
I've written patches for B). As of 5.3 mainline contains those for:
- arm64
- mips
- x86
- powerpc
- nds32
I've also got acks/reviews but haven't seen in any tree yet for:
- c6x
- csky
- riscv
- xtensa
The remaining ones for which I haven't had any reply at all are
- h8300
- microblaze
- sh
- sh64
Build-tested:
- h8300
- c6x
- microblaze
- riscv
No major change since v1 other than rebasing on top of 5.4 and collecting
Reviewed-By / Acked-By.
Thanks,
Valentin
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/
Valentin Schneider (9):
sched/core: Fix preempt_schedule() interrupt return comment
c6x: entry: Remove unneeded need_resched() loop
csky: entry: Remove unneeded need_resched() loop
h8300: entry: Remove unneeded need_resched() loop
microblaze: entry: Remove unneeded need_resched() loop
RISC-V: entry: Remove unneeded need_resched() loop
sh: entry: Remove unneeded need_resched() loop
sh64: entry: Remove unneeded need_resched() loop
xtensa: entry: Remove unneeded need_resched() loop
arch/c6x/kernel/entry.S | 3 +--
arch/csky/kernel/entry.S | 4 ----
arch/h8300/kernel/entry.S | 3 +--
arch/microblaze/kernel/entry.S | 5 -----
arch/riscv/kernel/entry.S | 3 +--
arch/sh/kernel/cpu/sh5/entry.S | 5 +----
arch/sh/kernel/entry-common.S | 4 +---
arch/xtensa/kernel/entry.S | 2 +-
kernel/sched/core.c | 7 +++----
9 files changed, 9 insertions(+), 27 deletions(-)
--
2.22.0
Since the enabling and disabling of IRQs within preempt_schedule_irq()
is contained in a need_resched() loop, we don't need the outer arch
code loop.
Acked-by: Mark Salter <[email protected]>
Signed-off-by: Valentin Schneider <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: [email protected]
---
arch/c6x/kernel/entry.S | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S
index 4332a10aec6c..3cb71b31c4cd 100644
--- a/arch/c6x/kernel/entry.S
+++ b/arch/c6x/kernel/entry.S
@@ -564,7 +564,6 @@ resume_kernel:
NOP 4
[A1] BNOP .S2 restore_all,5
-preempt_schedule:
GET_THREAD_INFO A2
LDW .D1T1 *+A2(THREAD_INFO_FLAGS),A1
#ifdef CONFIG_C6X_BIG_KERNEL
@@ -581,7 +580,7 @@ preempt_schedule:
#else
B .S2 preempt_schedule_irq
#endif
- ADDKPC .S2 preempt_schedule,B3,4
+ ADDKPC .S2 restore_all,B3,4
#endif /* CONFIG_PREEMPT */
ENTRY(enable_exception)
--
2.22.0
Since the enabling and disabling of IRQs within preempt_schedule_irq()
is contained in a need_resched() loop, we don't need the outer arch
code loop.
Signed-off-by: Valentin Schneider <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: [email protected]
---
arch/sh/kernel/entry-common.S | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index d31f66e82ce5..65a105de52a0 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -93,7 +93,7 @@ ENTRY(resume_kernel)
mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count
tst r0, r0
bf noresched
-need_resched:
+
mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags
tst #_TIF_NEED_RESCHED, r0 ! need_resched set?
bt noresched
@@ -107,8 +107,6 @@ need_resched:
mov.l 1f, r0
jsr @r0 ! call preempt_schedule_irq
nop
- bra need_resched
- nop
noresched:
bra __restore_all
--
2.22.0
Since the enabling and disabling of IRQs within preempt_schedule_irq()
is contained in a need_resched() loop, we don't need the outer arch
code loop.
Acked-by: Max Filippov <[email protected]>
Signed-off-by: Valentin Schneider <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: [email protected]
---
arch/xtensa/kernel/entry.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 9e3676879168..2ca209e71565 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -529,7 +529,7 @@ common_exception_return:
l32i a4, a2, TI_PRE_COUNT
bnez a4, 4f
call4 preempt_schedule_irq
- j 1b
+ j 4f
#endif
#if XTENSA_FAKE_NMI
--
2.22.0
Since the enabling and disabling of IRQs within preempt_schedule_irq()
is contained in a need_resched() loop, we don't need the outer arch
code loop.
Signed-off-by: Valentin Schneider <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
---
arch/h8300/kernel/entry.S | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
index 4ade5f8299ba..6bde028e7d4a 100644
--- a/arch/h8300/kernel/entry.S
+++ b/arch/h8300/kernel/entry.S
@@ -323,7 +323,6 @@ restore_all:
resume_kernel:
mov.l @(TI_PRE_COUNT:16,er4),er0
bne restore_all:8
-need_resched:
mov.l @(TI_FLAGS:16,er4),er0
btst #TIF_NEED_RESCHED,r0l
beq restore_all:8
@@ -332,7 +331,7 @@ need_resched:
mov.l sp,er0
jsr @set_esp0
jsr @preempt_schedule_irq
- bra need_resched:8
+ bra restore_all:8
#endif
ret_from_fork:
--
2.22.0
On Mon, Sep 23, 2019 at 7:36 AM Valentin Schneider
<[email protected]> wrote:
>
> Since the enabling and disabling of IRQs within preempt_schedule_irq()
> is contained in a need_resched() loop, we don't need the outer arch
> code loop.
>
> Acked-by: Max Filippov <[email protected]>
> Signed-off-by: Valentin Schneider <[email protected]>
> Cc: Chris Zankel <[email protected]>
> Cc: [email protected]
> ---
> arch/xtensa/kernel/entry.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I've applied this patch to the xtensa tree as it doesn't seem to be taken
anywhere else.
--
Thanks.
-- Max