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: 3554481 Return-Path: X-Original-To: patchwork-linux-pm@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 E96419F39B for ; Wed, 29 Jan 2014 20:31:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B8DE20170 for ; Wed, 29 Jan 2014 20:31:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A0B220181 for ; Wed, 29 Jan 2014 20:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751690AbaA2Ubl (ORCPT ); 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-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=Ds8rPjiy6s6b8rzyhQ+XS86hN18dpeYQMI84XXMz8np0JMkHdoJm6F+qSKu5u2mM4s RSOjF/GjIv8eqc597ZDo2DCjJPIRzBVveQOKLk3niTSaS/D3c7gzEca6deTTw/q1zwa+ 4fyO7xjpvOBXGhCcXFvMhBkyHZPxQGe3jsTU8P1WPs5bDrCxKA0SMiW27a0iZwTMg4dZ rIA3DypkgHQKRbzMm2D7wAkWJ5+a4/Rjs8LrLilWoe6wcT7ZASAVfNFnKm9AoGizBb5p NZPcvL3hsCvK4tCfNVz2aEG/I2LC1tS2dayv6+M4DycOwDoWYZdVbupGbPo3et2GnYp5 Funw== X-Gm-Message-State: ALoCoQmIRoUs3ToakELrrEKRtLWSAa4IrjDUpgDQDJIxRY0fFJ511Vfm8LojzWu1YRAY+q9EQ/5y 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: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 --- 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 {