From: Richard Cochran <richardcochran@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH RFC V2 3/6] time: keep track of the pending utc/tai threshold
Date: Wed, 23 May 2012 21:17:48 +0200 [thread overview]
Message-ID: <20120523191747.GA2348@netboy.at.omicron.at> (raw)
In-Reply-To: <4FBD1545.4070408@linaro.org>
On Wed, May 23, 2012 at 09:50:13AM -0700, John Stultz wrote:
> On 05/23/2012 01:29 AM, Richard Cochran wrote:
> >Okay, if you want it that way, then you will have to add the other
> >cases. For example:
> >
> > switch (code) {
> > case INS:
> > if (U == epoch) {
> > U--;
> > T++;
> > code = OOP;
> > }
> > break;
> > case OOP:
> > if (U == epoch) {
> epoch + 1 here, right?
No, I really mean epoch (not the leap second value, but the value when
the new TAI offset comes into effect).
> > code = WAIT;
> > }
> > break;
> > case DEL:
> > if (U == epoch - 1) {
> > U++;
> > T--;
> > code = WAIT;
> > }
> > break;
> > default:
> > break;
> > }
> > return (U, code, T);
> >
> >This is beginning to look a lot like the code in my patch. However,
> >your approach is somewhat simpler, because it assumes the tick will
> >never miss a second overflow.
>
> I'm a little unclear on the above, because it looks like you're
> modifying the state from the reader.
Sorry about that. Here is a more exact pseudo code:
switch (time_state) {
case INS:
if (U == epoch) {
U--;
T++;
result_code = OOP;
}
break;
case OOP:
if (U == epoch) {
result_code = WAIT;
}
break;
case DEL:
if (U == epoch - 1) {
U++;
T--;
result_code = WAIT;
}
break;
default:
break;
}
return (U, result_code, T);
> I still don't think it matters. If we know the when next leap second
> is supposed to be, if the time_state is INS, then we can still
> handle things without extra state.
>
> if (unlikely(CODE == INS&& U == next_leap))
> return (U-1, OOP, T+1);
>
> if (unlikely(CODE == INS&& U == next_leap + 1))
> return (U-1, WAIT, T+1);
And what if (U > next_leap + 1)?
In that case, you must also return WAIT. Are you going to add a test
for every second beyond 'next_leap'? I don't think so.
>
> if (unlikely(CODE == DEL&& U == next_leap - 1))
> return (U+1, WAIT, T-1);
>
>
> So even if we somehow sleep for two seconds over the leap second,
> and then an application hits the read critical section before the
> timer interrupt comes in the update the state, we can still provide
> correct state transition in the reader.
No, I think what you wrote above is not correct.
> Thus the only additional state you might need over what we already
> have is the next_leap value.
Again, you will need two things.
1. the epoch threshold value (not the leap second value)
2. whether the new epoch has been applied yet, or not
Thanks,
Richard
next prev parent reply other threads:[~2012-05-23 19:20 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-18 14:09 [PATCH RFC V2 0/6] Fix leap seconds and add tai clock Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 1/6] time: remove obsolete declaration Richard Cochran
2012-05-21 23:57 ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 2/6] ntp: remove useless parameter Richard Cochran
2012-05-21 23:58 ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 3/6] time: keep track of the pending utc/tai threshold Richard Cochran
2012-05-21 18:09 ` John Stultz
2012-05-21 19:08 ` Richard Cochran
2012-05-22 17:39 ` Richard Cochran
2012-05-22 18:06 ` John Stultz
2012-05-23 8:29 ` Richard Cochran
2012-05-23 16:50 ` John Stultz
2012-05-23 19:17 ` Richard Cochran [this message]
2012-05-23 20:18 ` John Stultz
2012-05-24 6:43 ` Richard Cochran
2012-05-24 6:57 ` Richard Cochran
2012-05-26 15:07 ` Richard Cochran
2012-05-30 1:46 ` John Stultz
2012-05-30 1:49 ` John Stultz
2012-05-30 5:11 ` Richard Cochran
2012-05-30 5:56 ` John Stultz
2012-05-30 6:19 ` Richard Cochran
2012-05-30 6:23 ` John Stultz
2012-05-30 7:27 ` Richard Cochran
2012-05-23 19:42 ` Richard Cochran
2012-05-21 18:21 ` John Stultz
2012-05-21 19:13 ` Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 4/6] time: introduce leap second functional interface Richard Cochran
2012-05-21 18:01 ` John Stultz
2012-05-21 19:18 ` Richard Cochran
2012-05-21 20:24 ` John Stultz
2012-05-22 4:25 ` Richard Cochran
2012-05-22 15:10 ` John Stultz
2012-05-18 14:09 ` [PATCH RFC V2 5/6] time: move leap second management into time keeping core Richard Cochran
2012-05-21 18:18 ` John Stultz
2012-05-21 19:24 ` Richard Cochran
2012-05-18 14:09 ` [PATCH RFC V2 6/6] time: Add CLOCK_TAI clockid Richard Cochran
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=20120523191747.GA2348@netboy.at.omicron.at \
--to=richardcochran@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®