linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Enable interrupts before WAIT instruction.

To: Manuel Lauss <manuel.lauss@gmail.com>
Subject: Re: [PATCH] MIPS: Enable interrupts before WAIT instruction.
From: Eunbong Song <songeunbong@gmail.com>
Date: Tue, 7 May 2013 14:47:35 +0900
Cc: David Daney <ddaney.cavm@gmail.com>, Linux-MIPS <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>, Linus Torvalds <torvalds@linux-foundation.org>, LKML <linux-kernel@vger.kernel.org>, David Daney <david.daney@cavium.com>, Thomas Gleixner <tglx@linutronix.de>, Jonas Gorski <jogo@openwrt.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=mDlAnYHtLxmoweKXswjjISl88iOn0OPeWoUjqEmRShU=; b=U/efzdQmwPsxcrn1SnToVzcVtfEhKo7k7nzvS7KnQc1EMgZ8uMq9dpE7MK1LuXjVjk sKllsuElemcsEX2RnWXdBhKvH+4pd2lK5ba4S52kt2Yj5c6sRWZdcMS2x4i5BB2axugh 2Ls4RuFuDkmtAdyhesjwJwMqSj/SQxt4cnmoaRtnGCveDqz1qqnGOAFl24XHccoANu9H P37u0kxFbpCEY5N6GdlVJhhfZeb+Tw34g1NEOGIwUbO7Qs6IFDHqhrkUgC/XDJNH630m f+2mDBLXjnYr4n5dqyu8At4429QKuoQ8nq1jCSC71HfA0+SDLZys74Rf3YgcC+GVo+9I aq9A==
In-reply-to: <CAOLZvyFo8OWD4qXDCQwJOWn0Hgs35XEF2pDppSbPt3Fnb3j9GQ@mail.gmail.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <CA+55aFwDGyHOzu=Qh7SJOBK6QvAwAh7pMDL6LfMUE=AW_kapAw@mail.gmail.com> <1367527692-25809-1-git-send-email-ddaney.cavm@gmail.com> <CAOLZvyFo8OWD4qXDCQwJOWn0Hgs35XEF2pDppSbPt3Fnb3j9GQ@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Hello. I  also tested with this patch. 

[  124.661211] Checking for the daddi bug... no.
[  124.665737] ------------[ cut here ]------------
[  124.670187] WARNING: at kernel/cpu/idle.c:96 cpu_startup_entry+0x150/0x178()
[  124.677209] Modules linked in:
[  124.680251] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.9.0+ #40
[  124.686237] Stack : 0000000000000004 0000000000000034 ffffffff80fa0000 ffffffff80292558
          0000000000000000 ffffffff80fa0000 0000000000000001 ffffffff80293810
          0000000000000000 0000000000000000 ffffffff81080000 ffffffff81080000
          ffffffff80e2acf0 ffffffff80f8f977 ffffffff80f8fa80 ffffffff80e31730
          0000000000000001 0000000000000004 ffffffff00000000 0000000000000004
          ffffffffc05633f0 ffffffff806ef728 ffffffff80f57d08 ffffffff80290a74
          ffffffffc05633f0 ffffffff80293c40 000000000000003e ffffffff80e2acf0
          0000000000000000 ffffffff80f57c30 00ffffff80f8fdc0 ffffffff802908c0
          0000000000000000 0000000000000000 0000000000000000 0000000000000000
          0000000000000000 ffffffff80272498 0000000000000000 0000000000000000
          ...
[  124.751163] Call Trace:
[  124.753599] [<ffffffff80272498>] show_stack+0x68/0x80
[  124.758634] [<ffffffff802908c0>] warn_slowpath_common+0x78/0xa8
[  124.764533] [<ffffffff802d4448>] cpu_startup_entry+0x150/0x178
[  124.770351] [<ffffffff80fd6b04>] start_kernel+0x440/0x45c
[  124.775728]
[  124.777219] ---[ end trace 9179e654e5693e72 ]---

