[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [mini-os master] Fix time update
commit e085b7e5613576601e2f100e6f1ee9e0778c3eb9 Author: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> AuthorDate: Sun Apr 10 00:46:32 2016 +0200 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Fri Apr 15 11:07:43 2016 +0100 Fix time update The timer handler should actually not update the shadowed copy, since that makes reading them non-atomic. Users of the shadowed copy should just update it themselves, which is already the case in monotonic_clock(), we just need to make to make gettimeofday() update the wallclock. This also fixes an issue reported by David Vercauteren: when the timer interrupt was not called yet, gettimeofday was returning bogus values. Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> --- arch/x86/time.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/time.c b/arch/x86/time.c index cf5fab0..af45e56 100644 --- a/arch/x86/time.c +++ b/arch/x86/time.c @@ -79,6 +79,12 @@ static inline int time_values_up_to_date(void) return (shadow.version == src->version); } +static inline int wc_values_up_to_date(void) +{ + shared_info_t *s= HYPERVISOR_shared_info; + + return (shadow_ts_version == s->wc_version); +} /* * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, @@ -186,9 +192,12 @@ static void update_wallclock(void) int gettimeofday(struct timeval *tv, void *tz) { uint64_t nsec = monotonic_clock(); + + if (!wc_values_up_to_date()) + update_wallclock(); + nsec += shadow_ts.tv_nsec; - - + tv->tv_sec = shadow_ts.tv_sec; tv->tv_sec += NSEC_TO_SEC(nsec); tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL); @@ -214,8 +223,6 @@ void block_domain(s_time_t until) */ static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign) { - get_time_values_from_xen(); - update_wallclock(); } -- generated by git-patchbot for /home/xen/git/mini-os.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |