From patchwork Mon Sep 17 22:04:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11475 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 774D424182 for ; Mon, 17 Sep 2012 22:05:25 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id E63AB3D08FEB for ; Mon, 17 Sep 2012 22:05:24 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so5440845iaf.11 for ; Mon, 17 Sep 2012 15:05:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references:x-cbid :x-gm-message-state; bh=+XEaU982iUFyWeB1hkTRKgsEnhNnOwbNAaaq58aIzBc=; b=FighNNFVxpPzDWLMa1Ajj4FvLdkwCXTEOTPA0aPfNH7AXICxDx1FhqfyG6VrqACVh0 wCuIyHs2xsN5O/EWmeEhjRqF5wmUiI6NkVWAq9/XwPanzrEPsQNkdL3jp+wI+hQ0GWIJ FIfYR71x+odyfCKIYIEaXnLvx5h/EuwXmmA6mb9WplcW74QZtMvn73mVWo8blwJjDjLy sv16KOO2IdZfr5P0Y5bl+RtgstZ1EEk2LRBcLQlIQuFEpBQKVCbi1AHQ0SgDb7Cj2lVX rItjLxGj/xmhkep32M9TBB8zA1Gm9FCopc1e7DUE9pd/ANCahNdbd8yjAhb0hDHRJnKM Kirw== Received: by 10.50.7.212 with SMTP id l20mr8345984iga.43.1347919524701; Mon, 17 Sep 2012 15:05:24 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp341512igc; Mon, 17 Sep 2012 15:05:24 -0700 (PDT) Received: by 10.42.215.144 with SMTP id he16mr10183472icb.19.1347919524341; Mon, 17 Sep 2012 15:05:24 -0700 (PDT) Received: from e2.ny.us.ibm.com (e2.ny.us.ibm.com. [32.97.182.142]) by mx.google.com with ESMTPS id nu6si15793464icb.77.2012.09.17.15.05.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 15:05:24 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.142 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.142; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.142 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Sep 2012 18:05:23 -0400 Received: from d01relay06.pok.ibm.com (9.56.227.116) by e2.ny.us.ibm.com (192.168.1.102) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Sep 2012 18:05:20 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8HM5HDN9044026; Mon, 17 Sep 2012 18:05:17 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8HM5FiB014655; Mon, 17 Sep 2012 19:05:17 -0300 Received: from kernel-pok.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8HM5DvH014521; Mon, 17 Sep 2012 19:05:15 -0300 From: John Stultz To: linux-kernel Cc: John Stultz , Tony Luck , Paul Mackerras , Benjamin Herrenschmidt , Andy Lutomirski , Martin Schwidefsky , Paul Turner , Steven Rostedt , Richard Cochran , Prarit Bhargava , Thomas Gleixner Subject: [PATCH 4/6][RFC] time: Introduce new GENERIC_TIME_VSYSCALL Date: Mon, 17 Sep 2012 18:04:59 -0400 Message-Id: <1347919501-64534-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347919501-64534-1-git-send-email-john.stultz@linaro.org> References: <1347919501-64534-1-git-send-email-john.stultz@linaro.org> x-cbid: 12091722-5112-0000-0000-00000C7C5CA3 X-Gm-Message-State: ALoCoQlSNP/trUMdoZzXBJl9trWuX9gj464lV2aSRUT1l3Dk/Z477E9gJMMMkffqSpw3WGTDd/eA Now that we moved everyone over to GENERIC_TIME_VSYSCALL_OLD, introduce the new declaration and config option for the new update_vsyscall method. Cc: Tony Luck Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Andy Lutomirski Cc: Martin Schwidefsky Cc: Paul Turner Cc: Steven Rostedt Cc: Richard Cochran Cc: Prarit Bhargava Cc: Thomas Gleixner Signed-off-by: John Stultz --- include/linux/timekeeper_internal.h | 36 ++++++++++++++++++++++++++++------- kernel/time/Kconfig | 4 ++++ kernel/time/timekeeping.c | 14 +------------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index a904d76..8896471 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -66,16 +66,38 @@ struct timekeeper { seqlock_t lock; }; +static inline struct timespec tk_xtime(struct timekeeper *tk) +{ + struct timespec ts; + + ts.tv_sec = tk->xtime_sec; + ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); + return ts; +} + + +#ifdef CONFIG_GENERIC_TIME_VSYSCALL + +extern void update_vsyscall(struct timekeeper *tk); +extern void update_vsyscall_tz(void); -#ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD -extern void -update_vsyscall_old(struct timespec *ts, struct timespec *wtm, - struct clocksource *c, u32 mult); +#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) + +extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, + struct clocksource *c, u32 mult); extern void update_vsyscall_tz(void); + +static inline void update_vsyscall(struct timekeeper *tk) +{ + struct timespec xt; + + xt = tk_xtime(tk); + update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); +} + #else -static inline void -update_vsyscall_old(struct timespec *ts, struct timespec *wtm, - struct clocksource *c, u32 mult) + +static inline void update_vsyscall(struct timekeeper *tk); { } static inline void update_vsyscall_tz(void) diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig index 489c861..8601f0d 100644 --- a/kernel/time/Kconfig +++ b/kernel/time/Kconfig @@ -13,6 +13,10 @@ config ARCH_CLOCKSOURCE_DATA bool # Timekeeping vsyscall support +config GENERIC_TIME_VSYSCALL + bool + +# Timekeeping vsyscall support config GENERIC_TIME_VSYSCALL_OLD bool diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index bdce688..61eaf3b 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -42,15 +42,6 @@ static inline void tk_normalize_xtime(struct timekeeper *tk) } } -static struct timespec tk_xtime(struct timekeeper *tk) -{ - struct timespec ts; - - ts.tv_sec = tk->xtime_sec; - ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); - return ts; -} - static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts) { tk->xtime_sec = ts->tv_sec; @@ -192,14 +183,11 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) /* must hold write on timekeeper.lock */ static void timekeeping_update(struct timekeeper *tk, bool clearntp) { - struct timespec xt; - if (clearntp) { tk->ntp_error = 0; ntp_clear(); } - xt = tk_xtime(tk); - update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); + update_vsyscall(tk); } /**