linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jon-hunter@ti.com>
To: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	rnayak@ti.com, linux-arm <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] ARM: OMAP2+: Only write the sysconfig on idle when necessary
Date: Wed, 17 Oct 2012 15:37:09 -0500	[thread overview]
Message-ID: <507F16F5.9020803@ti.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1210172023130.9767@utopia.booyaka.com>


On 10/17/2012 03:25 PM, Paul Walmsley wrote:
> cc Rajendra
> 
> Hi Jon
> 
> On Wed, 17 Oct 2012, Jon Hunter wrote:
> 
>> Currently, whenever we idle a device _idle_sysc() is called and writes to the
>> devices SYSCONFIG register to set the idle mode. A lot devices are using the
>> smart-idle mode and so the write to the SYSCONFIG register is programming the
>> same value that is already stored in the register.
>>
>> Writes to the devices SYSCONFIG register can be slow, for example, writing to
>> the DMTIMER SYSCONFIG register takes 3 interface clock cycles and 3 functional
>> clock cycles. If the DMTIMER is using the slow 32kHz functional clock this can
>> take ~100us.
>>
>> Furthermore, during boot on an OMAP4430 panda board, I see that there are 100
>> calls to _idle_sysc(), however, only 3 out of the 100 calls actually write
>> the SYSCONFIG register with a new value.
>>
>> Therefore, to avoid unnecessary writes to device SYSCONFIG registers when
>> idling the device, only write the value if the value has changed. It should be
>> safe to do this on idle as the context of the register will never be lost while
>> the device is active.
>>
>> Verified that suspend, CORE off and retention states are working with this
>> change on OMAP3430 Beagle board.
> 
> The code used to do what you propose in _write_sysconfig(), which applied 
> to all sysconfig writes, not just idle.  But it was changed by commit 
> 233cbe5b94096f95ba7bca2162d63275b0b90b5b ("OMAP2+: hwmod: Update the 
> sysc_cache in case module context is lost"). Could you take a look at
> this and maybe discuss it with Rajendra?  It seems to make more sense to 
> me to cache it by default, and only invalidate it when we know that 
> context is lost.

Ok, thanks. Yes, only updating the register when the cache value changed
would not work due to the possibility of context being lost. So
Rajendra's change makes sense. However, I think there is room to
optimise this.

With this change, on idle, the cache value and register value are only
updated when needed. This should be safe.

Are you looking to go one step further and only update the sysconfig on
enabling when the context has been lost? That would require more
changes. This was a quick optimisation I saw when reviewing the code.

Rajendra, let me know if you have any comments.

Cheers
Jon

  reply	other threads:[~2012-10-17 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 20:12 [PATCH] ARM: OMAP2+: Only write the sysconfig on idle when necessary Jon Hunter
2012-10-17 20:25 ` Paul Walmsley
2012-10-17 20:37   ` Jon Hunter [this message]
2012-10-17 20:58     ` Paul Walmsley
2012-10-17 21:22       ` Jon Hunter
2012-10-18  5:49     ` Rajendra Nayak

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=507F16F5.9020803@ti.com \
    --to=jon-hunter@ti.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=rnayak@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).