From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] ARM: sched_clock: update epoch_cyc on resume
Date: Fri, 19 Oct 2012 16:58:36 -0700 [thread overview]
Message-ID: <87r4ouggk3.fsf@deeprootsystems.com> (raw)
In-Reply-To: <CAGsJ_4z_tF3LKy-vygr=kwah7q7U03Y2K2XKAkZTB1QC2pSYmw@mail.gmail.com> (Barry Song's message of "Tue, 24 Jul 2012 14:43:28 +0800")
Barry Song <21cnbao@gmail.com> writes:
> 2012/7/18 Colin Cross <ccross@android.com>:
>> Many clocks that are used to provide sched_clock will reset during
>> suspend. If read_sched_clock returns 0 after suspend, sched_clock will
>> appear to jump forward. This patch resets cd.epoch_cyc to the current
>> value of read_sched_clock during resume, which causes sched_clock() just
>> after suspend to return the same value as sched_clock() just before
>> suspend.
>>
>> In addition, during the window where epoch_ns has been updated before
>> suspend, but epoch_cyc has not been updated after suspend, it is unknown
>> whether the clock has reset or not, and sched_clock() could return a
>> bogus value. Add a suspended flag, and return the pre-suspend epoch_ns
>> value during this period.
>
> Acked-by: Barry Song <21cnbao@gmail.com>
>
> this patch should also fix the issue that:
> 1. launch some rt threads, rt threads sleep before suspend
> 2. repeat to suspend/resume
> 3. after resuming, waking up rt threads
>
> repeat 1-3 again and again, sometimes all rt threads will hang after
> resuming due to wrong sched_clock will make sched_rt think rt_time is
> much more than rt_runtime (default 950ms in 1s). then rt threads will
> lost cpu timeslot to run since the 95% threshold is there.
Re-visiting this in light of a related problem.
I've run into a similar issue where IRQ threads are prevented from
running during resume becase the RT throttling kicks because RT
runtime is accumulated during suspend. Using the 'needs_suspend'
version fixes this problem too.
However, because of the RT throttling issue, it seems like *all*
platforms should be using the 'needs_suspend' version always. But, as
already pointed out, that makes the timed printk output during
suspend/resume rather unhelpful.
Having to choose between useful printk times during suspend/resume and
functioning IRQ threads during suspend/resume isn't a choice I want to
make. I'd rather have both. Any ideas?
Kevin
WARNING: multiple messages have this Message-ID (diff)
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Barry Song <21cnbao@gmail.com>
Cc: Colin Cross <ccross@android.com>,
linux-arm-kernel@lists.infradead.org,
Russell King <linux@arm.linux.org.uk>,
Nicolas Pitre <nico@linaro.org>,
Marc Zyngier <marc.zyngier@arm.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, Krzysztof Halasa <khc@pm.waw.pl>,
Felipe Balbi <balbi@ti.com>
Subject: Re: [RFC] ARM: sched_clock: update epoch_cyc on resume
Date: Fri, 19 Oct 2012 16:58:36 -0700 [thread overview]
Message-ID: <87r4ouggk3.fsf@deeprootsystems.com> (raw)
In-Reply-To: <CAGsJ_4z_tF3LKy-vygr=kwah7q7U03Y2K2XKAkZTB1QC2pSYmw@mail.gmail.com> (Barry Song's message of "Tue, 24 Jul 2012 14:43:28 +0800")
Barry Song <21cnbao@gmail.com> writes:
> 2012/7/18 Colin Cross <ccross@android.com>:
>> Many clocks that are used to provide sched_clock will reset during
>> suspend. If read_sched_clock returns 0 after suspend, sched_clock will
>> appear to jump forward. This patch resets cd.epoch_cyc to the current
>> value of read_sched_clock during resume, which causes sched_clock() just
>> after suspend to return the same value as sched_clock() just before
>> suspend.
>>
>> In addition, during the window where epoch_ns has been updated before
>> suspend, but epoch_cyc has not been updated after suspend, it is unknown
>> whether the clock has reset or not, and sched_clock() could return a
>> bogus value. Add a suspended flag, and return the pre-suspend epoch_ns
>> value during this period.
>
> Acked-by: Barry Song <21cnbao@gmail.com>
>
> this patch should also fix the issue that:
> 1. launch some rt threads, rt threads sleep before suspend
> 2. repeat to suspend/resume
> 3. after resuming, waking up rt threads
>
> repeat 1-3 again and again, sometimes all rt threads will hang after
> resuming due to wrong sched_clock will make sched_rt think rt_time is
> much more than rt_runtime (default 950ms in 1s). then rt threads will
> lost cpu timeslot to run since the 95% threshold is there.
Re-visiting this in light of a related problem.
I've run into a similar issue where IRQ threads are prevented from
running during resume becase the RT throttling kicks because RT
runtime is accumulated during suspend. Using the 'needs_suspend'
version fixes this problem too.
However, because of the RT throttling issue, it seems like *all*
platforms should be using the 'needs_suspend' version always. But, as
already pointed out, that makes the timed printk output during
suspend/resume rather unhelpful.
Having to choose between useful printk times during suspend/resume and
functioning IRQ threads during suspend/resume isn't a choice I want to
make. I'd rather have both. Any ideas?
Kevin
next prev parent reply other threads:[~2012-10-19 23:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-17 23:27 [RFC] ARM: sched_clock: update epoch_cyc on resume Colin Cross
2012-07-17 23:27 ` Colin Cross
2012-07-23 18:55 ` Linus Walleij
2012-07-23 18:55 ` Linus Walleij
2012-07-23 19:27 ` Colin Cross
2012-07-23 19:27 ` Colin Cross
2012-07-24 0:14 ` Linus Walleij
2012-07-24 0:14 ` Linus Walleij
2012-07-24 0:28 ` Colin Cross
2012-07-24 0:28 ` Colin Cross
2012-07-24 9:16 ` Bedia, Vaibhav
2012-07-24 9:16 ` Bedia, Vaibhav
2012-07-27 22:23 ` Linus Walleij
2012-07-27 22:23 ` Linus Walleij
2012-07-27 22:41 ` Russell King - ARM Linux
2012-07-27 22:41 ` Russell King - ARM Linux
2012-07-30 12:31 ` Bedia, Vaibhav
2012-07-30 12:31 ` Bedia, Vaibhav
2012-07-24 6:43 ` Barry Song
2012-07-24 6:43 ` Barry Song
2012-10-19 23:58 ` Kevin Hilman [this message]
2012-10-19 23:58 ` 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=87r4ouggk3.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.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.