From: Kevin Hilman <khilman@linaro.org>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
nm@ti.com, tony@atomide.com
Subject: Re: [PATCH v2 17/18] ARM: OMAP4+: CPUidle: Add OMAP5 idle driver support
Date: Thu, 04 Apr 2013 10:55:55 -0700 [thread overview]
Message-ID: <87li8ymb84.fsf@linaro.org> (raw)
In-Reply-To: <515D8B4B.6000800@ti.com> (Santosh Shilimkar's message of "Thu, 4 Apr 2013 19:46:43 +0530")
Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> On Thursday 04 April 2013 02:55 AM, Kevin Hilman wrote:
>> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
>>
>>> The OMAP5 idle driver can re-use OMAP4 CPUidle driver implementation thanks
>>> to compatible MPUSS design.
>>>
>>> Though unlike OMAP4, on OMAP5 devices, MPUSS CSWR (Close Switch
>>> Retention) power states can be achieved with respective power states
>>> on CPU0 and CPU1 power domain. This mode was broken on OMAP4 devices
>>> because of hardware limitation.
>>
>> I'm a bit confused by the description here.
>>
>> I gather from the code that this means that CPU0 and CPU1 can hit CSWR
>> independently, correct?
>>
> They can be programmed independently without any ordering(like
> CPU0 last etc), but the actual transition to the low power CSWR
> happens together. Till that the first CPU hit WFI remains in WFI
> state waiting for other CPU to hit WFI and then both transition
> together.
> Completely managed inside hardware.
OK, elaborating this in the changelog would be helpful. Use the "will I
understand this changelog in a year" rule to see if the changelog is
detailed enough. Or better, "will Kevin understand this changelog in a
year." (hint: the answer is usually no.) ;)
>>> Also there is no CPU low power entry order requirement like
>>> master CPU etc for CSWR C-state, which is icing on the cake.
>>
>> Even on secure devices?
>>
> Yes. On secure devices too. Actually since we don't loose context,
> secure entry/exit doesn't come into picture.
>
>>> Code makes use of voting scheme for cluster low power state to support
>>> MPUSS CSWR C-state.
>>
>> The voting scheme and associated locking should be better described
>> here, or commented in the code itself.
>>
> You are right. It deserves some description.
>
>>> Supported OMAP5 CPUidle C-states:
>>> C1 - CPU0 ON(WFI) + CPU1 ON(WFI) + MPUSS ON
>>> C2 - CPU0 CSWR + CPU1 CSWR + MPUSS CSWR
>>> C3 - CPU0 OFF + CPU1 OFF + MPUSS OSWR
>>>
>>> Acked-by: Nishanth Menon <nm@ti.com>
>>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>
>> [...]
>>
>>> +static int omap_enter_idle_smp(struct cpuidle_device *dev,
>>> + struct cpuidle_driver *drv,
>>> + int index)
>>> +{
>>> + struct idle_statedata *cx = state_ptr + index;
>>> + int cpu_id = smp_processor_id();
>>> + unsigned long flag;
>>> +
>>> + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
>>
>> I think the CPUidle core handles the broadcast notification now.
>>
> Not in mainline yet. And those patches came after my patches and
> I don't wanted un-necessary merge dependency, I avoided it. Its trivial
> though to drop if from here once the idle next is merged.
OK.
I believe that stuff is already queued, no? Maybe ahave this as an
add-on separate patch that can be used for your loal testing, but does
not go upstream.
I would only include this if you're sure the other series is not going
upstream.
>>> + raw_spin_lock_irqsave(&mpu_lock, flag);
>>> + cx->mpu_state_vote++;
>>
>> How about using an atomic_t and atomic_inc()/atomic_dec() instead, which
>> will avoid the need for a spinlock.
>>
> Spin lock is not just for the vote variable. I had atomics opps in first
> version I gave it to product team. But they found a race condition in
> where MPU power state was getting overwritten by other CPU.
>
>> Even with that, it still seems potentially racy. Do you need a memory
>> barrier here to be sure that any changes from another CPU are visible
>> here, and vice versa?
>>
> With locks, you don't need barriers since the updated copy is guaranteed.
It's guaranteed because the spinlock implementation uses barriers.
> Can you please elaborate on potential race ? I have given pretty hard
> thought and didn't see any race which can be exposed with locks in place.
I was referring to using atomic ops. With atomic ops, you'd need an
explicit barrier (which you're getting inside the spinlock
implementation)
That being said, I have not thought through all the corner cases as you
have, so I'll defer to your choice (as long as it's well documented.)
If you decide to stick with spinlocks, be sure to describe all of what
the spinlock is protecting, and why.
Thanks,
Kevin
WARNING: multiple messages have this Message-ID (diff)
From: khilman@linaro.org (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 17/18] ARM: OMAP4+: CPUidle: Add OMAP5 idle driver support
Date: Thu, 04 Apr 2013 10:55:55 -0700 [thread overview]
Message-ID: <87li8ymb84.fsf@linaro.org> (raw)
In-Reply-To: <515D8B4B.6000800@ti.com> (Santosh Shilimkar's message of "Thu, 4 Apr 2013 19:46:43 +0530")
Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> On Thursday 04 April 2013 02:55 AM, Kevin Hilman wrote:
>> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
>>
>>> The OMAP5 idle driver can re-use OMAP4 CPUidle driver implementation thanks
>>> to compatible MPUSS design.
>>>
>>> Though unlike OMAP4, on OMAP5 devices, MPUSS CSWR (Close Switch
>>> Retention) power states can be achieved with respective power states
>>> on CPU0 and CPU1 power domain. This mode was broken on OMAP4 devices
>>> because of hardware limitation.
>>
>> I'm a bit confused by the description here.
>>
>> I gather from the code that this means that CPU0 and CPU1 can hit CSWR
>> independently, correct?
>>
> They can be programmed independently without any ordering(like
> CPU0 last etc), but the actual transition to the low power CSWR
> happens together. Till that the first CPU hit WFI remains in WFI
> state waiting for other CPU to hit WFI and then both transition
> together.
> Completely managed inside hardware.
OK, elaborating this in the changelog would be helpful. Use the "will I
understand this changelog in a year" rule to see if the changelog is
detailed enough. Or better, "will Kevin understand this changelog in a
year." (hint: the answer is usually no.) ;)
>>> Also there is no CPU low power entry order requirement like
>>> master CPU etc for CSWR C-state, which is icing on the cake.
>>
>> Even on secure devices?
>>
> Yes. On secure devices too. Actually since we don't loose context,
> secure entry/exit doesn't come into picture.
>
>>> Code makes use of voting scheme for cluster low power state to support
>>> MPUSS CSWR C-state.
>>
>> The voting scheme and associated locking should be better described
>> here, or commented in the code itself.
>>
> You are right. It deserves some description.
>
>>> Supported OMAP5 CPUidle C-states:
>>> C1 - CPU0 ON(WFI) + CPU1 ON(WFI) + MPUSS ON
>>> C2 - CPU0 CSWR + CPU1 CSWR + MPUSS CSWR
>>> C3 - CPU0 OFF + CPU1 OFF + MPUSS OSWR
>>>
>>> Acked-by: Nishanth Menon <nm@ti.com>
>>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>
>> [...]
>>
>>> +static int omap_enter_idle_smp(struct cpuidle_device *dev,
>>> + struct cpuidle_driver *drv,
>>> + int index)
>>> +{
>>> + struct idle_statedata *cx = state_ptr + index;
>>> + int cpu_id = smp_processor_id();
>>> + unsigned long flag;
>>> +
>>> + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
>>
>> I think the CPUidle core handles the broadcast notification now.
>>
> Not in mainline yet. And those patches came after my patches and
> I don't wanted un-necessary merge dependency, I avoided it. Its trivial
> though to drop if from here once the idle next is merged.
OK.
I believe that stuff is already queued, no? Maybe ahave this as an
add-on separate patch that can be used for your loal testing, but does
not go upstream.
I would only include this if you're sure the other series is not going
upstream.
>>> + raw_spin_lock_irqsave(&mpu_lock, flag);
>>> + cx->mpu_state_vote++;
>>
>> How about using an atomic_t and atomic_inc()/atomic_dec() instead, which
>> will avoid the need for a spinlock.
>>
> Spin lock is not just for the vote variable. I had atomics opps in first
> version I gave it to product team. But they found a race condition in
> where MPU power state was getting overwritten by other CPU.
>
>> Even with that, it still seems potentially racy. Do you need a memory
>> barrier here to be sure that any changes from another CPU are visible
>> here, and vice versa?
>>
> With locks, you don't need barriers since the updated copy is guaranteed.
It's guaranteed because the spinlock implementation uses barriers.
> Can you please elaborate on potential race ? I have given pretty hard
> thought and didn't see any race which can be exposed with locks in place.
I was referring to using atomic ops. With atomic ops, you'd need an
explicit barrier (which you're getting inside the spinlock
implementation)
That being said, I have not thought through all the corner cases as you
have, so I'll defer to your choice (as long as it's well documented.)
If you decide to stick with spinlocks, be sure to describe all of what
the spinlock is protecting, and why.
Thanks,
Kevin
next prev parent reply other threads:[~2013-04-04 17:55 UTC|newest]
Thread overview: 128+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 10:04 [PATCH v2 00/18] ARM: OMAP5: PM: Add MPUSS suspend and CPUidle support Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 01/18] ARM: OMAP4+: PM: Consolidate MPU subsystem PM code for re-use Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-04-03 19:44 ` Kevin Hilman
2013-04-03 19:44 ` Kevin Hilman
2013-04-04 11:32 ` Santosh Shilimkar
2013-04-04 11:32 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 02/18] ARM: OMAP5: PM: Update CPU context register offset Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 03/18] ARM: OMAP4+: PM: Consolidate and use OMAP4 PM code for OMAP5 Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-04-03 20:20 ` Kevin Hilman
2013-04-03 20:20 ` Kevin Hilman
2013-04-04 11:51 ` Santosh Shilimkar
2013-04-04 11:51 ` Santosh Shilimkar
2013-04-04 11:55 ` Santosh Shilimkar
2013-04-04 11:55 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 04/18] ARM: OMAP5: PM: Set MPUSS-EMIF clock-domain static dependency Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 05/18] ARM: OMAP5: PM: Enables ES2 PM mode by default Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-04-03 20:25 ` Kevin Hilman
2013-04-03 20:25 ` Kevin Hilman
2013-04-04 12:02 ` Santosh Shilimkar
2013-04-04 12:02 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 06/18] ARM: OMAP5: PM: Enable Mercury retention mode on CPUx powerdomains Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-04-03 20:31 ` Kevin Hilman
2013-04-03 20:31 ` Kevin Hilman
2013-04-04 12:08 ` Santosh Shilimkar
2013-04-04 12:08 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 07/18] ARM: OMAP5: Add init_late() hook to enable pm initialization Santosh Shilimkar
2013-03-25 10:04 ` Santosh Shilimkar
2013-04-03 20:33 ` Kevin Hilman
2013-04-03 20:33 ` Kevin Hilman
2013-04-04 12:28 ` Santosh Shilimkar
2013-04-04 12:28 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 08/18] ARM: OMAP5: PM: Add CPU power off in hotplug path Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 20:49 ` Kevin Hilman
2013-04-03 20:49 ` Kevin Hilman
2013-04-04 13:23 ` Santosh Shilimkar
2013-04-04 13:23 ` Santosh Shilimkar
2013-04-04 17:31 ` Kevin Hilman
2013-04-04 17:31 ` Kevin Hilman
2013-04-05 9:04 ` Santosh Shilimkar
2013-04-05 9:04 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 09/18] ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 20:54 ` Kevin Hilman
2013-04-03 20:54 ` Kevin Hilman
2013-04-04 13:37 ` Santosh Shilimkar
2013-04-04 13:37 ` Santosh Shilimkar
2013-04-04 17:42 ` Kevin Hilman
2013-04-04 17:42 ` Kevin Hilman
2013-04-05 9:07 ` Santosh Shilimkar
2013-04-05 9:07 ` Santosh Shilimkar
2013-04-05 11:58 ` Santosh Shilimkar
2013-04-05 11:58 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 10/18] ARM: OMAP5: PM: Add MPU Open Switch Retention support Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 11/18] ARM: OMAP5: PM: Add L2 memory power down support Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 20:58 ` Kevin Hilman
2013-04-03 20:58 ` Kevin Hilman
2013-04-04 13:46 ` Santosh Shilimkar
2013-04-04 13:46 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 12/18] ARM: OMAP4: CPUidle: Avoid double idle driver registration Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:03 ` Kevin Hilman
2013-04-03 21:03 ` Kevin Hilman
2013-04-04 13:47 ` Santosh Shilimkar
2013-04-04 13:47 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 13/18] ARM: OMAP: CPUidle: Unregister drivere on device registration failure Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:03 ` Kevin Hilman
2013-04-03 21:03 ` Kevin Hilman
2013-04-04 13:48 ` Santosh Shilimkar
2013-04-04 13:48 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 14/18] ARM: OMAP4: CPUidle: Make C-state description field more precise Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:05 ` Kevin Hilman
2013-04-03 21:05 ` Kevin Hilman
2013-04-04 13:48 ` Santosh Shilimkar
2013-04-04 13:48 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 15/18] ARM: OMAP4+: CPUidle: Consolidate idle driver for OMAP5 support Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:10 ` Kevin Hilman
2013-04-03 21:10 ` Kevin Hilman
2013-04-04 14:04 ` Santosh Shilimkar
2013-04-04 14:04 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 16/18] ARM: OMAP4+: CPUidle: Deprecate use of omap4_mpuss_read_prev_context_state() Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:37 ` Kevin Hilman
2013-04-03 21:37 ` Kevin Hilman
2013-04-04 13:59 ` Santosh Shilimkar
2013-04-04 13:59 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 17/18] ARM: OMAP4+: CPUidle: Add OMAP5 idle driver support Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-04-03 21:25 ` Kevin Hilman
2013-04-03 21:25 ` Kevin Hilman
2013-04-04 14:16 ` Santosh Shilimkar
2013-04-04 14:16 ` Santosh Shilimkar
2013-04-04 17:55 ` Kevin Hilman [this message]
2013-04-04 17:55 ` Kevin Hilman
2013-04-05 9:41 ` Santosh Shilimkar
2013-04-05 9:41 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 18/18] ARM: OMAP5: PM: handle device instance for warm reset Santosh Shilimkar
2013-03-25 10:05 ` Santosh Shilimkar
2013-03-25 11:46 ` [PATCH v2 00/18] ARM: OMAP5: PM: Add MPUSS suspend and CPUidle support Lokesh Vutla
2013-03-25 11:46 ` Lokesh Vutla
2013-03-25 12:10 ` Santosh Shilimkar
2013-03-25 12:10 ` Santosh Shilimkar
2013-03-25 12:27 ` Sourav Poddar
2013-03-25 12:27 ` Sourav Poddar
2013-03-25 12:47 ` Rajendra Nayak
2013-03-25 12:47 ` Rajendra Nayak
2013-03-25 13:00 ` Sourav Poddar
2013-03-25 13:00 ` Sourav Poddar
2013-04-03 22:52 ` Kevin Hilman
2013-04-03 22:52 ` Kevin Hilman
2013-04-04 14:34 ` Santosh Shilimkar
2013-04-04 14:34 ` Santosh Shilimkar
2013-04-04 16:49 ` Santosh Shilimkar
2013-04-04 16:49 ` Santosh Shilimkar
2013-04-04 17:57 ` Kevin Hilman
2013-04-04 17:57 ` Kevin Hilman
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=87li8ymb84.fsf@linaro.org \
--to=khilman@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.com \
/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.