public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: rtc-linux@googlegroups.com, LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
Subject: Re: [rtc-linux] [PATCH 04/10] RTC: Cleanup rtc_class_ops->read_alarm()
Date: Mon, 21 Feb 2011 18:55:33 -0800	[thread overview]
Message-ID: <1298343333.4222.36.camel@work-vm> (raw)
In-Reply-To: <20110222023452.GB18299@sirena.org.uk>

On Tue, 2011-02-22 at 02:34 +0000, Mark Brown wrote:
> On Mon, Feb 21, 2011 at 03:55:32PM -0800, John Stultz wrote:
> > With the generic rtc code managing the now virtualized alarm timer,
> > no one actually calls rtc_clas_ops->read_alarm().
> 
> > We do check that it exists in rtc_read_alarm(), but that is only
> > to verify that the hardware supports irqs. The same test can
> > be done by checking set_alarm instead.
> 
> > This patch changes the the read_alarm check to set_alarm, and then
> > removes the read_alarm method and its implementations in the rt
> > drivers.
> 
> Can you go into more detail on the rationale behind this virtualised
> functionality and how it works?  I'd really expect the RTC alarm to be
> preserved over system reboots (on some systems it can be used to
> initiate a boot) and that would mean that we need to go to the hardware
> for at least the initial configuration.

So with respect to the rationale:

The difference with the new code (already in for 2.6.38), is that when
alarms are set via the userland interface, instead of directly
manipulating the hardware, it creates a rtc_timer event that is managed
by the kernel.

The kernel then looks at the list of rtc_timers and sets the RTC for
soonest rtc_timer. When the alarm occurs (possibly waking up the
system), the kernel notifies the waiting userland app and then looks at
the timer list to see if there are any more events to program into the
hardware.

This allows us in the future to multiplex events onto the RTC hardware
from different sources without breaking compatibility.

Right now, if two applications want to set a wake alarm on the RTC ,
they have to coordinate their access to the rtc device (or the machine
has to have multiple RTC devices).

Soon, with my posix alarm timers work, those two applications would be
able to set standard posix timers against CLOCK_REALTIME_ALARM, and the
kernel will manage the RTC hardware to wake the system up for both
application's alarms. No coordination needed.


Now, to your point about persistence across reboots:

It is an interesting point to consider. 

So currently, if the hardware supports it, then the behavior should
remain the same: As long as no application sets a new alarm, the
previous alarm should persist in the RTC hardware.

However, an application's ability to notice that such an alarm is set,
is currently limited.  So your point about reading the hardware to
initialize the state is quite valid, and shows a good reason to preserve
the read_alarm() method. 

Thus, I'll drop this patch for my 2.6.39 queue. And I'll try to fix the
current initialization limitation to ensure applications can detect
alarm persistence.

Thanks for pointing this issue out!
-john



  reply	other threads:[~2011-02-22  2:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21 23:55 [PATCH 00/10] [RFC] RTC: Cleanups for 2.6.39 John Stultz
2011-02-21 23:55 ` [PATCH 01/10] RTC: Cleanup rtc_class_ops->irq_set_state John Stultz
2011-02-21 23:55 ` [PATCH 02/10] RTC: Cleanup rtc_class_ops->irq_set_freq() John Stultz
2011-02-21 23:55 ` [PATCH 03/10] RTC: Cleanup rtc_class_ops->update_irq_enable() John Stultz
2011-02-21 23:55 ` [PATCH 04/10] RTC: Cleanup rtc_class_ops->read_alarm() John Stultz
2011-02-22  2:34   ` [rtc-linux] " Mark Brown
2011-02-22  2:55     ` John Stultz [this message]
2011-02-22  8:09       ` john stultz
2011-02-22 12:51         ` Marcelo Roberto Jimenez
2011-02-22 19:35           ` john stultz
2011-02-22 19:51             ` Mark Brown
2011-02-22 19:58               ` john stultz
2011-02-22 21:26                 ` Marcelo Roberto Jimenez
2011-02-22 18:16         ` Mark Brown
2011-02-22 19:51           ` john stultz
2011-02-22 20:00             ` Mark Brown
2011-02-22 20:22               ` john stultz
2011-02-22 21:05                 ` Mark Brown
2011-02-22 21:21                   ` john stultz
2011-02-22 21:27                     ` Thomas Gleixner
2011-02-22 21:40                       ` Mark Brown
2011-02-22 21:33                     ` Mark Brown
2011-02-22 22:10                       ` john stultz
2011-02-22 23:07                         ` Mark Brown
2011-02-22 19:53           ` john stultz
2011-02-22 20:31             ` Mark Brown
2011-02-21 23:55 ` [PATCH 05/10] RTC: Clean out UIE icotl implementations John Stultz
2011-02-21 23:55 ` [PATCH 06/10] RTC: Include information about UIE and PIE in RTC driver proc John Stultz
2011-02-21 23:55 ` [PATCH 07/10] RTC: Remove UIE and PIE information from the sa1100 " John Stultz
2011-02-21 23:55 ` [PATCH 08/10] RTC: Fix the cross interrupt issue on rtc-test John Stultz
2011-02-21 23:55 ` [PATCH 09/10] RTC: sa1100: Update the sa1100 RTC driver John Stultz
2011-02-21 23:55 ` [PATCH 10/10] RTC: Fix up rtc.txt documentation to reflect changes to generic rtc layer John Stultz

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=1298343333.4222.36.camel@work-vm \
    --to=john.stultz@linaro.org \
    --cc=a.zummo@towertech.it \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroberto@cpti.cetuc.puc-rio.br \
    --cc=rtc-linux@googlegroups.com \
    --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