linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub
@ 2019-09-23 14:36 Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment Valentin Schneider
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, linux-xtensa,
	linux-sh, linux-riscv, uclinux-h8-devel, linux-c6x-dev

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/20190131182339.9835-1-valentin.schneider@arm.com/
[2]: https://lore.kernel.org/lkml/cc989920-a13b-d53b-db83-1584a7f53edc@arm.com/

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-27  8:10   ` [tip: sched/urgent] " tip-bot2 for Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 2/9] c6x: entry: Remove unneeded need_resched() loop Valentin Schneider
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, linux-sh,
	linux-riscv, uclinux-h8-devel, linux-m68k

preempt_schedule_irq() is the one that should be called on return from
interrupt, clean up the comment to avoid any ambiguity.

Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/sched/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f9a1346a5fa9..3f40ea9f1372 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4223,9 +4223,8 @@ static void __sched notrace preempt_schedule_common(void)
 
 #ifdef CONFIG_PREEMPTION
 /*
- * this is the entry point to schedule() from in-kernel preemption
- * off of preempt_enable. Kernel preemptions off return from interrupt
- * occur there and call schedule directly.
+ * This is the entry point to schedule() from in-kernel preemption
+ * off of preempt_enable.
  */
 asmlinkage __visible void __sched notrace preempt_schedule(void)
 {
@@ -4296,7 +4295,7 @@ EXPORT_SYMBOL_GPL(preempt_schedule_notrace);
 #endif /* CONFIG_PREEMPTION */
 
 /*
- * this is the entry point to schedule() from kernel preemption
+ * This is the entry point to schedule() from kernel preemption
  * off of irq context.
  * Note, that this is called and return with irqs disabled. This will
  * protect us against recursive calling from irq.
--
2.22.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/9] c6x: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 3/9] csky: " Valentin Schneider
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Salter, Aurelien Jacquiot, linux-c6x-dev

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 <msalter@redhat.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
Cc: linux-c6x-dev@linux-c6x.org
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/9] csky: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 2/9] c6x: entry: Remove unneeded need_resched() loop Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-23 16:55   ` Guo Ren
  2019-09-23 14:36 ` [PATCH v2 4/9] h8300: " Valentin Schneider
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Guo Ren

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: Guo Ren <guoren@kernel.org>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 arch/csky/kernel/entry.S | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
index a7e84ccccbd8..679afbcc2001 100644
--- a/arch/csky/kernel/entry.S
+++ b/arch/csky/kernel/entry.S
@@ -292,11 +292,7 @@ ENTRY(csky_irq)
 	ldw	r8, (r9, TINFO_FLAGS)
 	btsti	r8, TIF_NEED_RESCHED
 	bf	2f
-1:
 	jbsr	preempt_schedule_irq	/* irq en/disable is done inside */
-	ldw	r7, (r9, TINFO_FLAGS)	/* get new tasks TI_FLAGS */
-	btsti	r7, TIF_NEED_RESCHED
-	bt	1b			/* go again */
 #endif
 2:
 	jmpi	ret_from_exception
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/9] h8300: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (2 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 3/9] csky: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 5/9] microblaze: " Valentin Schneider
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Yoshinori Sato, uclinux-h8-devel

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 <valentin.schneider@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 5/9] microblaze: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (3 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 4/9] h8300: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-24 10:30   ` Michal Simek
  2019-09-23 14:36 ` [PATCH v2 6/9] RISC-V: " Valentin Schneider
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michal Simek

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 <valentin.schneider@arm.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/entry.S | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index 4e1b567becd6..de7083bd1d24 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -738,14 +738,9 @@ no_intr_resched:
 	andi	r5, r5, _TIF_NEED_RESCHED;
 	beqi	r5, restore /* if zero jump over */
 
-preempt:
 	/* interrupts are off that's why I am calling preempt_chedule_irq */
 	bralid	r15, preempt_schedule_irq
 	nop
-	lwi	r11, CURRENT_TASK, TS_THREAD_INFO;	/* get thread info */
-	lwi	r5, r11, TI_FLAGS;		/* get flags in thread info */
-	andi	r5, r5, _TIF_NEED_RESCHED;
-	bnei	r5, preempt /* if non zero jump to resched */
 restore:
 #endif
 	VM_OFF /* MS: turn off MMU */
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 6/9] RISC-V: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (4 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 5/9] microblaze: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-10-09  0:51   ` Paul Walmsley
  2019-09-23 14:36 ` [PATCH v2 7/9] sh: " Valentin Schneider
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Palmer Dabbelt, Albert Ou, linux-riscv

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.

Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
---
 arch/riscv/kernel/entry.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 74ccfd464071..d0523167d261 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -250,12 +250,11 @@ restore_all:
 resume_kernel:
 	REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
 	bnez s0, restore_all
-need_resched:
 	REG_L s0, TASK_TI_FLAGS(tp)
 	andi s0, s0, _TIF_NEED_RESCHED
 	beqz s0, restore_all
 	call preempt_schedule_irq
-	j need_resched
+	j restore_all
 #endif
 
 work_pending:
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 7/9] sh: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (5 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 6/9] RISC-V: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 8/9] sh64: " Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 9/9] xtensa: " Valentin Schneider
  8 siblings, 0 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Yoshinori Sato, Rich Felker, linux-sh

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 <valentin.schneider@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 8/9] sh64: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (6 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 7/9] sh: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-09-23 14:36 ` [PATCH v2 9/9] xtensa: " Valentin Schneider
  8 siblings, 0 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Yoshinori Sato, Rich Felker, linux-sh

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 <valentin.schneider@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
 arch/sh/kernel/cpu/sh5/entry.S | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index de68ffdfffbf..40e6d9a7a6a2 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -897,7 +897,6 @@ resume_kernel:
 	ld.l	r6, TI_PRE_COUNT, r7
 	beq/u	r7, ZERO, tr0
 
