The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	David Brownell <david-b@pacbell.net>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] Posix CLOCK_RTC interface proof of concept
Date: Fri, 17 Sep 2010 09:52:07 +0200	[thread overview]
Message-ID: <20100917075207.GA12438@riccoc20.at.omicron.at> (raw)
In-Reply-To: <1284666092-23347-1-git-send-email-john.stultz@linaro.org>

On Thu, Sep 16, 2010 at 12:41:32PM -0700, John Stultz wrote:
> Exposing multiple RTCs via the posix clock interface has some tradeoffs.
> 
> a) Some application programmers may really want to see the underlying
> hardware and be sophisticated enough to deal with the multiple,
> possibly unsynchronized, time domains.
> 
> b) Some application programmers may not care about the hardware, and
> just want a interface that works like CLOCK_REALTIME, but fires
> wakeup alarms if the system is suspended.

I like the idea of offering the high-level posix clock API for various
hardware clocks. Also, keeping low-level access for specialists makes
sense, as long as there is a way to enforce correct access control. If
we make the posix clocks truly dynamic (with removal, too), then one
could offer a low level funtion to grab the clock before use.

> Exposing all the RTC devices in a somewhat raw manner is probably
> the most straight forward. Some extra infrastructure, like
> the dynamic posix-clockid allocation Richard Cochran has
> started to look into will be needed. More concerning is that
> this will probably cause some grief if someone creates a cron-like
> tool that uses the RTC where the RTC isn't exactly synced with
> system time. When the user specified a job for 6am, do they mean
> 6am system time, or RTC?
> 
> And note: on many PCs, the RTC is synchronized, but kept in local
> time, not UTC. So the unsynched RTC case is likely to be common.

We could also advertise the clocks properties (eg timescale) via sysfs
(or clockfs, as Greg K.H. put it).

> 3) Adding the posix time interface makes it easier to have finer
> grained capability management to decide what applications can
> set a alarm timer. While this is great for creating applications
> that can wake servers up from suspend mode, and simplifying the
> wakeup infrastructure on cell phones, some systems may not
> want applications being able to set wakeup timers. I can
> imagine the "laptop in well insulated carry-on luggage" case
> that comes up occasional being one of them. So some additional
> thought and policy may be needed to decide when non-user-triggered
> wake events should be masked or not in suspend.

Again, implementing dynamic clocks would allow the sysdadmin to just
remove the clock whenever it might cause trouble.

Overall:

I only took a quick look at the patch, but I like the general idea.

You introduce posix timers that are *not* based on the hrtimer code,
but rather on a second implementation. I wonder whether one could
abstract the timer management code to work with different clocks.

I have been thinking about that for the PTP hardware clock stuff and
will soon post a new round of patches.

Thanks,
Richard

  reply	other threads:[~2010-09-17  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 19:41 [PATCH] Posix CLOCK_RTC interface proof of concept John Stultz
2010-09-17  7:52 ` Richard Cochran [this message]
2010-09-17 10:59 ` Thomas Gleixner
2010-09-17 18:42   ` john stultz
2010-09-18  6:15     ` Richard Cochran
2010-09-18  9:31       ` Thomas Gleixner

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=20100917075207.GA12438@riccoc20.at.omicron.at \
    --to=richardcochran@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=david-b@pacbell.net \
    --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