diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-07-09 07:36:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-13 07:59:42 -0400 |
commit | 27dd47db1ba11a6f34d158a7dfa4c5bd78f81d1f (patch) | |
tree | 4795921fc8e077cd80e6095b787fe5ae6ebe6a2a | |
parent | 1a43738d057559e87e0036e25c33715d6eff11ed (diff) |
ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE
commit fce16bc35ae4a45634f3dc348d8d297a25c277cf upstream.
In the exception return path, for both U/K cases, intr are already
disabled (for various existing reasons). So when we drop down to
@restore_regs, we need not redo that.
There was subtle issue - when intr were NOT being disabled for
ret-to-kernel-but-no-preemption case - now fixed by moving the
IRQ_DISABLE further up in @resume_kernel_mode.
So what do we gain:
* Shaves off a few insn in return path.
* Eliminates the need for IRQ_DISABLE_SAVE assembler macro for ARCv2
hence allows for entry code sharing.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/arc/include/asm/irqflags.h | 7 | ||||
-rw-r--r-- | arch/arc/kernel/entry.S | 10 |
2 files changed, 5 insertions, 12 deletions
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h index eac071668201..c29d56587bf0 100644 --- a/arch/arc/include/asm/irqflags.h +++ b/arch/arc/include/asm/irqflags.h | |||
@@ -137,13 +137,6 @@ static inline void arch_unmask_irq(unsigned int irq) | |||
137 | flag \scratch | 137 | flag \scratch |
138 | .endm | 138 | .endm |
139 | 139 | ||
140 | .macro IRQ_DISABLE_SAVE scratch, save | ||
141 | lr \scratch, [status32] | ||
142 | mov \save, \scratch /* Make a copy */ | ||
143 | bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) | ||
144 | flag \scratch | ||
145 | .endm | ||
146 | |||
147 | .macro IRQ_ENABLE scratch | 140 | .macro IRQ_ENABLE scratch |
148 | lr \scratch, [status32] | 141 | lr \scratch, [status32] |
149 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) | 142 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) |
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 922150e153ea..57f38333834b 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S | |||
@@ -653,6 +653,9 @@ resume_kernel_mode: | |||
653 | 653 | ||
654 | #ifdef CONFIG_PREEMPT | 654 | #ifdef CONFIG_PREEMPT |
655 | 655 | ||
656 | ; This is a must for preempt_schedule_irq() | ||
657 | IRQ_DISABLE r9 | ||
658 | |||
656 | ; Can't preempt if preemption disabled | 659 | ; Can't preempt if preemption disabled |
657 | GET_CURR_THR_INFO_FROM_SP r10 | 660 | GET_CURR_THR_INFO_FROM_SP r10 |
658 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] | 661 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] |
@@ -662,8 +665,6 @@ resume_kernel_mode: | |||
662 | ld r9, [r10, THREAD_INFO_FLAGS] | 665 | ld r9, [r10, THREAD_INFO_FLAGS] |
663 | bbit0 r9, TIF_NEED_RESCHED, restore_regs | 666 | bbit0 r9, TIF_NEED_RESCHED, restore_regs |
664 | 667 | ||
665 | IRQ_DISABLE r9 | ||
666 | |||
667 | ; Invoke PREEMPTION | 668 | ; Invoke PREEMPTION |
668 | bl preempt_schedule_irq | 669 | bl preempt_schedule_irq |
669 | 670 | ||
@@ -676,12 +677,11 @@ resume_kernel_mode: | |||
676 | ; | 677 | ; |
677 | ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) | 678 | ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) |
678 | ; IRQ shd definitely not happen between now and rtie | 679 | ; IRQ shd definitely not happen between now and rtie |
680 | ; All 2 entry points to here already disable interrupts | ||
679 | 681 | ||
680 | restore_regs : | 682 | restore_regs : |
681 | 683 | ||
682 | ; Disable Interrupts while restoring reg-file back | 684 | lr r10, [status32] |
683 | ; XXX can this be optimised out | ||
684 | IRQ_DISABLE_SAVE r9, r10 ;@r10 has prisitine (pre-disable) copy | ||
685 | 685 | ||
686 | #ifdef CONFIG_ARC_CURR_IN_REG | 686 | #ifdef CONFIG_ARC_CURR_IN_REG |
687 | ; Restore User R25 | 687 | ; Restore User R25 |