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: 3554401 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E671EC02DC for ; Wed, 29 Jan 2014 20:14:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F33832018E for ; Wed, 29 Jan 2014 20:14:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2AE320131 for ; Wed, 29 Jan 2014 20:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751134AbaA2UOo (ORCPT ); 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-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=dcfer4Sj2bhJp6+ijk4s1vEtJnkd3gegvquxkwc80nRdbC+AIcLcVifQvzAesYuE9Z wboT6rbEpTtCNo7wHWLklrDIk5fRFV3EpfRqQP9OUrAY2FymG6DCN6lDbiJnKZGbe7bn JlCmqdOglntRZX3HxUptrdhaAg57HMEeqbqkJ7O7BunLR82h7f03IeKHmJlIPatk45Bs IaHX18c5zpoUYFPgLcPS6fKXro4TNFDl4IVdXvWVmQn//F6J/AjulQHagi0jpETZ27cH GnDGsm4aFO1mjscO6ry7eVAFCVnO5KHonU35J5/Y5yldT+5WsDKjkNq5z98tza9GVVjQ le2A== X-Gm-Message-State: ALoCoQmtQRQS0t2wfH88j5PY/0keygUUR4AYPDs3oJZgrOGqCyqTnBPgA9qjbEtoEIsUMvwX6iyJ 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: 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, 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 {