-need_resched:
 	ld.l	r6, TI_FLAGS, r7
 	movi	(1 << TIF_NEED_RESCHED), r8
 	and	r8, r7, r8
@@ -911,9 +910,7 @@ need_resched:
 	ori	r7, 1, r7
 	ptabs	r7, tr1
 	blink	tr1, LINK
-
-	pta	need_resched, tr1
-	blink	tr1, ZERO
+	blink   tr0, ZERO
 #endif
 
 	.global ret_from_syscall
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 9/9] xtensa: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
                   ` (7 preceding siblings ...)
  2019-09-23 14:36 ` [PATCH v2 8/9] sh64: " Valentin Schneider
@ 2019-09-23 14:36 ` Valentin Schneider
  2019-11-14 18:17   ` Max Filippov
  8 siblings, 1 reply; 16+ messages in thread
From: Valentin Schneider @ 2019-09-23 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Max Filippov, Chris Zankel, linux-xtensa

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 <jcmvbkbc@gmail.com>
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/9] csky: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 ` [PATCH v2 3/9] csky: " Valentin Schneider
@ 2019-09-23 16:55   ` Guo Ren
  0 siblings, 0 replies; 16+ messages in thread
From: Guo Ren @ 2019-09-23 16:55 UTC (permalink / raw)
  To: Valentin Schneider; +Cc: Linux Kernel Mailing List

Ok, I'll put in my tree :)

On Mon, Sep 23, 2019 at 10:36 PM Valentin Schneider
<valentin.schneider@arm.com> 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: Guo Ren <guoren@kernel.org>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  arch/csky/kernel/entry.S | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
> index a7e84ccccbd8..679afbcc2001 100644
> --- a/arch/csky/kernel/entry.S
> +++ b/arch/csky/kernel/entry.S
> @@ -292,11 +292,7 @@ ENTRY(csky_irq)
>         ldw     r8, (r9, TINFO_FLAGS)
>         btsti   r8, TIF_NEED_RESCHED
>         bf      2f
> -1:
>         jbsr    preempt_schedule_irq    /* irq en/disable is done inside */
> -       ldw     r7, (r9, TINFO_FLAGS)   /* get new tasks TI_FLAGS */
> -       btsti   r7, TIF_NEED_RESCHED
> -       bt      1b                      /* go again */
>  #endif
>  2:
>         jmpi    ret_from_exception
> --
> 2.22.0
>


