2014-12-30 14:02:32

by Tobias Klauser

[permalink] [raw]
Subject: [PATCH] nios2: Use preempt_schedule_irq

Follow aa0d53260596 ("ia64: Use preempt_schedule_irq") and use
preempt_schedule_irq instead of enabling/disabling interrupts and messing around
with PREEMPT_ACTIVE in the nios2 low-level preemption code ourselves. Also get
rid of the now needless re-check for TIF_NEED_RESCHED, preempt_schedule_irq
will already take care of rescheduling.

This also fixes the following build error when building with CONFIG_PREEMPT:

arch/nios2/kernel/built-in.o: In function `need_resched':
arch/nios2/kernel/entry.S:374: undefined reference to `PREEMPT_ACTIVE'

Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Tobias Klauser <[email protected]>
---
arch/nios2/kernel/entry.S | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 83bca17..0bdfd13 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -365,30 +365,14 @@ ENTRY(ret_from_interrupt)
GET_THREAD_INFO r1
ldw r4, TI_PREEMPT_COUNT(r1)
bne r4, r0, restore_all
-
-need_resched:
ldw r4, TI_FLAGS(r1) /* ? Need resched set */
BTBZ r10, r4, TIF_NEED_RESCHED, restore_all
ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */
andi r10, r4, ESTATUS_EPIE
beq r10, r0, restore_all
- movia r4, PREEMPT_ACTIVE
- stw r4, TI_PREEMPT_COUNT(r1)
- rdctl r10, status /* enable intrs again */
- ori r10, r10 ,STATUS_PIE
- wrctl status, r10
- PUSH r1
- call schedule
- POP r1
- mov r4, r0
- stw r4, TI_PREEMPT_COUNT(r1)
- rdctl r10, status /* disable intrs */
- andi r10, r10, %lo(~STATUS_PIE)
- wrctl status, r10
- br need_resched
-#else
- br restore_all
+ call preempt_schedule_irq
#endif
+ br restore_all

/***********************************************************************
* A few syscall wrappers
--
2.2.0


2014-12-31 02:54:26

by Ley Foon Tan

[permalink] [raw]
Subject: Re: [PATCH] nios2: Use preempt_schedule_irq

On Tue, Dec 30, 2014 at 10:02 PM, Tobias Klauser <[email protected]> wrote:
> Follow aa0d53260596 ("ia64: Use preempt_schedule_irq") and use
> preempt_schedule_irq instead of enabling/disabling interrupts and messing around
> with PREEMPT_ACTIVE in the nios2 low-level preemption code ourselves. Also get
> rid of the now needless re-check for TIF_NEED_RESCHED, preempt_schedule_irq
> will already take care of rescheduling.
>
> This also fixes the following build error when building with CONFIG_PREEMPT:
>
> arch/nios2/kernel/built-in.o: In function `need_resched':
> arch/nios2/kernel/entry.S:374: undefined reference to `PREEMPT_ACTIVE'
>
> Cc: Thomas Gleixner <[email protected]>
> Signed-off-by: Tobias Klauser <[email protected]>
> ---
Acked-by: Ley Foon Tan <[email protected]>