Skip to content

Posix interface for RTC (v2)

John Stultz lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7Introduce timerlist infrastructure.include/linux/timerlist.h lib/Makefile lib/timerlist.c+153 -10 replies
2/7hrtimers: Convert hrtimers to use timerlist infrastructureinclude/linux/hrtimer.h kernel/hrtimer.c kernel/time/timer_list.c+49 -770 replies
3/7RTC: Rework RTC code to use timerlist for eventsdrivers/rtc/class.c drivers/rtc/interface.c drivers/rtc/rtc-lib.c +1 more+426 -2300 replies
4/7RTC: Remove UIE emulationdrivers/rtc/rtc-dev.c include/linux/rtc.h+0 -1160 replies
5/7posix clocks: dynamic clock ids.include/linux/posix-timers.h include/linux/time.h kernel/posix-timers.c+42 -80 replies
6/7RTC: Add posix clock/timer interfacedrivers/rtc/Makefile drivers/rtc/class.c drivers/rtc/interface.c +4 more+283 -50 replies
7/7Introduce Alarm (hybrid) timersinclude/linux/alarmtimer.h include/linux/posix-timers.h include/linux/time.h +2 more+556 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Posix interface for RTC (v2)

From: John Stultz <[email protected]>

So I think this patch set is starting to shape up, and it has been functioning pretty well in my testing, so I wanted to send it out again for review.

The first two patches lay groundwork, pulling the timerlist infrastructure out of hrtimers and into common code.

The next two patches rework the RTC code, so the interface is a little more abstracted away from the hardware, allowing us to multiplex timers from different applications ontop of a single RTC device, and cleaning up the now redundant older emulation layer.

This is where the patchset diverges into two paths:

The next two patches provide a posix interface layer ontop of the RTC device. One of the patches, provided by Richard Cochran, allows for dynamic posix clock registration and is likely to be reworked here shortly. The other implements the posix interface. This interface exposes the actual RTC time and allows timers to be set against that time domain, which may not stay in sync with the kernel's system time. It also allows wakeup timers to be triggered in the future when the machine may be suspended.

The last patch takes a different approach. It too provides a posix interface that can be used to trigger wakeup alarms when the machine is suspended, but it uses a bit of a hybrid method, basing timers off the system time clock ids (ie:
CLOCK_REALTIME/MONOTONIC) while the system is running, and then setting the RTC to fire only when we go to suspend. This hybrid approach was inspired by the Android Alarm driver, which uses this same method, but exposes the interface to userland via ioctl device instead of the posix interface.

I wanted to send out both of these methods to get some feedback on which direction (or possibly both) people would prefer to see.

Any other feedback or comments would also be appreciated!

thanks
-john

CC Alessandro Zummo <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Richard Cochran <[email protected]>
CC Arve Hjønnevåg <[email protected]>

John Stultz (6):
[RFC] Introduce timerlist infrastructure.
[RFC] hrtimers: Convert hrtimers to use timerlist infrastructure [RFC] RTC: Rework RTC code to use timerlist for events [RFC] RTC: Remove UIE emulation
[RFC] RTC: Add posix clock/timer interface
[RFC] Introduce Alarm (hybrid) timers

Richard Cochran (1):
[RFC] posix clocks: dynamic clock ids.

 drivers/rtc/Makefile         |    2 +-
 drivers/rtc/class.c          |   15 +
 drivers/rtc/interface.c      |  579 ++++++++++++++++++++++++++----------------
 drivers/rtc/posix.c          |  258 +++++++++++++++++++
 drivers/rtc/rtc-dev.c        |  104 --------
 drivers/rtc/rtc-lib.c        |   26 ++
 drivers/rtc/rtc-sysfs.c      |   10 +
 include/linux/alarmtimer.h   |   29 ++
 include/linux/hrtimer.h      |   32 +--
 include/linux/posix-timers.h |   11 +-
 include/linux/rtc.h          |   52 +++-
 include/linux/time.h         |    4 +
 include/linux/timerlist.h    |   37 +++
 kernel/hrtimer.c             |   86 +++----
 kernel/posix-timers.c        |   41 +++-
 kernel/time/Makefile         |    2 +-
 kernel/time/alarmtimer.c     |  522 +++++++++++++++++++++++++++++++++++++
 kernel/time/timer_list.c     |    8 +-
 lib/Makefile                 |    2 +-
 lib/timerlist.c              |  115 +++++++++
 20 files changed, 1503 insertions(+), 432 deletions(-)
 create mode 100644 drivers/rtc/posix.c
 create mode 100644 include/linux/alarmtimer.h
 create mode 100644 include/linux/timerlist.h
 create mode 100644 kernel/time/alarmtimer.c
 create mode 100644 lib/timerlist.c
Signature · 1 line
1.7.3.2.146.gca209