But boot process is done. After boot process is done the follow error message is printed periodically.


[  284.751007] INFO: rcu_preempt detected stalls on CPUs/tasks: { 6} (detected by 1, t=14712 jiffies, g=18446744073709551344, c=18446744073709551343, q=2437)
[  284.764878] Task dump for CPU 6:
[  284.768105] swapper/6       R  running task        0     0      1 0x00100000
[  284.775174] Stack : 0000005311112000 ffffffff80f60000 ffffffff80f60000 a800000001d2d950
          0000000000000018 ffffffff81080000 ffffffff81080000 0000000000000000
          ffffffff81010000 ffffffff8030893c 4256e5715da6083d 800000040f800000
          0000000000000018 ffffffff81080000 ffffffff81080000 ffffffff80264f3c
          ffffffff80e31730 0000000000000000 ffffffff80e31730 ffffffff80f90000
          ffffffff80fd0000 ffffffff8026c760 0000000000000000 0000000010008ce1
          0000000000100000 a8000000414e4010 ffffffff80f8bb18 0000000000000000
          0000005311112000 0000000000000001 0000000000000001 0000000000000000
          ffffffff80f8bc58 a800000001d32c60 a8000000414e7fe0 0000000000008c00
          a80000003f7d8000 0000000000000000 ffffffff80fd0000 ffffffff80e31730
          ...
[  284.840704] Call Trace:
[  284.843153] [<ffffffff806f1a48>] __schedule+0x3b0/0x938
[  284.848377]



After removing this patch, i only apply thomas gleixner's patch. I copied that patch below. 
It works well without any error message. 


Index: linux-2.6/arch/mips/kernel/process.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/process.c
+++ linux-2.6/arch/mips/kernel/process.c
@@ -50,13 +50,18 @@ void arch_cpu_idle_dead(void)
 }
 #endif

-void arch_cpu_idle(void)
+static void smtc_idle_hook(void)
 {
 #ifdef CONFIG_MIPS_MT_SMTC
        extern void smtc_idle_loop_hook(void);
-
        smtc_idle_loop_hook();
 #endif
+}
+
+void arch_cpu_idle(void)
+{
+       local_irq_enable();
+       smtc_idle_hook();
        if (cpu_wait)
                (*cpu_wait)();
        else
--

Thanks


2013/5/6 Manuel Lauss <manuel.lauss@gmail.com>
Hi David,

On Thu, May 2, 2013 at 10:48 PM, David Daney <ddaney.cavm@gmail.com> wrote:
> 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(-)

Unfortunately this patch doesn't work for me, system just hangs at
certain points
during kernel startup.  Reverting the patch above fixes it, but with
this warning:

ehci-platform ehci-platform.0: irq 98, io mem 0x14020000
------------[ cut here ]------------
WARNING: at /home/mano/db1200/kernel/linux/kernel/cpu/idle.c:96
cpu_startup_entry+0x138/0x184()
CPU: 0 PID: 0 Comm: swapper Not tainted 3.9.0-db1235-10522-g6295a89 #2
Stack : 00000000 00000000 809b4462 00000046 80929c20 00000000 808c6504 00000000
          808c3428 80929b27 80929dc8 00000000 809b3c04 00000000
00000000 00000000
          80093348 807d1000 2cb41780 8011f458 00000000 00000000
808c4a28 8091fe24
          00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000
00000000 8091fdb0
          ...
Call Trace:
[<8010a1fc>] show_stack+0x64/0x7c
[<8011f614>] warn_slowpath_common+0x70/0xa0
[<8011f700>] warn_slowpath_null+0x18/0x28
[<80150464>] cpu_startup_entry+0x138/0x184
[<809658f0>] start_kernel+0x360/0x378

---[ end trace 19427144468f733d ]---
ehci-platform ehci-platform.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found


Thanks,
      Manuel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] MIPS: Enable interrupts before WAIT instruction., Eunbong Song <=