All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: context_loss_count error value
Date: Wed, 18 May 2011 16:24:28 +0200	[thread overview]
Message-ID: <877h9ot7c3.fsf@ti.com> (raw)
In-Reply-To: <1305718422.1834.23.camel@deskari> (Tomi Valkeinen's message of "Wed, 18 May 2011 14:33:42 +0300")

Tomi Valkeinen <tomi.valkeinen@ti.com> writes:

> On Wed, 2011-05-18 at 12:50 +0200, Kevin Hilman wrote:
>> Tomi Valkeinen <tomi.valkeinen@ti.com> writes:
>> 
>> > Hi Kevin,
>> >
>> > I was fixing DSS context loss handling which is a bit broken, and while
>> > testing on OMAP3 Overo, with -rc7 and omap2plus_defconfig, I noticed
>> > that get_context_loss_count() seems to always return 0.
>> >
>> > 0 should be returned when an error happens, and as far as I see in
>> > pwrdm_get_context_loss_count(), no error is happening but the DSS
>> > context has just never been lost and the returned count is thus 0.
>> >
>> > Is this correct? And what happens when the count wraps and goes back to
>> > zero, does the function return 0 in that case?
>> 
>> Hmm, you're right.  zero is actually documented as the error return
>> value (even though it's not really checked.)
>> 
>> Since driver's should only every care about the *difference* in value
>> between two calls to context_loss_count(), this might not be a big deal,
>> but a proper fix is probably to have the state counters start at one.
>
> But if there happens an error in get_context_loss_count(), for whatever
> reason, I'd guess it's safer from the driver's perspective to assume
> that a context restore _is_ needed. If the driver handles zero value as
> a normal return value, it would mean that the driver never restores
> context if get_context_loss_count() returns 0 for all calls.

Looking closer at the code, a zero return happens only when

1) no hwmod associated to omap_device
2) no power domain associated to hwmod
3) power domain has not (yet) lost context

None of these are actually error conditions per-se, and in all cases, it
indidates that context has not been lost (or we can't tell if context
has been lost.) 

So I think the current code is correct.

Are you finding a case where HW context has actually been lost and the
powerdomain context loss is still at zero?

Kevin




  reply	other threads:[~2011-05-18 14:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18  7:40 context_loss_count error value Tomi Valkeinen
2011-05-18 10:50 ` Kevin Hilman
2011-05-18 11:33   ` Tomi Valkeinen
2011-05-18 14:24     ` Kevin Hilman [this message]
2011-05-18 14:41       ` Tomi Valkeinen
2011-05-24 15:47         ` Tomi Valkeinen
2011-05-24 23:45           ` Kevin Hilman
2011-05-25  6:05             ` Tomi Valkeinen
2011-05-25  8:31             ` Tomi Valkeinen
2011-05-25 18:34               ` Kevin Hilman
2011-05-25 18:45                 ` Tomi Valkeinen
2011-05-25 20:30                   ` Kevin Hilman
2011-05-26  5:55                     ` Tomi Valkeinen
2011-05-26 15:56                       ` 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=877h9ot7c3.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@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 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.