linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/7] entry: preempt_schedule_irq() callers scrub
@ 2019-05-28 10:48 Valentin Schneider
  2019-05-28 10:48 ` [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop Valentin Schneider
  0 siblings, 1 reply; 4+ messages in thread
From: Valentin Schneider @ 2019-05-28 10:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: uclinux-h8-devel, linux-sh, Peter Zijlstra, linux-m68k,
	Ingo Molnar, Thomas Gleixner, linux-riscv

Hi,

This is the (RESEND of the) continuation of [1] where I'm hunting down
preempt_schedule_irq() callers because of [2].

I told myself the best way to get this moving forward wouldn't be to write
doc about it, but to go write some fixes and get some discussions going,
which is what this patch-set is about.

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.2-rc2 mainline contains those for:
- arm64
- mips
- x86
- powerpc
- nds32

I've also got acks for:
- c6x
- xtensa

The remaining ones for which I haven't had a reply yet (hence the RESEND) are:
- csky
- h8300
- microblaze
- riscv
- sh
- sh64


Build-tested on:
- h8300
- c6x
- microblaze

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 (7):
  sched/core: Fix preempt_schedule() interrupt return comment
  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

 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 +---
 kernel/sched/core.c            | 7 +++----
 7 files changed, 7 insertions(+), 24 deletions(-)

--
2.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop
  2019-05-28 10:48 [PATCH RESEND 0/7] entry: preempt_schedule_irq() callers scrub Valentin Schneider
@ 2019-05-28 10:48 ` Valentin Schneider
  2019-05-30  4:09   ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Valentin Schneider @ 2019-05-28 10:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-riscv, Palmer Dabbelt, Albert Ou

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: Palmer Dabbelt <palmer@sifive.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 1c1ecc238cfa..d0b1b9660283 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -258,12 +258,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.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop
  2019-05-28 10:48 ` [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop Valentin Schneider
@ 2019-05-30  4:09   ` Palmer Dabbelt
  2019-05-30 16:37     ` Valentin Schneider
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2019-05-30  4:09 UTC (permalink / raw)
  To: valentin.schneider; +Cc: linux-riscv, aou, linux-kernel

On Tue, 28 May 2019 03:48:46 PDT (-0700), 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.
>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Palmer Dabbelt <palmer@sifive.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 1c1ecc238cfa..d0b1b9660283 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -258,12 +258,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:

Sorry I missed this the first time around.

Reviewed-by: Palmer Dabbelt <palmer@sifive.com>

Do you want this through the RISC-V tree, or are you going to take it?

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop
  2019-05-30  4:09   ` Palmer Dabbelt
@ 2019-05-30 16:37     ` Valentin Schneider
  0 siblings, 0 replies; 4+ messages in thread
From: Valentin Schneider @ 2019-05-30 16:37 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-riscv, aou, linux-kernel

On 30/05/2019 05:09, Palmer Dabbelt wrote:
[...]
> 
> Sorry I missed this the first time around.
> 
> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
> 
> Do you want this through the RISC-V tree, or are you going to take it?

Thanks! It's a standalone change so this would be fine through your tree.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2019-05-30 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 10:48 [PATCH RESEND 0/7] entry: preempt_schedule_irq() callers scrub Valentin Schneider
2019-05-28 10:48 ` [PATCH RESEND 5/7] RISC-V: entry: Remove unneeded need_resched() loop Valentin Schneider
2019-05-30  4:09   ` Palmer Dabbelt
2019-05-30 16:37     ` Valentin Schneider

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).