login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
November
»
18
Re: [PATCHv4 14/17] pps: capture MONOTONIC_RAW timestamps as well
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: john stultz
Subject:
Re: [PATCHv4 14/17] pps: capture MONOTONIC_RAW timestamps as well
Date: Thursday, November 18, 2010 - 12:42 pm
On Thu, 2010-11-18 at 19:01 +0300, Alexander Gordeev wrote:
quoted text
> MONOTONIC_RAW clock timestamps are ideally suited for frequency > calculation and also fit well into the original NTP hardpps design. Now > phase and frequency can be adjusted separately: the former based on > REALTIME clock and the latter based on MONOTONIC_RAW clock. > A new function getnstime_raw_and_real is added to timekeeping subsystem > to capture both timestamps at the same time and atomically. > > Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Acked-by: John Stultz <johnstul@us.ibm.com>
quoted text
> --- > include/linux/pps_kernel.h | 3 ++- > include/linux/time.h | 2 ++ > kernel/time/timekeeping.c | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 42 insertions(+), 1 deletions(-) > > diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h > index 5af0498..39fc7125 100644 > --- a/include/linux/pps_kernel.h > +++ b/include/linux/pps_kernel.h > @@ -48,6 +48,7 @@ struct pps_source_info { > }; > > struct pps_event_time { > + struct timespec ts_raw; > struct timespec ts_real; > }; > > @@ -111,7 +112,7 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt, > > static inline void pps_get_ts(struct pps_event_time *ts) > { > - getnstimeofday(&ts->ts_real); > + getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real); > } > > #endif /* LINUX_PPS_KERNEL_H */ > diff --git a/include/linux/time.h b/include/linux/time.h > index 9f15ac7..1e6d3b5 100644 > --- a/include/linux/time.h > +++ b/include/linux/time.h > @@ -158,6 +158,8 @@ extern unsigned int alarm_setitimer(unsigned int seconds); > extern int do_getitimer(int which, struct itimerval *value); > extern void getnstimeofday(struct timespec *tv); > extern void getrawmonotonic(struct timespec *ts); > +extern void getnstime_raw_and_real(struct timespec *ts_raw, > + struct timespec *ts_real); > extern void getboottime(struct timespec *ts); > extern void monotonic_to_bootbased(struct timespec *ts); > > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index 49010d8..947c7dc 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -285,6 +285,44 @@ void ktime_get_ts(struct timespec *ts) > EXPORT_SYMBOL_GPL(ktime_get_ts); > > /** > + * getnstime_raw_and_real - Returns both the time of day an raw > + * monotonic time in a timespec format > + * @ts_mono_raw: pointer to the timespec to be set to raw > + * monotonic time > + * @ts_real: pointer to the timespec to be set to the time > + * of day > + */ > +void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real) > +{ > + unsigned long seq; > + s64 nsecs_raw, nsecs_real; > + > + WARN_ON_ONCE(timekeeping_suspended); > + > + do { > + u32 arch_offset; > + > + seq = read_seqbegin(&xtime_lock); > + > + *ts_raw = raw_time; > + *ts_real = xtime; > + > + nsecs_raw = timekeeping_get_ns_raw(); > + nsecs_real = timekeeping_get_ns(); > + > + /* If arch requires, add in gettimeoffset() */ > + arch_offset = arch_gettimeoffset(); > + nsecs_raw += arch_offset; > + nsecs_real += arch_offset; > + > + } while (read_seqretry(&xtime_lock, seq)); > + > + timespec_add_ns(ts_raw, nsecs_raw); > + timespec_add_ns(ts_real, nsecs_real); > +} > +EXPORT_SYMBOL(getnstime_raw_and_real); > + > +/** > * do_gettimeofday - Returns the time of day in a timeval > * @tv: pointer to the timeval to be set > *
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCHv4 00/17] pps: several fixes and improvements
, Alexander Gordeev
, (Thu Nov 18, 9:00 am)
[PATCHv4 02/17] pps: declare variables where they are used ...
, Alexander Gordeev
, (Thu Nov 18, 9:00 am)
[PATCHv4 04/17] pps: unify timestamp gathering
, Alexander Gordeev
, (Thu Nov 18, 9:00 am)
[PATCHv4 05/17] pps: access pps device by direct pointer
, Alexander Gordeev
, (Thu Nov 18, 9:00 am)
[PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Alexander Gordeev
, (Thu Nov 18, 9:00 am)
[PATCHv4 07/17] pps: move idr stuff to pps.c
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 08/17] pps: add async PPS event handler
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 09/17] pps: don't disable interrupts when using s ...
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 10/17] pps: use BUG_ON for kernel API safety checks
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 11/17] pps: simplify conditions a bit
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 12/17] pps: timestamp is always passed to dcd_cha ...
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 13/17] ntp: add hardpps implementation
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 14/17] pps: capture MONOTONIC_RAW timestamps as well
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 15/17] pps: add kernel consumer support
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
[PATCHv4 16/17] pps: add parallel port PPS client
, Alexander Gordeev
, (Thu Nov 18, 9:01 am)
Re: [PATCHv4 14/17] pps: capture MONOTONIC_RAW timestamps ...
, john stultz
, (Thu Nov 18, 12:42 pm)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Rodolfo Giometti
, (Sat Nov 20, 8:44 am)
Re: [PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Rodolfo Giometti
, (Sat Nov 20, 8:49 am)
Re: [PATCHv4 07/17] pps: move idr stuff to pps.c
, Rodolfo Giometti
, (Sat Nov 20, 8:51 am)
Re: [PATCHv4 08/17] pps: add async PPS event handler
, Rodolfo Giometti
, (Sat Nov 20, 9:08 am)
Re: [PATCHv4 09/17] pps: don't disable interrupts when usi ...
, Rodolfo Giometti
, (Sat Nov 20, 9:09 am)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Rodolfo Giometti
, (Sat Nov 20, 9:13 am)
Re: [PATCHv4 11/17] pps: simplify conditions a bit
, Rodolfo Giometti
, (Sat Nov 20, 9:15 am)
Re: [PATCHv4 12/17] pps: timestamp is always passed to dcd ...
, Rodolfo Giometti
, (Sat Nov 20, 9:23 am)
Re: [PATCHv4 13/17] ntp: add hardpps implementation
, Rodolfo Giometti
, (Sat Nov 20, 9:27 am)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Joe Perches
, (Sat Nov 20, 10:01 am)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Rodolfo Giometti
, (Sat Nov 20, 11:30 am)
Re: [PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Alexander Gordeev
, (Sat Nov 20, 2:33 pm)
Re: [PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Joe Perches
, (Sat Nov 20, 2:42 pm)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Alexander Gordeev
, (Sat Nov 20, 3:33 pm)
Re: [PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Alexander Gordeev
, (Sat Nov 20, 3:38 pm)
Re: [PATCHv4 08/17] pps: add async PPS event handler
, Alexander Gordeev
, (Sat Nov 20, 4:23 pm)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Alexander Gordeev
, (Sat Nov 20, 5:13 pm)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Alexander Gordeev
, (Sat Nov 20, 5:40 pm)
Re: [PATCHv4 12/17] pps: timestamp is always passed to dcd ...
, Alexander Gordeev
, (Sat Nov 20, 5:44 pm)
Re: [PATCHv4 13/17] ntp: add hardpps implementation
, Alexander Gordeev
, (Sat Nov 20, 6:05 pm)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Joe Perches
, (Sat Nov 20, 6:18 pm)
Re: [PATCHv4 06/17] pps: convert printk/pr_* to dev_*
, Rodolfo Giometti
, (Sun Nov 21, 1:19 am)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Rodolfo Giometti
, (Sun Nov 21, 1:26 am)
Re: [PATCHv4 08/17] pps: add async PPS event handler
, Rodolfo Giometti
, (Sun Nov 21, 1:37 am)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Rodolfo Giometti
, (Sun Nov 21, 1:41 am)
Re: [PATCHv4 10/17] pps: use BUG_ON for kernel API safety ...
, Rodolfo Giometti
, (Sun Nov 21, 1:42 am)
Re: [PATCHv4 12/17] pps: timestamp is always passed to dcd ...
, Rodolfo Giometti
, (Sun Nov 21, 1:42 am)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Alan Cox
, (Sun Nov 21, 7:12 am)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Alexander Gordeev
, (Mon Nov 22, 7:55 am)
Re: [PATCHv4 05/17] pps: access pps device by direct pointer
, Alexander Gordeev
, (Mon Nov 22, 8:01 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Alan Cox
Re: Please add ZFS support (from GPL sources)
Trenton D. Adams
Re: Flash IO slow 1.5 MB/s
Rafael J. Wysocki
[Bug #11287] Regression in 2.6.27-rc2 in acpi_processor_init()
Bart Van Assche
Re: Is gcc thread-unsafe?
Ingo Molnar
Re: [PATCH] x86: silence section mismatch warning - uv_cpu_init
git
:
Mark Junker
git on MacOSX and files with decomposed utf-8 file names
Junio C Hamano
Re: git-svnimport
Mark Burton
Re: Sporadic BSOD with msys git?
Junio C Hamano
Re: [PATCH] Detached HEAD (experimental)
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
net: don't grab a mutex within a timer context in gianfar
Linux Kernel Mailing List
powerpc/kexec: Add support for FSL-BookE
Linux Kernel Mailing List
V4L/DVB (8976): af9015: Add USB ID for AVerMedia A309
Linux Kernel Mailing List
ARM: 5670/1: bcmring: add default configuration for bcmring arch
linux-netdev
:
David Miller
Re: [RFC 0/5] generic rx recycling
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
Gerrit Renker
[PATCH 37/37] dccp: Debugging functions for feature negotiation
Jeff Garzik
Re: [PATCH] drivers/net: remove network drivers' last few uses of IRQF_SAMPLE_RANDOM
openbsd-misc
:
Christophe Rioux
Implementation example of snmp
Nick Holland
Re: booting openbsd on eee without cd-rom
Cabillot Julien
Re: OpenBSD isakmpd and pf vs Cisco PIX or ASA
Nice Daemon
Re: Bind ntpd on certain interface?
Marco Peereboom
Re: Singularity OS
Colocation donated by:
Syndicate