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: 315210 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 4156E2C014B for ; Thu, 30 Jan 2014 07:15:18 +1100 (EST) Received: from mail-qc0-f176.google.com (mail-qc0-f176.google.com [209.85.216.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B05052C00BF for ; Thu, 30 Jan 2014 07:14:47 +1100 (EST) Received: by mail-qc0-f176.google.com with SMTP id e16so3570657qcx.35 for ; Wed, 29 Jan 2014 12:14:43 -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=YbFFwEeLcqcb4oVJN/VIY5FAICcSUv98t8zlMoSvqSo=; b=JnbPgtao8TpfoKCRfVnPcu+N28OXoX3FTNFUg5r6r5/ubYooWV3c7CPD/XyW9K9sRA XvyDl1+q5kI/vvHJf67M9DI1/pMlDw+OjfRYx5kMEXXGrM/1pp+h2dEGiMvXacSL3YU1 UP4znxkRlBBXTmcuRVJb9zAkp2v2+EQQcXBZ9ccVIMgK5U6+KiSfqKljmI23k+6SHrTu DII9yw1lV7mjzFDzyP4ImDWSmIvAeo0tXQvrPCJCiWK/uyzSGilcv7xKQJFLY+GVtC6W ukyo33gHUY5nZqik2HdzoY1oqyducjNXik9iIkr7sotDbOV77gCzNZnUPm8bF+QdW1iN h7zA== X-Gm-Message-State: ALoCoQlRwsLzxlN9XcMcfdw311vd+T0BU9WZWii3MadnLTMh1UsBeUXadc2ZFr0cyUOHToLe2Qvs 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 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 Cc: "linaro-kernel@lists.linaro.org" , Russell King , Linux-sh list , Peter Zijlstra , linux-pm@vger.kernel.org, Daniel Lezcano , "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" , Paul Mundt , Preeti U Murthy , Thomas Gleixner , linuxppc-dev , Ingo Molnar , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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. 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 {