Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753905AbaGKNoE (ORCPT ); Fri, 11 Jul 2014 09:44:04 -0400 Received: from www.linutronix.de ([62.245.132.108]:56026 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753749AbaGKNoB (ORCPT ); Fri, 11 Jul 2014 09:44:01 -0400 Message-Id: <20140711133705.309823897@linutronix.de> User-Agent: quilt/0.63-1 Date: Fri, 11 Jul 2014 13:43:59 -0000 From: Thomas Gleixner To: LKML Cc: John Stultz , Peter Zijlstra Subject: [patch 01/55] tile: Convert VDSO timekeeping to the precise mechanism References: <20140711133623.530368377@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=tile-fix-broken-vdso.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The code was only halfarsed converted to the new VSDO update mechanism and still uses the inaccurate base value which lacks the fractional part of xtime_nsec. Fix it up. Signed-off-by: Thomas Gleixner --- arch/tile/kernel/time.c | 9 ++++----- arch/tile/kernel/vdso/vgettimeofday.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) Index: tip/arch/tile/kernel/time.c =================================================================== --- tip.orig/arch/tile/kernel/time.c +++ tip/arch/tile/kernel/time.c @@ -260,7 +260,6 @@ void update_vsyscall_tz(void) void update_vsyscall(struct timekeeper *tk) { - struct timespec wall_time = tk_xtime(tk); struct timespec *wtm = &tk->wall_to_monotonic; struct clocksource *clock = tk->clock; @@ -271,12 +270,12 @@ void update_vsyscall(struct timekeeper * ++vdso_data->tb_update_count; smp_wmb(); vdso_data->xtime_tod_stamp = clock->cycle_last; - vdso_data->xtime_clock_sec = wall_time.tv_sec; - vdso_data->xtime_clock_nsec = wall_time.tv_nsec; + vdso_data->xtime_clock_sec = tk->xtime_sec; + vdso_data->xtime_clock_nsec = tk->xtime_nsec; vdso_data->wtom_clock_sec = wtm->tv_sec; vdso_data->wtom_clock_nsec = wtm->tv_nsec; - vdso_data->mult = clock->mult; - vdso_data->shift = clock->shift; + vdso_data->mult = tk->mult; + vdso_data->shift = tk->shift; smp_wmb(); ++vdso_data->tb_update_count; } Index: tip/arch/tile/kernel/vdso/vgettimeofday.c =================================================================== --- tip.orig/arch/tile/kernel/vdso/vgettimeofday.c +++ tip/arch/tile/kernel/vdso/vgettimeofday.c @@ -83,10 +83,11 @@ int __vdso_gettimeofday(struct timeval * if (count & 1) continue; - cycles = (get_cycles() - vdso_data->xtime_tod_stamp); - ns = (cycles * vdso_data->mult) >> vdso_data->shift; sec = vdso_data->xtime_clock_sec; - ns += vdso_data->xtime_clock_nsec; + cycles = get_cycles() - vdso_data->xtime_tod_stamp; + ns = (cycles * vdso_data->mult) + vdso_data->xtime_clock_nsec; + ns >>= vdso_data->shift; + if (ns >= NSEC_PER_SEC) { ns -= NSEC_PER_SEC; sec += 1; -- 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/