-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 5/9] microblaze: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 ` [PATCH v2 5/9] microblaze: " Valentin Schneider
@ 2019-09-24 10:30   ` Michal Simek
  2019-09-24 10:48     ` Valentin Schneider
  0 siblings, 1 reply; 16+ messages in thread
From: Michal Simek @ 2019-09-24 10:30 UTC (permalink / raw)
  To: Valentin Schneider, linux-kernel

On 23. 09. 19 16:36, Valentin Schneider 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.
> 
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Michal Simek <monstr@monstr.eu>
> ---
>  arch/microblaze/kernel/entry.S | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
> index 4e1b567becd6..de7083bd1d24 100644
> --- a/arch/microblaze/kernel/entry.S
> +++ b/arch/microblaze/kernel/entry.S
> @@ -738,14 +738,9 @@ no_intr_resched:
>  	andi	r5, r5, _TIF_NEED_RESCHED;
>  	beqi	r5, restore /* if zero jump over */
>  
> -preempt:
>  	/* interrupts are off that's why I am calling preempt_chedule_irq */
>  	bralid	r15, preempt_schedule_irq
>  	nop
> -	lwi	r11, CURRENT_TASK, TS_THREAD_INFO;	/* get thread info */
> -	lwi	r5, r11, TI_FLAGS;		/* get flags in thread info */
> -	andi	r5, r5, _TIF_NEED_RESCHED;
> -	bnei	r5, preempt /* if non zero jump to resched */
>  restore:
>  #endif
>  	VM_OFF /* MS: turn off MMU */
> 

Looks reasonable and also tested on HW. I expect you want me to take it
via microblaze tree that's why applied.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 5/9] microblaze: entry: Remove unneeded need_resched() loop
  2019-09-24 10:30   ` Michal Simek
