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: 23898 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5F2C420300 for ; Wed, 29 Jan 2014 20:31:45 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf8505292oah.10 for ; Wed, 29 Jan 2014 12:31:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:in-reply-to :message-id:references:user-agent:mime-version:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=n6TTyiwJRZjfSgM8rfvResuh+imTH0Yk5yvw/XvZvNg=; b=UVQ5Anc9ofh+obMKjc7LKmiUdTNbsH/yCJ3QjqI7DmRnzJP9kn9yFXhGAS5lwFPi46 qkycptpelsJW9Be8i4fECQ2FA3S6acNCcdnGuRhbn3NeUwjmcqRhbAtLwNclfkVyA9+b tUx/BrS5Q6Sa/l+x0xYLpOFcmnRFZc6+hNb1iJ+/tkn5qWhH5N5PWGkZjE7fq4iKEwSV QfS3v8Qxgenr46tzuFQ+lhonPiLJyjByZqMr7o9tDhwgWQPT852ypXDY84ub6bZAdTnv WE14sVvQS88GFoSmbW9UwoN3Lbz/ruZTRLv3aJyfWGdUrH96cTJUjDtbtJ7aPkiuw2Ff VtEA== X-Gm-Message-State: ALoCoQmumjn6QjEmNG1TVbWM/e28CL63t667eoTjMutKyjOQRCiEIJo2cqBwQJ+p8EIRBnY9Tiol X-Received: by 10.42.235.132 with SMTP id kg4mr3427534icb.32.1391027504186; Wed, 29 Jan 2014 12:31:44 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.227 with SMTP id m90ls268509qga.38.gmail; Wed, 29 Jan 2014 12:31:44 -0800 (PST) X-Received: by 10.58.29.42 with SMTP id g10mr2559341veh.28.1391027504066; Wed, 29 Jan 2014 12:31:44 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id dr8si1138593vcb.88.2014.01.29.12.31.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 12:31:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so1532271veb.2 for ; Wed, 29 Jan 2014 12:31:44 -0800 (PST) X-Received: by 10.220.109.1 with SMTP id h1mr8297122vcp.20.1391027503983; Wed, 29 Jan 2014 12:31:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp144075vcz; Wed, 29 Jan 2014 12:31:43 -0800 (PST) X-Received: by 10.66.41.106 with SMTP id e10mr10131706pal.109.1391027502933; Wed, 29 Jan 2014 12:31:42 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gj4si1714599pac.2.2014.01.29.12.31.42; Wed, 29 Jan 2014 12:31:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751690AbaA2Ubl (ORCPT + 11 others); Wed, 29 Jan 2014 15:31:41 -0500 Received: from mail-qc0-f169.google.com ([209.85.216.169]:53542 "EHLO mail-qc0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbaA2Ubj (ORCPT ); Wed, 29 Jan 2014 15:31:39 -0500 Received: by mail-qc0-f169.google.com with SMTP id w7so3639822qcr.0 for ; Wed, 29 Jan 2014 12:31:38 -0800 (PST) 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 cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org 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 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.pitre@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 {