From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH V2 3/3] ARM: tegra114: cpuidle: add powered-down state
Date: Thu, 13 Jun 2013 17:02:34 +0200 [thread overview]
Message-ID: <51B9DF0A.3020001@linaro.org> (raw)
In-Reply-To: <1371133960.1631.13.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
On 06/13/2013 04:32 PM, Joseph Lo wrote:
> On Thu, 2013-06-13 at 17:30 +0800, Daniel Lezcano wrote:
>> On 06/13/2013 04:13 AM, Joseph Lo wrote:
>>> On Thu, 2013-06-13 at 01:41 +0800, Stephen Warren wrote:
>>>> On 06/04/2013 03:40 PM, Daniel Lezcano wrote:
>>>>> On 06/04/2013 12:48 PM, Joseph Lo wrote:
>>>>>> This supports CPU core power down on each CPU when CPU idle. When CPU go
>>>>>> into this state, it saves it's context and needs a proper configuration
>>>>>> in flow controller to power gate the CPU when CPU runs into WFI
>>>>>> instruction. And the CPU also needs to set the IRQ as CPU power down idle
>>>>>> wake up event in flow controller.
>>>>>>
>>>>>> Signed-off-by: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>
>>>>> I would like to understand why there is a WARN with the
>>>>> CPUIDLE_FLAG_TIMER_STOP flag set before queuing this patch and ensure it
>>>>> is not the tree hiding the forest.
>>>>
>>>> Joseph, are you planning to post an updated series or respond to resolve
>>>> Daniel's question?
>>>
>>> I need more time to investigate the detail about what caused the WARN
>>> when apply the flag. And what's the difference if we didn't enable
>>> CONFIG_CPU_IDLE_MULTIPLE_DRIVERS, then it only applies
>>> CLOCK_EVT_NOTIFY_BROADCAST_ON on CPU0.
>>
>> I think I got it for this one. It is a bug in the cpuidle driver's code.
>>
>> cpuidle_register_driver does get_cpu => CPU0
>>
>> Then __cpuidle_register_driver(drv, <CPU0>)
>>
>> => __cpuidle_driver_init(drv, <CPU0>)
>>
>> Hence, the timer broadcast is initialized only for cpu0.
>>
>> That should have been fixed with:
>>
> OK, thanks.
>
>> commit 82467a5a885ddd9f80309682159da8db510e7832
>> Author: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> Date: Fri Jun 7 21:53:09 2013 +0000
>>
>> cpuidle: simplify multiple driver support
>>
>> Commit bf4d1b5 (cpuidle: support multiple drivers) introduced support
>> for using multiple cpuidle drivers at the same time. It added a
>> couple of new APIs to register the driver per CPU, but that led to
>> some unnecessary code complexity related to the kernel config options
>> deciding whether or not the multiple driver support is enabled. The
>> code has to work as it did before when the multiple driver support is
>> not enabled and the multiple driver support has to be compatible with
>> the previously existing API.
>>
>> Remove the new API, not used by any driver in the tree yet (but
>> needed for the HMP cpuidle drivers that will be submitted soon), and
>> add a new cpumask pointer to the cpuidle driver structure that will
>> point to the mask of CPUs handled by the given driver. That will
>> allow the cpuidle_[un]register_driver() API to be used for the
>> multiple driver support along with the cpuidle_[un]register()
>> functions added recently.
>>
>> [rjw: Changelog]
>> Signed-off-by: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>
>>
>>> Why if I am moving the
>>> clockevent_notify of CLOCK_EVT_NOTIFY_BROADCAST_EXIT before
>>> "local_irq_enable" in the
>>> "cpuidle_enter_state" (drivers/cpuidle/cpuidle.c), then the warning
>>> message gone?
>>
>> Is the warning coming immediately, at the first time
>> CLOCK_EVT_NOTIFY_BROADCAST_EXIT is invoked or can it occur at different
>> moment ?
>>
> Not exactly at the 1st time, it may happen in the 3rd to 10th time. But
> it only happens once. I mean I did check the
> tick_broadcast_pending_mask, it only happens once the CPU didn't clear
> the tick_broadcast_pending_mask after CLOCK_EVT_NOTIFY_BROADCAST_EXIT.
> And cause the warning message. Then I didn't see it happen anymore.
I suspect when the CLOCK_EVENT_NOTIFY_EXIT is after the
local_irq_enable, we have the timer handler executed before where it
sets the tick_broadcast_pending_mask.
Hence in the tick_broadcast_oneshot_control function when we fall into
the condition:
if (dev->next_event.tv64 == KTIME_MAX)
goto out;
The tick_broadcast_pending_mask is not cleared and when re-entering with
CLOCK_EVENT_NOTIFY_ENTER, this mask is set and that raises the warning.
So, if I am not wrong, the condition to raise this warning would be:
1. use the flag (of course), because the
CLOCK_EVT_NOTIFY_BROADCAST_EXIT is called after the local_irq_enabled
2. there is no timer planned after the expired one.
3. a new timer is created and the cpu enters the low power state again
The first step would be to create a simple program to reproduce easily
the warning.
First boot the kernel with init=/bin/bash (or whatever, the init process
is replaced by a shell), thus reducing considerably the number of timers.
Then try to raise the warning with cpu2:
taskset 4 /bin/sleep 0.5
... several times until the warning appears.
As I don't have the hardware, this is based on assumptions, so may be I
am wrong.
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
WARNING: multiple messages have this Message-ID (diff)
From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 3/3] ARM: tegra114: cpuidle: add powered-down state
Date: Thu, 13 Jun 2013 17:02:34 +0200 [thread overview]
Message-ID: <51B9DF0A.3020001@linaro.org> (raw)
In-Reply-To: <1371133960.1631.13.camel@jlo-ubuntu-64.nvidia.com>
On 06/13/2013 04:32 PM, Joseph Lo wrote:
> On Thu, 2013-06-13 at 17:30 +0800, Daniel Lezcano wrote:
>> On 06/13/2013 04:13 AM, Joseph Lo wrote:
>>> On Thu, 2013-06-13 at 01:41 +0800, Stephen Warren wrote:
>>>> On 06/04/2013 03:40 PM, Daniel Lezcano wrote:
>>>>> On 06/04/2013 12:48 PM, Joseph Lo wrote:
>>>>>> This supports CPU core power down on each CPU when CPU idle. When CPU go
>>>>>> into this state, it saves it's context and needs a proper configuration
>>>>>> in flow controller to power gate the CPU when CPU runs into WFI
>>>>>> instruction. And the CPU also needs to set the IRQ as CPU power down idle
>>>>>> wake up event in flow controller.
>>>>>>
>>>>>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>>>>>
>>>>> I would like to understand why there is a WARN with the
>>>>> CPUIDLE_FLAG_TIMER_STOP flag set before queuing this patch and ensure it
>>>>> is not the tree hiding the forest.
>>>>
>>>> Joseph, are you planning to post an updated series or respond to resolve
>>>> Daniel's question?
>>>
>>> I need more time to investigate the detail about what caused the WARN
>>> when apply the flag. And what's the difference if we didn't enable
>>> CONFIG_CPU_IDLE_MULTIPLE_DRIVERS, then it only applies
>>> CLOCK_EVT_NOTIFY_BROADCAST_ON on CPU0.
>>
>> I think I got it for this one. It is a bug in the cpuidle driver's code.
>>
>> cpuidle_register_driver does get_cpu => CPU0
>>
>> Then __cpuidle_register_driver(drv, <CPU0>)
>>
>> => __cpuidle_driver_init(drv, <CPU0>)
>>
>> Hence, the timer broadcast is initialized only for cpu0.
>>
>> That should have been fixed with:
>>
> OK, thanks.
>
>> commit 82467a5a885ddd9f80309682159da8db510e7832
>> Author: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Date: Fri Jun 7 21:53:09 2013 +0000
>>
>> cpuidle: simplify multiple driver support
>>
>> Commit bf4d1b5 (cpuidle: support multiple drivers) introduced support
>> for using multiple cpuidle drivers at the same time. It added a
>> couple of new APIs to register the driver per CPU, but that led to
>> some unnecessary code complexity related to the kernel config options
>> deciding whether or not the multiple driver support is enabled. The
>> code has to work as it did before when the multiple driver support is
>> not enabled and the multiple driver support has to be compatible with
>> the previously existing API.
>>
>> Remove the new API, not used by any driver in the tree yet (but
>> needed for the HMP cpuidle drivers that will be submitted soon), and
>> add a new cpumask pointer to the cpuidle driver structure that will
>> point to the mask of CPUs handled by the given driver. That will
>> allow the cpuidle_[un]register_driver() API to be used for the
>> multiple driver support along with the cpuidle_[un]register()
>> functions added recently.
>>
>> [rjw: Changelog]
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>>
>>> Why if I am moving the
>>> clockevent_notify of CLOCK_EVT_NOTIFY_BROADCAST_EXIT before
>>> "local_irq_enable" in the
>>> "cpuidle_enter_state" (drivers/cpuidle/cpuidle.c), then the warning
>>> message gone?
>>
>> Is the warning coming immediately, at the first time
>> CLOCK_EVT_NOTIFY_BROADCAST_EXIT is invoked or can it occur at different
>> moment ?
>>
> Not exactly at the 1st time, it may happen in the 3rd to 10th time. But
> it only happens once. I mean I did check the
> tick_broadcast_pending_mask, it only happens once the CPU didn't clear
> the tick_broadcast_pending_mask after CLOCK_EVT_NOTIFY_BROADCAST_EXIT.
> And cause the warning message. Then I didn't see it happen anymore.
I suspect when the CLOCK_EVENT_NOTIFY_EXIT is after the
local_irq_enable, we have the timer handler executed before where it
sets the tick_broadcast_pending_mask.
Hence in the tick_broadcast_oneshot_control function when we fall into
the condition:
if (dev->next_event.tv64 == KTIME_MAX)
goto out;
The tick_broadcast_pending_mask is not cleared and when re-entering with
CLOCK_EVENT_NOTIFY_ENTER, this mask is set and that raises the warning.
So, if I am not wrong, the condition to raise this warning would be:
1. use the flag (of course), because the
CLOCK_EVT_NOTIFY_BROADCAST_EXIT is called after the local_irq_enabled
2. there is no timer planned after the expired one.
3. a new timer is created and the cpu enters the low power state again
The first step would be to create a simple program to reproduce easily
the warning.
First boot the kernel with init=/bin/bash (or whatever, the init process
is replaced by a shell), thus reducing considerably the number of timers.
Then try to raise the warning with cpu2:
taskset 4 /bin/sleep 0.5
... several times until the warning appears.
As I don't have the hardware, this is based on assumptions, so may be I
am wrong.
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2013-06-13 15:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 10:47 [PATCH V2 0/3] ARM: tegra114: cpuidle: add power down state Joseph Lo
2013-06-04 10:47 ` Joseph Lo
[not found] ` <1370342880-422-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-04 10:47 ` [PATCH V2 1/3] ARM: tegra114: Reprogram GIC CPU interface to bypass IRQ on CPU PM entry Joseph Lo
2013-06-04 10:47 ` Joseph Lo
2013-06-04 10:47 ` [PATCH V2 2/3] ARM: tegra114: add low level support for CPU idle powered-down mode Joseph Lo
2013-06-04 10:47 ` Joseph Lo
2013-06-04 10:48 ` [PATCH V2 3/3] ARM: tegra114: cpuidle: add powered-down state Joseph Lo
2013-06-04 10:48 ` Joseph Lo
[not found] ` <1370342880-422-4-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-04 21:40 ` Daniel Lezcano
2013-06-04 21:40 ` Daniel Lezcano
[not found] ` <51AE5EE3.3010607-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-12 17:41 ` Stephen Warren
2013-06-12 17:41 ` Stephen Warren
[not found] ` <51B8B2C8.1090006-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-06-13 2:13 ` Joseph Lo
2013-06-13 2:13 ` Joseph Lo
[not found] ` <1371089619.1681.21.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
2013-06-13 9:30 ` Daniel Lezcano
2013-06-13 9:30 ` Daniel Lezcano
[not found] ` <51B99151.5010107-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-13 14:32 ` Joseph Lo
2013-06-13 14:32 ` Joseph Lo
[not found] ` <1371133960.1631.13.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org>
2013-06-13 15:02 ` Daniel Lezcano [this message]
2013-06-13 15:02 ` Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51B9DF0A.3020001@linaro.org \
--to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.