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: 3554411 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 5EDF49F2E9 for ; Wed, 29 Jan 2014 20:14:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9800320131 for ; Wed, 29 Jan 2014 20:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E42C201B4 for ; Wed, 29 Jan 2014 20:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751633AbaA2UOr (ORCPT ); Wed, 29 Jan 2014 15:14:47 -0500 Received: from mail-qc0-f170.google.com ([209.85.216.170]:47406 "EHLO mail-qc0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbaA2UOq (ORCPT ); Wed, 29 Jan 2014 15:14:46 -0500 Received: by mail-qc0-f170.google.com with SMTP id e9so3580584qcy.15 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=LqoM95odGCXBzuG2LbWon4Kd0TKXjXlXdqfxOnWJjQ1kZw+bKphSpnnFDlvlfojn22 0ybvMRMI44cC5gBpHOeBxQB76b+KlCj+dSg4Mqzt5J+CqktU6gKTAyy/t/Ikps78ZzJ4 /zMxP9UDRNvdW6zb4gvdjdOQcaVLRR0Ttn94wixgyOzZszd9loHqB0RqzfplHQU8lKmh T/Q6WZa8qwGltGBGjmRPGzJJ7d3evUJhw//c0tKyNU0PbsWysy8yhqS8rFCbsGpH69WQ N6fDb+T61zlN2vdVPazoBMpnpVUQzJE1nR9Evwlan38u6xoCEJVjSc5pYf2JBfmkSVGr O6fA== X-Gm-Message-State: ALoCoQld6d2IVL0478qUjZNcUcAtwhsUQ/4LSb3euRAHFffx/Dwq2BT6YuD9CmItg09Q8tGQuNl3 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-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=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-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 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 {