From patchwork Thu Mar 21 12:21:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 15464 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 86CD523E00 for ; Thu, 21 Mar 2013 12:21:39 +0000 (UTC) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by fiordland.canonical.com (Postfix) with ESMTP id 06577A18889 for ; Thu, 21 Mar 2013 12:21:38 +0000 (UTC) Received: by mail-ve0-f181.google.com with SMTP id pa12so811713veb.40 for ; Thu, 21 Mar 2013 05:21:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=dfzYp2+uByQBFJmiUJuLLdJ43h+KuXPaaHi8g3bHWDI=; b=Bq28MMYd3LKZWXreuYmMM8VdgUuGiF8+oMH7iNb37BkeCqnVnZEy48nlT9SMTETZ4N P3vYSBlHY+FzQ0JyWdCeaWZQKMrOibRd6LR8E1Yeujid/XLrl+HVkRzZxqfVLIHvxDes HB63a67beBIPgvUYcp/xClOU4mqHMR3Mn774ryARf+RFe1mehS5uebZsmfFJ+wFgFsOx mWgvwFiVOfVSH0kyQTSaqsHbEamIjJlgp8MwV2yggLlzWuecpbxRjSrt0iOPu29BIQKB /Dw5ml+/aVWLmAraSE8MW6PtwUmMZZBEE4AhmV64mPZ4MTMtttLpU1b4l9G53hsux/ks r41Q== X-Received: by 10.220.154.199 with SMTP id p7mr13094319vcw.46.1363868498465; Thu, 21 Mar 2013 05:21:38 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.233.198 with SMTP id ty6csp57789vec; Thu, 21 Mar 2013 05:21:37 -0700 (PDT) X-Received: by 10.180.84.165 with SMTP id a5mr4603875wiz.6.1363868497220; Thu, 21 Mar 2013 05:21:37 -0700 (PDT) Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]) by mx.google.com with ESMTPS id bs13si1152473wib.80.2013.03.21.05.21.36 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 05:21:37 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=2a00:1450:400c:c03::22f; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by mail-we0-f175.google.com with SMTP id t11so134831wey.6 for ; Thu, 21 Mar 2013 05:21:36 -0700 (PDT) X-Received: by 10.180.10.105 with SMTP id h9mr4257414wib.34.1363868496540; Thu, 21 Mar 2013 05:21:36 -0700 (PDT) Received: from mai.home (AToulouse-654-1-426-131.w2-6.abo.wanadoo.fr. [2.6.209.131]) by mx.google.com with ESMTPS id o8sm4333193wix.7.2013.03.21.05.21.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 05:21:35 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, patches@linaro.org, lenb@kernel.org, linus.walleij@linaro.org, santosh.shilimkar@ti.com, rnayak@ti.com, kernel@pengutronix.de, tglx@linutronix.de Subject: [PATCH 1/4][resend] cpuidle : handle clockevent notify from the cpuidle framework Date: Thu, 21 Mar 2013 13:21:31 +0100 Message-Id: <1363868494-5503-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmvx7BkxBrrgwPxIH0zSZvGAUy2Lkd0AIxjUGIwe8zeEbWqEKe/AigbcQQQwADFSj4qKlSu When a cpu enters a deep idle state, the local timers are stopped and the time framework falls back to the timer device used as a broadcast timer. The different cpuidle drivers are calling clockevents_notify ENTER/EXIT when the idle state stops the local timer. Add a new flag CPUIDLE_FLAG_TIMER_STOP which can be set by the cpuidle drivers. If the flag is set, the cpuidle core code takes care of the notification on behalf of the driver to avoid pointless code duplication. Signed-off-by: Daniel Lezcano Reviewed-by: Thomas Gleixner Cc: Len Brown Cc: Linus Walleij Cc: Santosh Shilimkar Cc: Rajendra Nayak Cc: Sascha Hauer Cc: Thomas Gleixner Acked-by: Santosh Shilimkar Reviewed-by: Kevin Hilman --- drivers/cpuidle/cpuidle.c | 9 +++++++++ include/linux/cpuidle.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index eba6929..c500370 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -8,6 +8,7 @@ * This code is licenced under the GPL. */ +#include #include #include #include @@ -146,12 +147,20 @@ int cpuidle_idle_call(void) trace_cpu_idle_rcuidle(next_state, dev->cpu); + if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, + &dev->cpu); + if (cpuidle_state_is_coupled(dev, drv, next_state)) entered_state = cpuidle_enter_state_coupled(dev, drv, next_state); else entered_state = cpuidle_enter_state(dev, drv, next_state); + if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, + &dev->cpu); + trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); /* give the governor an opportunity to reflect on the outcome */ diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 480c14d..a837b33 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -57,6 +57,7 @@ struct cpuidle_state { /* Idle State Flags */ #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ +#define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)