From patchwork Wed Jan 29 20:31:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 3554501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7CD039F382 for ; Wed, 29 Jan 2014 20:32:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2E442017A for ; Wed, 29 Jan 2014 20:32:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9344720170 for ; Wed, 29 Jan 2014 20:32:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8bns-0006BH-Ix; Wed, 29 Jan 2014 20:32:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8bnq-0000KB-C6; Wed, 29 Jan 2014 20:32:06 +0000 Received: from mail-qa0-f48.google.com ([209.85.216.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8bnn-0000JL-2s for linux-arm-kernel@lists.infradead.org; Wed, 29 Jan 2014 20:32:03 +0000 Received: by mail-qa0-f48.google.com with SMTP id f11so3184268qae.35 for ; Wed, 29 Jan 2014 12:31:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=2r5vf0evRcKAmhvkND7O4Vh7I/232ZA9m2MRzyZqFBM=; b=h7xuBa7LwAkr1eH3D0iERYfQ7DYNxBIaRyk9yvURe7H7xMRSzxD67VgYNcl3XZvIMZ jYKZCRVOPW/Qvu3wb3SX7X7EfJpCDqUBligYW8wzD8M8xl6MEXu432QiO0dUMbGpLQyn in228PiAruXF6JxidzBj6sf9aexGZdS405YvgYXVXgoKF/LkFUesPrnDSKHIb1i1lG5j TRP3ZrhsM40h5XsN4ecIUDuY53S1lvgOSNGWSqlKZtxH96NqMHbgH/ijBn5yED1I9gZZ JP6MAvM8BR1IGGB7zRyc8ktYcd6YXpN8JEs40+3mLJL0aMmAPUhUZvou+FbXtulVo+Dy fXow== X-Gm-Message-State: ALoCoQlX3xjeYkAF+0mC31betdox5T7koV4ThUDB+EtN3kfH6AjJKLQoMvwcz7OOegqfPV8VoNaI X-Received: by 10.140.43.3 with SMTP id d3mr14641233qga.70.1391027498759; Wed, 29 Jan 2014 12:31:38 -0800 (PST) Received: from xanadu.home (modemcable177.143-130-66.mc.videotron.ca. [66.130.143.177]) by mx.google.com with ESMTPSA id j65sm5066623qgj.18.2014.01.29.12.31.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 12:31:38 -0800 (PST) Date: Wed, 29 Jan 2014 15:31:36 -0500 (EST) From: Nicolas Pitre To: Olof Johansson , Russell King , Benjamin Herrenschmidt , Preeti U Murthy , Paul Mundt , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , "Rafael J. Wysocki" , Daniel Lezcano Subject: Re: [PATCH v2 1/6] idle: move the cpuidle entry point to the generic idle loop In-Reply-To: <1391017513-12995-2-git-send-email-nicolas.pitre@linaro.org> Message-ID: References: <1391017513-12995-1-git-send-email-nicolas.pitre@linaro.org> <1391017513-12995-2-git-send-email-nicolas.pitre@linaro.org> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140129_153203_168784_073CA93E X-CRM114-Status: GOOD ( 19.41 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 29 Jan 2014, Nicolas Pitre wrote: > In order to integrate cpuidle with the scheduler, we must have a better > proximity in the core code with what cpuidle is doing and not delegate > such interaction to arch code. > > Architectures implementing arch_cpu_idle() should simply enter > a cheap idle mode in the absence of a proper cpuidle driver. > > Signed-off-by: Nicolas Pitre > Acked-by: Daniel Lezcano As mentioned in my reply to Olof's comment on patch #5/6, here's a new version of this patch adding the safety local_irq_enable() to the core code. ----- >8 From: Nicolas Pitre Subject: idle: move the cpuidle entry point to the generic idle loop In order to integrate cpuidle with the scheduler, we must have a better proximity in the core code with what cpuidle is doing and not delegate such interaction to arch code. Architectures implementing arch_cpu_idle() should simply enter a cheap idle mode in the absence of a proper cpuidle driver. In both cases i.e. whether it is a cpuidle driver or the default arch_cpu_idle(), the calling convention expects IRQs to be disabled on entry and enabled on exit. There is a warning in place already but let's add a forced IRQ enable here as well. This will allow for removing the forced IRQ enable some implementations do locally and allowing for the warning to trig. Signed-off-by: Nicolas Pitre diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c index 988573a9a3..14ca43430a 100644 --- a/kernel/cpu/idle.c +++ b/kernel/cpu/idle.c @@ -3,6 +3,7 @@ */ #include #include +#include #include #include #include @@ -95,8 +96,10 @@ static void cpu_idle_loop(void) if (!current_clr_polling_and_test()) { stop_critical_timings(); rcu_idle_enter(); - arch_cpu_idle(); - WARN_ON_ONCE(irqs_disabled()); + if (cpuidle_idle_call()) + arch_cpu_idle(); + if (WARN_ON_ONCE(irqs_disabled())) + local_irq_enable(); rcu_idle_exit(); start_critical_timings(); } else {