[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdbY9E6R+fohGsrEHcmeQJUf3m4duVMC=N5=+Q15a6_gjw@mail.gmail.com>
Date: Sun, 5 Aug 2012 02:18:33 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Colin Cross <ccross@...roid.com>
Cc: Russell King - ARM Linux <linux@....linux.org.uk>,
linux-arm-kernel@...ts.infradead.org,
Barry Song <21cnbao@...il.com>,
Vaibhav Bedia <vaibhav.bedia@...com>,
Krzysztof Halasa <khc@...waw.pl>,
Nicolas Pitre <nico@...aro.org>,
Marc Zyngier <marc.zyngier@....com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC v2] ARM: sched_clock: update epoch_cyc on resume
On Fri, Aug 3, 2012 at 3:28 AM, Colin Cross <ccross@...roid.com> wrote:
> On Fri, Jul 27, 2012 at 8:30 PM, Colin Cross <ccross@...roid.com> wrote:
>> On Fri, Jul 27, 2012 at 6:15 PM, Colin Cross <ccross@...roid.com> wrote:
>>> That patch was merged in 3.4, and my patch is on top of it. Your
>>> patch updates epoch_cyc and epoch_ns in suspend, but if the first call
>>> to cyc_to_sched_clock after resume gets cyc = 0, cyc - epoch_cyc can
>>> be negative, although it will be cast back to a large positive number.
>>>
>>> With my patch, epoch_cyc is updated in resume to whatever
>>> read_sched_clock() returns, and epoch_ns is still set to the suspend
>>> value, so it appears that sched_clock has not changed between
>>> sched_clock_suspend and sched_clock_resume. It will work with any
>>> timer behavior (reset to 0, reset to random value, or continuing
>>> counting). The old setup_sched_clock function maintains the old
>>> behavior to appease those who like their 32kHz sched clock to continue
>>> ticking in suspend, although I think it is more correct for all sched
>>> clocks to be faster than 32 kHz (when possible) and stop in suspend.
>>
>> I think the existing code can cause sched_clock to go backwards if the
>> register read by the read function resets to 0 in suspend:
>>
>> In sched_clock_suspend epoch_cyc is updated to 0x00002000.
>>
>> The first sched_clock call after resume gets cyc = 0, returning
>> epoch_ns + cyc_to_ns(0xffffe000)
>>
>> Later, sched_clock gets cyc = 0x5000, returning epoch_ns +
>> cyc_to_ns(0x3000), which will be much smaller than the previous
>> sched_clock value.
>
> Russell, any update on this? Should sched_clock.c handle read
> functions that go backwards in suspend, or should I modify the read
> function to track an offset in suspend and always return a
> monotonically increasing value across suspend?
Colin, I suggest you put this into Russell's patch tracker so
he can keep track of it from there.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists