* [v0][PATCH 1/1] powerpc/book3e: disable interrupt after preempt_schedule_irq
@ 2013-01-06 10:49 Tiejun Chen
2013-01-24 4:02 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Tiejun Chen @ 2013-01-06 10:49 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, linux-kernel
In preempt case current arch_local_irq_restore() from
preempt_schedule_irq() may enable hard interrupt but we really
should disable interrupts when we return from the interrupt,
and so that we don't get interrupted after loading SRR0/1.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
arch/powerpc/kernel/entry_64.S | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index e9a906c..4e1de34 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -662,6 +662,19 @@ resume_kernel:
ld r4,TI_FLAGS(r9)
andi. r0,r4,_TIF_NEED_RESCHED
bne 1b
+
+ /*
+ * arch_local_irq_restore() from preempt_schedule_irq above may
+ * enable hard interrupt but we really should disable interrupts
+ * when we return from the interrupt, and so that we don't get
+ * interrupted after loading SRR0/1.
+ */
+#ifdef CONFIG_PPC_BOOK3E
+ wrteei 0
+#else
+ ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
+ mtmsrd r10,1 /* Update machine state */
+#endif /* CONFIG_PPC_BOOK3E */
#endif /* CONFIG_PREEMPT */
.globl fast_exc_return_irq
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [v0][PATCH 1/1] powerpc/book3e: disable interrupt after preempt_schedule_irq
2013-01-06 10:49 [v0][PATCH 1/1] powerpc/book3e: disable interrupt after preempt_schedule_irq Tiejun Chen
@ 2013-01-24 4:02 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2013-01-24 4:02 UTC (permalink / raw)
To: Tiejun Chen; +Cc: linuxppc-dev, linux-kernel
On Sun, 2013-01-06 at 18:49 +0800, Tiejun Chen wrote:
> In preempt case current arch_local_irq_restore() from
> preempt_schedule_irq() may enable hard interrupt but we really
> should disable interrupts when we return from the interrupt,
> and so that we don't get interrupted after loading SRR0/1.
This is an excellent catch, thanks !
Cheers,
Ben.
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
> arch/powerpc/kernel/entry_64.S | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index e9a906c..4e1de34 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -662,6 +662,19 @@ resume_kernel:
> ld r4,TI_FLAGS(r9)
> andi. r0,r4,_TIF_NEED_RESCHED
> bne 1b
> +
> + /*
> + * arch_local_irq_restore() from preempt_schedule_irq above may
> + * enable hard interrupt but we really should disable interrupts
> + * when we return from the interrupt, and so that we don't get
> + * interrupted after loading SRR0/1.
> + */
> +#ifdef CONFIG_PPC_BOOK3E
> + wrteei 0
> +#else
> + ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
> + mtmsrd r10,1 /* Update machine state */
> +#endif /* CONFIG_PPC_BOOK3E */
> #endif /* CONFIG_PREEMPT */
>
> .globl fast_exc_return_irq
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-24 4:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-06 10:49 [v0][PATCH 1/1] powerpc/book3e: disable interrupt after preempt_schedule_irq Tiejun Chen
2013-01-24 4:02 ` Benjamin Herrenschmidt
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).