Commit 1b0f44923e186b2f9383b3260f6b5fbfc77b9e4a

Authored by Tobias Klauser
Committed by Ley Foon Tan
1 parent 6f3d2b0075

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 <tglx@linutronix.de>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <lftan@altera.com>

Showing 1 changed file with 2 additions and 18 deletions Side-by-side Diff

arch/nios2/kernel/entry.S
... ... @@ -365,30 +365,14 @@
365 365 GET_THREAD_INFO r1
366 366 ldw r4, TI_PREEMPT_COUNT(r1)
367 367 bne r4, r0, restore_all
368   -
369   -need_resched:
370 368 ldw r4, TI_FLAGS(r1) /* ? Need resched set */
371 369 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all
372 370 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */
373 371 andi r10, r4, ESTATUS_EPIE
374 372 beq r10, r0, restore_all
375   - movia r4, PREEMPT_ACTIVE
376   - stw r4, TI_PREEMPT_COUNT(r1)
377   - rdctl r10, status /* enable intrs again */
378   - ori r10, r10 ,STATUS_PIE
379   - wrctl status, r10
380   - PUSH r1
381   - call schedule
382   - POP r1
383   - mov r4, r0
384   - stw r4, TI_PREEMPT_COUNT(r1)
385   - rdctl r10, status /* disable intrs */
386   - andi r10, r10, %lo(~STATUS_PIE)
387   - wrctl status, r10
388   - br need_resched
389   -#else
390   - br restore_all
  373 + call preempt_schedule_irq
391 374 #endif
  375 + br restore_all
392 376  
393 377 /***********************************************************************
394 378 * A few syscall wrappers