linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Enable interrupts in arch_cpu_idle()

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] MIPS: Enable interrupts in arch_cpu_idle()
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu, 2 May 2013 09:45:08 -0700
Cc: Thomas Gleixner <tglx@linutronix.de>, Jonas Gorski <jogo@openwrt.org>, eunb.song@samsung.com, "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=dKplJIN7d8dFqUYmvBcbPkMhZpHiZz591JWAY0WcDQs=; b=Q0zAzjVTzda0yK96jfxZMHBRHRf9Rwd4sJBblWdd0cTXB6PDP0u3nv9A/hoC864HkM 4F9vdX3Awq8/7gQs2qCCPIE03bLYYWa3qKnRK3kfErPeLGa6R7wTd0NbPZkfU6epCp+N Rv97bT793vNXnN+Nto8Ps4lfzU/ZD9uAfHi1mnjOOjotUcrEuAsmR+j9QNkq31KwXJts gUyr6abknPu5YyXmuKOMEtzE5n+MtWWOTV4bWUM6XROs3DYE/37JsKAJzwIMSgnsWYWO 1cSl7wSPqX6bC2IOqHPba4R0N9sZm/l2PueuiJIG42ZV5Lu66hfVWazGCUFm+ICWF1ym JKEA==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=dKplJIN7d8dFqUYmvBcbPkMhZpHiZz591JWAY0WcDQs=; b=HYS6oCvAfHNL0+hGwSs2gxK7eFjsEkHoTRCe7QhVU8OYL/plqvwLFlT8e13kH5vukD 11G/NK0aA7joPLehfnS2TA+cVvvDTb2pR2Rz6Bsbw2I4UCv5BazPEhq2xTGYLf4BNSYR 1PMzD7vzIYrG/GKigamIlOCpzfUjXcZ+0+R48=
In-reply-to: <20130502145809.GA16236@linux-mips.org>
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: <20522420.158691367384219315.JavaMail.weblogic@epml17> <CAOiHx=mBPHmDse4EwL-+Fgmpz0=XhcgF_0nWdyvErFO4NU7E0Q@mail.gmail.com> <alpine.LFD.2.02.1305021241040.3972@ionos> <CAOiHx=mA-htk_2daeE9WpbEVV9YLvfLc1NYZZR=JeDdibchCnw@mail.gmail.com> <alpine.LFD.2.02.1305021527010.3972@ionos> <20130502145809.GA16236@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
On Thu, May 2, 2013 at 7:58 AM, Ralf Baechle <ralf@linux-mips.org> wrote:
>
> For a while we just used to live with the race condition resulting from
> not disabling interrupts in the idle loop.  Then c65a5480 fixed this by
> checking if we're returning to the WAIT instruction in the idle loop
> when returning from an interrupt and iff so, rolling back the
> program counter to point to the if (test_thread_flag(TIF_NEED_RESCHED))
> test at the beginning of rollback_r4k_wait.

Umm. That sounds buggy. What if there was an interrupt *between* the
two places, not right at the wait instruction?

It seriously sounds like MIPS should do this by enabling interrupts in
the *assembly* code immediately preceding the wait instruction. IOW,
you'd effectively have the same kind of "sti; halt" kind of sequence
that x86 has. Not "enable interrupts" + C compiler puts random
instructions here + "wait".

                       Linus

<Prev in Thread] Current Thread [Next in Thread>