@ 2019-09-24 10:48     ` Valentin Schneider
  0 siblings, 0 replies; 16+ messages in thread
From: Valentin Schneider @ 2019-09-24 10:48 UTC (permalink / raw)
  To: Michal Simek, linux-kernel

On 24/09/2019 11:30, Michal Simek wrote:
> On 23. 09. 19 16:36, Valentin Schneider 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.
>>
>> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
>> Cc: Michal Simek <monstr@monstr.eu>
>> ---
>>  arch/microblaze/kernel/entry.S | 5 -----
>>  1 file changed, 5 deletions(-)
>>
>> diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
>> index 4e1b567becd6..de7083bd1d24 100644
>> --- a/arch/microblaze/kernel/entry.S
>> +++ b/arch/microblaze/kernel/entry.S
>> @@ -738,14 +738,9 @@ no_intr_resched:
>>  	andi	r5, r5, _TIF_NEED_RESCHED;
>>  	beqi	r5, restore /* if zero jump over */
>>  
>> -preempt:
>>  	/* interrupts are off that's why I am calling preempt_chedule_irq */
>>  	bralid	r15, preempt_schedule_irq
>>  	nop
>> -	lwi	r11, CURRENT_TASK, TS_THREAD_INFO;	/* get thread info */
>> -	lwi	r5, r11, TI_FLAGS;		/* get flags in thread info */
>> -	andi	r5, r5, _TIF_NEED_RESCHED;
>> -	bnei	r5, preempt /* if non zero jump to resched */
>>  restore:
>>  #endif
>>  	VM_OFF /* MS: turn off MMU */
>>
> 
> Looks reasonable and also tested on HW. I expect you want me to take it
> via microblaze tree that's why applied.
> 

Yes, please. Thanks!

> Thanks,
> Michal
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip: sched/urgent] sched/core: Fix preempt_schedule() interrupt return comment
  2019-09-23 14:36 ` [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment Valentin Schneider
@ 2019-09-27  8:10   ` tip-bot2 for Valentin Schneider
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot2 for Valentin Schneider @ 2019-09-27  8:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Valentin Schneider, Peter Zijlstra (Intel),
	Thomas Gleixner, Linus Torvalds, linux-m68k, linux-riscv,
	uclinux-h8-devel, Ingo Molnar, Borislav Petkov, linux-kernel

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     a49b4f4012ef233143c5f7ce44f97851e54d5ef9
Gitweb:        https://git.kernel.org/tip/a49b4f4012ef233143c5f7ce44f97851e54d5ef9
Author:        Valentin Schneider <valentin.schneider@arm.com>
AuthorDate:    Mon, 23 Sep 2019 15:36:12 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 25 Sep 2019 17:42:32 +02:00

sched/core: Fix preempt_schedule() interrupt return comment

preempt_schedule_irq() is the one that should be called on return from
interrupt, clean up the comment to avoid any ambiguity.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-riscv@lists.infradead.org
Cc: uclinux-h8-devel@lists.sourceforge.jp
Link: https://lkml.kernel.org/r/20190923143620.29334-2-valentin.schneider@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 83ea23e..00ef44c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4218,9 +4218,8 @@ static void __sched notrace preempt_schedule_common(void)
 
 #ifdef CONFIG_PREEMPTION
 /*
- * this is the entry point to schedule() from in-kernel preemption
- * off of preempt_enable. Kernel preemptions off return from interrupt
- * occur there and call schedule directly.
+ * This is the entry point to schedule() from in-kernel preemption
+ * off of preempt_enable.
  */
 asmlinkage __visible void __sched notrace preempt_schedule(void)
 {
@@ -4291,7 +4290,7 @@ EXPORT_SYMBOL_GPL(preempt_schedule_notrace);
 #endif /* CONFIG_PREEMPTION */
 
 /*
- * this is the entry point to schedule() from kernel preemption
+ * This is the entry point to schedule() from kernel preemption
  * off of irq context.
  * Note, that this is called and return with irqs disabled. This will
  * protect us against recursive calling from irq.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 6/9] RISC-V: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 ` [PATCH v2 6/9] RISC-V: " Valentin Schneider
@ 2019-10-09  0:51   ` Paul Walmsley
  0 siblings, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2019-10-09  0:51 UTC (permalink / raw)
  To: Valentin Schneider; +Cc: linux-kernel, linux-riscv, Palmer Dabbelt, Albert Ou

On Mon, 23 Sep 2019, Valentin Schneider 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.
> 
> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: linux-riscv@lists.infradead.org

Thanks, queued for v5.4-rc.


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 9/9] xtensa: entry: Remove unneeded need_resched() loop
  2019-09-23 14:36 ` [PATCH v2 9/9] xtensa: " Valentin Schneider
@ 2019-11-14 18:17   ` Max Filippov
  0 siblings, 0 replies; 16+ messages in thread
From: Max Filippov @ 2019-11-14 18:17 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: LKML, Chris Zankel, open list:TENSILICA XTENSA PORT (xtensa)

On Mon, Sep 23, 2019 at 7:36 AM Valentin Schneider
<valentin.schneider@arm.com> 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 <jcmvbkbc@gmail.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: linux-xtensa@linux-xtensa.org
> ---
>  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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-11-14 18:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 14:36 [PATCH v2 0/9] entry: preempt_schedule_irq() callers scrub Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 1/9] sched/core: Fix preempt_schedule() interrupt return comment Valentin Schneider
2019-09-27  8:10   ` [tip: sched/urgent] " tip-bot2 for Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 2/9] c6x: entry: Remove unneeded need_resched() loop Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 3/9] csky: " Valentin Schneider
2019-09-23 16:55   ` Guo Ren
2019-09-23 14:36 ` [PATCH v2 4/9] h8300: " Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 5/9] microblaze: " Valentin Schneider
2019-09-24 10:30   ` Michal Simek
2019-09-24 10:48     ` Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 6/9] RISC-V: " Valentin Schneider
2019-10-09  0:51   ` Paul Walmsley
2019-09-23 14:36 ` [PATCH v2 7/9] sh: " Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 8/9] sh64: " Valentin Schneider
2019-09-23 14:36 ` [PATCH v2 9/9] xtensa: " Valentin Schneider
2019-11-14 18:17   ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).