Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760703Ab3EBQpL (ORCPT ); Thu, 2 May 2013 12:45:11 -0400 Received: from mail-vb0-f43.google.com ([209.85.212.43]:52640 "EHLO mail-vb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760657Ab3EBQpJ (ORCPT ); Thu, 2 May 2013 12:45:09 -0400 MIME-Version: 1.0 In-Reply-To: <20130502145809.GA16236@linux-mips.org> References: <20522420.158691367384219315.JavaMail.weblogic@epml17> <20130502145809.GA16236@linux-mips.org> Date: Thu, 2 May 2013 09:45:08 -0700 X-Google-Sender-Auth: Dy7Ks3KjiA-TAD5jlGa8KOJtMrk Message-ID: Subject: Re: [PATCH] MIPS: Enable interrupts in arch_cpu_idle() From: Linus Torvalds To: Ralf Baechle Cc: Thomas Gleixner , Jonas Gorski , eunb.song@samsung.com, "linux-mips@linux-mips.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1172 Lines: 24 On Thu, May 2, 2013 at 7:58 AM, Ralf Baechle 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 -- 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/