From patchwork Wed Jan 29 20:14:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 23897 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D65ED202FA for ; Wed, 29 Jan 2014 20:14:48 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp4sf7657202obc.5 for ; Wed, 29 Jan 2014 12:14:47 -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=q08Y7BtMpBR+ZQ2RjmsL+wXPLdNVuebC8iPh+8BmV0Y=; b=K1/8+P9QovOs43kRTsA699YZepqntofGGxxmRZCGgq/5bOULm3aRrh/E98iE8lEftU GUukffoj1lreXaOcg3HndAYa65OMcb4chcQ3nSk1+PERzUaPgRuirzdw0tzrottcjDzK 5EjaEQvF5CbpiAC7HrP/QmiirlqIj5Nzn0A+tbt20PYICxvzYL+ePqInf5uRH/fA1mfz aqMti0thk/qWJAOi3O/cSQ5Gliv9kLFGPzCz0ApGfORpq0vls0Dn2a/Ss8+TCAEAoWoF bcbN3hwa9X3cwVkOVydCOelrrsXNAIHzG1qWPVC3RIjrPjnla+i9sHyy0BL/rg2iDkez rtYg== X-Gm-Message-State: ALoCoQnWiMQ9eHLusXTkdOnUVx1DDxmQWB2sebqFMqm3jrvVoHse3mzq4UMrS2jRFSlISQeLYgnV X-Received: by 10.50.18.49 with SMTP id t17mr12872845igd.3.1391026487777; Wed, 29 Jan 2014 12:14:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.37 with SMTP id u34ls311835qgu.37.gmail; Wed, 29 Jan 2014 12:14:47 -0800 (PST) X-Received: by 10.58.132.203 with SMTP id ow11mr8329097veb.1.1391026487696; Wed, 29 Jan 2014 12:14:47 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id y6si1129080veb.63.2014.01.29.12.14.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 12:14:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if11so1472216vcb.36 for ; Wed, 29 Jan 2014 12:14:47 -0800 (PST) X-Received: by 10.53.13.44 with SMTP id ev12mr6898179vdd.17.1391026487601; Wed, 29 Jan 2014 12:14:47 -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 u4csp142895vcz; Wed, 29 Jan 2014 12:14:47 -0800 (PST) X-Received: by 10.68.143.34 with SMTP id sb2mr531985pbb.135.1391026486512; Wed, 29 Jan 2014 12:14:46 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ln7si3772837pab.178.2014.01.29.12.14.45; Wed, 29 Jan 2014 12:14:45 -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 S1751134AbaA2UOo (ORCPT + 11 others); Wed, 29 Jan 2014 15:14:44 -0500 Received: from mail-qc0-f171.google.com ([209.85.216.171]:60889 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750884AbaA2UOn (ORCPT ); Wed, 29 Jan 2014 15:14:43 -0500 Received: by mail-qc0-f171.google.com with SMTP id n7so3599128qcx.30 for ; Wed, 29 Jan 2014 12:14:43 -0800 (PST) X-Received: by 10.224.11.197 with SMTP id u5mr15860411qau.4.1391026483162; Wed, 29 Jan 2014 12:14:43 -0800 (PST) Received: from xanadu.home (modemcable177.143-130-66.mc.videotron.ca. [66.130.143.177]) by mx.google.com with ESMTPSA id l40sm5002011qga.13.2014.01.29.12.14.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 12:14:41 -0800 (PST) Date: Wed, 29 Jan 2014 15:14:40 -0500 (EST) From: Nicolas Pitre To: Olof Johansson cc: Russell King , Benjamin Herrenschmidt , Preeti U Murthy , Paul Mundt , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , "Rafael J. Wysocki" , Daniel Lezcano , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , linuxppc-dev , Linux-sh list , linux-pm@vger.kernel.org, "linaro-kernel@lists.linaro.org" Subject: Re: [PATCH v2 5/6] X86: remove redundant cpuidle_idle_call() In-Reply-To: Message-ID: References: <1391017513-12995-1-git-send-email-nicolas.pitre@linaro.org> <1391017513-12995-6-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.220.177 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, Olof Johansson wrote: > Hi, > > On Wed, Jan 29, 2014 at 9:45 AM, Nicolas Pitre wrote: > > The core idle loop now takes care of it. > > > > Signed-off-by: Nicolas Pitre > > Acked-by: Daniel Lezcano > > --- > > arch/x86/kernel/process.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c > > index 3fb8d95ab8..4505e2a950 100644 > > --- a/arch/x86/kernel/process.c > > +++ b/arch/x86/kernel/process.c > > @@ -298,10 +298,7 @@ void arch_cpu_idle_dead(void) > > */ > > void arch_cpu_idle(void) > > { > > - if (cpuidle_idle_call()) > > - x86_idle(); > > - else > > - local_irq_enable(); > > + x86_idle(); > > You're taking out the local_irq_enable() here but I don't see the > equivalent of adding it back in the 1/6 patch that moves the > cpuidle_idle_call() up to common code. It seems that one of the call > paths through cpuidle_idle_call() don't re-enable it on its own. When cpuidle_idle_call() returns non-zero, IRQs are left disabled. When it returns zero then IRQs should be disabled. Same goes for cpuidle drivers. That's the theory at least. Looking into some cpuidle drivers for x86 I found at least one that doesn't respect this convention. Damn. > Even if this is the right thing to do, why it's OK to do so should > probably be documented in the patch description. Better yet, I'm going to amend patch 1/6 with the below to make things more reliable while still identifying misbehaving drivers. --- 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 ffcd3ee9af..14ca43430a 100644 --- a/kernel/cpu/idle.c +++ b/kernel/cpu/idle.c @@ -98,7 +98,8 @@ static void cpu_idle_loop(void) rcu_idle_enter(); if (cpuidle_idle_call()) arch_cpu_idle(); - WARN_ON_ONCE(irqs_disabled()); + if (WARN_ON_ONCE(irqs_disabled())) + local_irq_enable(); rcu_idle_exit(); start_critical_timings(); } else {