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: 3554471 Return-Path: X-Original-To: patchwork-linux-sh@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 8E7289F382 for ; Wed, 29 Jan 2014 20:31:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C86C2018E for ; Wed, 29 Jan 2014 20:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1AE920170 for ; Wed, 29 Jan 2014 20:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbaA2Ubl (ORCPT ); Wed, 29 Jan 2014 15:31:41 -0500 Received: from mail-qc0-f179.google.com ([209.85.216.179]:37631 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbaA2Ubj (ORCPT ); Wed, 29 Jan 2014 15:31:39 -0500 Received: by mail-qc0-f179.google.com with SMTP id e16so3555965qcx.24 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=hOyyIK+Yl7HxrCn3r5c4T2BZvn2LUKIc169JUsT8i5MisrV+EwTyTBmZd4191x1pXq TA3/AFYZ4BgBSzmvgTbemyZvF8XKX4N/f5F4qX+lISmmQ1y0NW3daLHZrzIuZ9eS85UY 4JoiT1MbNMDgixhjb4depyNFoj3JalJSUTWvWoqQWzRpj0JTOqiCKI+1JIAmaxgn9Vuf rK3V27Wo4yrd3Gknx0emDpPD+FoIF+mi4vuGwhUHNDhwCQcxIBjmv+BhgTnXv6+QbAw6 kbhuBVlaPAUWh7nTSXdTv4MbDzsNy7fDwD6wfgqq8BvTU83oL/ew9xGKpSnOmh3MAnMx LymQ== X-Gm-Message-State: ALoCoQlxJ9f+Ia0+rELcF2L4+8x7zj4/CqMXD7PoctZg5HmEK5vZmLAS8qf436HvhHLMchAF00lM 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-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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=ham 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-sh" 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 {