public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: linux-mips@linux-mips.org, ralf@linux-mips.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	David Daney <david.daney@cavium.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jonas Gorski <jogo@openwrt.org>
Subject: [PATCH] MIPS: Enable interrupts before WAIT instruction.
Date: Thu,  2 May 2013 13:48:12 -0700	[thread overview]
Message-ID: <1367527692-25809-1-git-send-email-ddaney.cavm@gmail.com> (raw)
In-Reply-To: <CA+55aFwDGyHOzu=Qh7SJOBK6QvAwAh7pMDL6LfMUE=AW_kapAw@mail.gmail.com>

From: David Daney <david.daney@cavium.com>

As noted by Thomas Gleixner:

   commit cdbedc61c8 (mips: Use generic idle loop) broke MIPS as I did
   not realize that MIPS wants to invoke the wait instructions with
   interrupts enabled.

Instead of enabling interrupts in arch_cpu_idle() as Thomas' initial
patch does, we follow Linus' suggestion of doing it in the assembly
code to prevent the compiler from rearranging things.

Signed-off-by: David Daney <david.daney@cavium.com>
Reported-by: EunBong Song <eunb.song@samsung.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jonas Gorski <jogo@openwrt.org>
---

This is only very lightly tested, we need more testing before
declaring it the definitive fix.

 arch/mips/kernel/genex.S | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index ecb347c..57cda9a 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -132,12 +132,13 @@ LEAF(r4k_wait)
 	.set	noreorder
 	/* start of rollback region */
 	LONG_L	t0, TI_FLAGS($28)
-	nop
 	andi	t0, _TIF_NEED_RESCHED
 	bnez	t0, 1f
 	 nop
-	nop
-	nop
+	/* Enable interrupts so WAIT will complete */
+	mfc0	t0, CP0_STATUS
+	ori	t0, ST0_IE
+	mtc0	t0, CP0_STATUS
 	.set	mips3
 	wait
 	/* end of rollback region (the region size must be power of two) */
-- 
1.7.11.7


  reply	other threads:[~2013-05-02 20:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01  4:57 mips; boot fail after merge 3.9+ EUNBONG SONG
2013-05-02  8:32 ` Jonas Gorski
2013-05-02 10:42   ` Thomas Gleixner
2013-05-02 11:20     ` Jonas Gorski
2013-05-02 14:33       ` [PATCH] MIPS: Enable interrupts in arch_cpu_idle() Thomas Gleixner
2013-05-02 14:58         ` Ralf Baechle
2013-05-02 16:45           ` Linus Torvalds
2013-05-02 20:48             ` David Daney [this message]
2013-05-02 21:04               ` [PATCH] MIPS: Enable interrupts before WAIT instruction Thomas Gleixner
2013-05-03  9:54                 ` Jonas Gorski
2013-05-06 14:26               ` Manuel Lauss
2013-05-22 22:32               ` Aaro Koskinen
2013-05-22 22:36                 ` David Daney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367527692-25809-1-git-send-email-ddaney.cavm@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=david.daney@cavium.com \
    --cc=jogo@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox