From: John Stultz <john.stultz@linaro.org>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Feng Tang <feng.tang@intel.com>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@linux.intel.com>,
x86@kernel.org, Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/5] Add support for S3 non-stop TSC support.
Date: Tue, 22 Jan 2013 17:54:21 -0800 [thread overview]
Message-ID: <50FF42CD.6010203@linaro.org> (raw)
In-Reply-To: <20130123013710.GA1046@obsidianresearch.com>
On 01/22/2013 05:37 PM, Jason Gunthorpe wrote:
> On Tue, Jan 22, 2013 at 04:41:58PM -0800, John Stultz wrote:
>
>> Right but to calculate an suspend interval (since they are likely
>> many orders of magnitude larger then the intervals between timer
>> interrupts), you need different mult/shift selection. Its splitting
>> out the mult/shift management into a per-subsystem level that is the
> You are talking about overflow in cyclecounter_cyc2ns and the like
> right? The 64 bit cycle_t and the underlying hw counter (eg 64 bit
> rdtsc) are not going to overflow..
>
> An alternate version of cyclecounter_cyc2ns for use by the suspend
> code that handles overflow during the mult/shift operation solves that
> problem:
>
> // Drops some small precision along the way but is simple..
> static inline u64 cyclecounter_cyc2ns_128(const struct cyclecounter *cc,
> cycle_t cycles)
> {
> u64 max = U64_MAX/cc->mult;
> u64 num = cycles/max;
> u64 result = num * ((max * cc->mult) >> cc->shift);
> return result + cyclecounter_cyc2ns(cc, cycles - num*cc->mult);
> }
>
> Or am I missing the issue?
Well, cyclecounters and clocksources are currently different things.
There was some hope that cyclecounters would be a simpler base structure
that would supersede clocksources, but the complexity of all the
variants of clocksources have limited the ability to make such a
conversion. At least so far. I hope to eventually clean that up as the
potential overlap is obvious - although as the
cyclecounters/timecounters code never grew as I expected. But I'm not
sure how soon "eventually" will end up being.
But regardless of historical tangents :), you're right, an alternate and
slower cyc2ns function could be used to avoid overflow issues.
>
>> complicated part. Additionally, there may be cases where the
>> timekeeping clocksource is one clocksource and the suspend
>> clocksource is another. So I think to properly integrate this sort
> Does the difference matter? The clocksource to use is detected at
> runtime, if the timekeeping clocksource is no good for suspend time
> keeping then it just won't be used. With a distinct
> read_persistent_clock API then they are already seperate??
Not sure I'm following you here. I still think the selection of which
clocksource to use for suspend timing is problematic (especially if its
not the active timekeeping clocksource). So I think instead of
complicating the generic timekeeping code with the logic, I'd rather
push it off to new read_presistent_clock api.
thanks
-john
next prev parent reply other threads:[~2013-01-23 1:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 6:38 [RFC PATCH 0/5] Add support for S3 non-stop TSC support Feng Tang
2013-01-21 6:38 ` [RFC PATCH 1/5] x86: Add cpu capability flag X86_FEATURE_TSC_S3_NOTSTOP Feng Tang
2013-01-21 7:27 ` Chen Gong
2013-01-21 7:59 ` Feng Tang
2013-01-21 15:58 ` H. Peter Anvin
2013-01-22 14:07 ` Feng Tang
2013-01-21 6:38 ` [RFC PATCH 2/5] clocksource: Add new feature flag CLOCK_SOURCE_SUSPEND_NOTSTOP Feng Tang
2013-01-21 6:38 ` [RFC PATCH 3/5] x86: tsc: Add support for new S3_NOTSTOP feature Feng Tang
2013-01-21 6:38 ` [RFC PATCH 4/5] clocksource: Enlarge the maxim time interval when configuring the scale and shift Feng Tang
2013-01-21 7:25 ` Chen Gong
2013-01-21 6:38 ` [RFC PATCH 5/5] timekeeping: Add support for clocksource which doesn't stop during suspend Feng Tang
2013-01-21 13:55 ` [RFC PATCH 0/5] Add support for S3 non-stop TSC support Rafael J. Wysocki
2013-03-30 18:14 ` Pavel Machek
2013-04-01 17:32 ` John Stultz
2013-04-01 20:31 ` Pavel Machek
2013-04-01 20:41 ` John Stultz
2013-01-21 18:46 ` John Stultz
2013-01-22 14:55 ` Feng Tang
2013-01-22 21:56 ` John Stultz
2013-01-24 3:37 ` Feng Tang
2013-01-24 18:15 ` Jason Gunthorpe
2013-01-22 19:57 ` Jason Gunthorpe
2013-01-22 20:22 ` John Stultz
2013-01-23 0:26 ` Jason Gunthorpe
2013-01-23 0:41 ` John Stultz
2013-01-23 1:37 ` Jason Gunthorpe
2013-01-23 1:54 ` John Stultz [this message]
2013-01-23 2:35 ` Jason Gunthorpe
2013-01-23 3:07 ` John Stultz
2013-01-23 19:23 ` Jason Gunthorpe
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=50FF42CD.6010203@linaro.org \
--to=john.stultz@linaro.org \
--cc=feng.tang@intel.com \
--cc=hpa@linux.intel.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox