From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Hilman Subject: Re: [PATCH RFC 16/27] ARM: cpuidle: Record the next wakeup event of the CPU Date: Thu, 19 Nov 2015 15:35:47 -0800 Message-ID: <7hwptdsgto.fsf@deeprootsystems.com> References: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> <1447799871-56374-17-git-send-email-lina.iyer@linaro.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1447799871-56374-17-git-send-email-lina.iyer@linaro.org> (Lina Iyer's message of "Tue, 17 Nov 2015 15:37:40 -0700") Sender: linux-pm-owner@vger.kernel.org To: Lina Iyer Cc: ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, geert@linux-m68k.org, k.kozlowski@samsung.com, msivasub@codeaurora.org, agross@codeaurora.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, lorenzo.pieralisi@arm.com, ahaslam@baylibre.com, mtitinger@baylibre.com List-Id: linux-arm-msm@vger.kernel.org Lina Iyer writes: > Reading the next wakeup of the CPU can only be realiably done only from > that CPU. In the idle enter path record the next wake up of the CPU. The > information is useful to determine the sleep time left for the CPU. > > Signed-off-by: Lina Iyer > --- > drivers/cpuidle/cpuidle-arm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > index 8e72a23..b3133ef 100644 > --- a/drivers/cpuidle/cpuidle-arm.c > +++ b/drivers/cpuidle/cpuidle-arm.c > @@ -18,9 +18,11 @@ > #include > #include > #include > +#include > #include > #include > #include > +#include > > #include > > @@ -49,7 +51,9 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > ret = cpu_pm_enter(); > if (!ret) { > struct device *cpu_dev = get_cpu_device(dev->cpu); > + struct generic_pm_domain_data *gpd = dev_gpd_data(cpu_dev); > > + gpd->td.next_wakeup = tick_nohz_get_next_wakeup(); > RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); Maybe set this back to zero atomicaly, after wakeup? Checking for non-zero that might be another way for the domain goveror that there haven't been any CPU wakeups since the CPUs have gone idle. Kevin From mboxrd@z Thu Jan 1 00:00:00 1970 From: khilman@kernel.org (Kevin Hilman) Date: Thu, 19 Nov 2015 15:35:47 -0800 Subject: [PATCH RFC 16/27] ARM: cpuidle: Record the next wakeup event of the CPU In-Reply-To: <1447799871-56374-17-git-send-email-lina.iyer@linaro.org> (Lina Iyer's message of "Tue, 17 Nov 2015 15:37:40 -0700") References: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> <1447799871-56374-17-git-send-email-lina.iyer@linaro.org> Message-ID: <7hwptdsgto.fsf@deeprootsystems.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Lina Iyer writes: > Reading the next wakeup of the CPU can only be realiably done only from > that CPU. In the idle enter path record the next wake up of the CPU. The > information is useful to determine the sleep time left for the CPU. > > Signed-off-by: Lina Iyer > --- > drivers/cpuidle/cpuidle-arm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > index 8e72a23..b3133ef 100644 > --- a/drivers/cpuidle/cpuidle-arm.c > +++ b/drivers/cpuidle/cpuidle-arm.c > @@ -18,9 +18,11 @@ > #include > #include > #include > +#include > #include > #include > #include > +#include > > #include > > @@ -49,7 +51,9 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > ret = cpu_pm_enter(); > if (!ret) { > struct device *cpu_dev = get_cpu_device(dev->cpu); > + struct generic_pm_domain_data *gpd = dev_gpd_data(cpu_dev); > > + gpd->td.next_wakeup = tick_nohz_get_next_wakeup(); > RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); Maybe set this back to zero atomicaly, after wakeup? Checking for non-zero that might be another way for the domain goveror that there haven't been any CPU wakeups since the CPUs have gone idle. Kevin