public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Kay Sievers <kay@vrfy.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: CONFIG_RTC_HCTOSYS lost on x86 with ALWAYS_USE_PERSISTENT_CLOCK changes?
Date: Tue, 23 Apr 2013 19:43:48 -0700	[thread overview]
Message-ID: <517746E4.908@linaro.org> (raw)
In-Reply-To: <CAPXgP13kizK95JyLxKxgWrGnV9b11ZTyi3vuc5YFDmROzckg4w@mail.gmail.com>

On 04/23/2013 06:34 PM, Kay Sievers wrote:
> Hey,
>
> what's the intention of:
>    e90c83f757fffdacec8b3c5eee5617dcc038338f ?
>    x86: Select HAS_PERSISTENT_CLOCK on x86
>
> It unconditionally sets:
>    HAS_PERSISTENT_CLOCK
> but:
>    RTC_SYSTOHC
> got a depends on !HAS_PERSISTENT_CLOCK
>
> This makes it impossible to sync the system time from the RTC on x86.
> What's going on here?

So I suspect just some confusion, but let me know if thats wrong and 
you're actually seeing an issue.

SYSTOHC is what *sets the RTC* to the system time when we're synced with 
NTP.

HCTOSYS is what sets the system time from the RTC.

In the past, we've used the update_persistent_clock() interface to set 
the CMOS clock when we're synced with NTP, but now we've got an 
interface that can sync the RTC interface for systems that don't support 
update_persistent_clock().

We've always used the persistent_clock code (or what persistent_clock 
abstracted) on x86, but for awhile there was also ways to configure the 
kernel to also use the generic RTC infrastructure, which could cause odd 
behavior like the time being set/adjusted twice at boot and resume. This 
was mostly avoided in code, but we figured we could also avoid these 
duplicative paths at build time. Thus if HAS_PERSISTENT_CLOCK is 
enabled, we can remove some extra checks that can slow down the resume path.

Now, the persistent_clock and RTC infrastructure are annoyingly 
duplicitive, but have very different constraints. We're hopefully (and 
likely slowly) working to consolidate some of the logic here.

My goal is eventually to remove the use of the persistent_clock() for 
time initialization, instead using the generic RTC infrastructure.

Then I want to morph the persistent_clock infrastructure to really be 
only for measuring suspend time by the timekeeping core at resume. This 
can be done via clocksources that continue to count via suspend, or via 
the RTC layer, however we need a special RTC hook to allow us to read 
the RTC time when interrupts are disabled (not all RTCs support this). 
Then only should both of those options fail, fall back to the late (and 
more error prone) rtc resume hook for suspend timing.

But of course, I don't have patches for this transition yet, and I'm not 
sure when in the near term I'll get time to focus on this cleanup.

However, if you are seeing a issue/regression with the existing code in 
your config, please let me know and I'll make sure we address it.

thanks
-john


  reply	other threads:[~2013-04-24  2:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  1:34 CONFIG_RTC_HCTOSYS lost on x86 with ALWAYS_USE_PERSISTENT_CLOCK changes? Kay Sievers
2013-04-24  2:43 ` John Stultz [this message]
2013-04-24  3:05   ` Kay Sievers
2013-04-24  3:19     ` John Stultz
2013-04-24  3:33       ` Kay Sievers
2013-04-24  3:51         ` Kay Sievers
2013-04-24 16:33           ` John Stultz
2013-04-24 16:30         ` John Stultz
2013-04-24 16:51           ` Kay Sievers
2013-04-24  5:12       ` Alexander Holler
2013-04-24 16:07         ` John Stultz
2013-04-24 16:32           ` Kay Sievers
2013-04-24 16:42             ` John Stultz
2013-04-25  7:11           ` Alexander Holler
2013-04-25 16:01             ` Kay Sievers
2013-04-25 16:13             ` John Stultz
2013-04-25 18:33               ` Jason Gunthorpe
2013-04-25 19:45                 ` Kay Sievers
2013-04-25 19:54                   ` John Stultz
2013-04-25 20:35                     ` Jason Gunthorpe
2013-04-25 20:03                 ` John Stultz
2013-04-25 21:02                   ` 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=517746E4.908@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.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