From patchwork Tue Jul 17 17:33:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10054 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 C675C24027 for ; Tue, 17 Jul 2012 17:35:10 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 8B519A182AE for ; Tue, 17 Jul 2012 17:35:10 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so713266yhp.11 for ; Tue, 17 Jul 2012 10:35:10 -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-content-scanned:x-cbid:x-gm-message-state; bh=UyMRYnTFTG5R8wFy40GsOJuqsecfD6JbrYCLmgmdlXI=; b=T2M+O2iDdhRLCTUXjnns2J17do7fJHYYKZYnA806qsa1RKqGR9phpHZj2e0R3zP/fN Kx9bE9pMGJAyHg5gXv5mmYDABCkE7bbLJraqNDZuiNgVjNzii0l5AJxbm8vaXALYt49B ctj9/HHr/9C7X19wbmk4owc8bYvviIoqvc/t23TlsSO4vF0zzbGldcaua13nPpnMkY9p ea+CkHZx0LdP270gNyHDmyiR82ICnFO2cJdfqbwpaVAYIPX3W43HOcq4u4YFXiqjrH/t wrkfxk5HIv+KzAF/0Z8az2xkUls6AkPxl2n2S42wo+EWVKMDxKd573SbHR4TPV7qRroy KS0w== Received: by 10.50.195.234 with SMTP id ih10mr2214982igc.0.1342546510187; Tue, 17 Jul 2012 10:35:10 -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.231.241.2 with SMTP id lc2csp22528ibb; Tue, 17 Jul 2012 10:35:09 -0700 (PDT) Received: by 10.182.111.39 with SMTP id if7mr4552294obb.56.1342546509650; Tue, 17 Jul 2012 10:35:09 -0700 (PDT) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com. [32.97.110.149]) by mx.google.com with ESMTPS id d10si19012441obl.51.2012.07.17.10.35.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 10:35:09 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.149 as permitted sender) client-ip=32.97.110.149; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.149 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 11:35:07 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 11:34:57 -0600 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 1330E19D805C; Tue, 17 Jul 2012 17:34:42 +0000 (WET) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HHYEfC204760; Tue, 17 Jul 2012 11:34:18 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HHZKD0016270; Tue, 17 Jul 2012 11:35:21 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HHZEE5015928; Tue, 17 Jul 2012 11:35:18 -0600 From: John Stultz To: stable@vger.kernel.org Cc: Thomas Gleixner , Eric Dumazet , Richard Cochran , Prarit Bhargava , Linux Kernel , John Stultz Subject: [PATCH 04/11] 3.0.x: time: Move common updates to a function Date: Tue, 17 Jul 2012 13:33:51 -0400 Message-Id: <1342546438-17534-5-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342546438-17534-1-git-send-email-johnstul@us.ibm.com> References: <1342546438-17534-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071717-7282-0000-0000-00000B018E19 X-Gm-Message-State: ALoCoQlMU7rxpT6r7SNy7CQ/H0D3jUsPkAp+52bY48pZRRPX1hUX/uDSh2LkgEb/C4H23HshKXf5 From: Thomas Gleixner This is a backport of cc06268c6a87db156af2daed6e96a936b955cc82 While not a bugfix itself, it allows following fixes to backport in a more straightforward manner. CC: Thomas Gleixner CC: Eric Dumazet CC: Richard Cochran Signed-off-by: Thomas Gleixner Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Linux Kernel Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ac5b225..0b582eb 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -166,6 +166,19 @@ static struct timespec total_sleep_time; */ static struct timespec raw_time; +/* must hold write on xtime_lock */ +static void timekeeping_update(bool clearntp) +{ + if (clearntp) { + timekeeper.ntp_error = 0; + ntp_clear(); + } + update_vsyscall(&xtime, &wall_to_monotonic, + timekeeper.clock, timekeeper.mult); +} + + + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; @@ -366,11 +379,7 @@ int do_settimeofday(const struct timespec *tv) xtime = *tv; - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); + timekeeping_update(true); write_sequnlock_irqrestore(&xtime_lock, flags); @@ -403,11 +412,7 @@ int timekeeping_inject_offset(struct timespec *ts) xtime = timespec_add(xtime, *ts); wall_to_monotonic = timespec_sub(wall_to_monotonic, *ts); - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); + timekeeping_update(true); write_sequnlock_irqrestore(&xtime_lock, flags); @@ -630,10 +635,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta) __timekeeping_inject_sleeptime(delta); - timekeeper.ntp_error = 0; - ntp_clear(); - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); + timekeeping_update(true); write_sequnlock_irqrestore(&xtime_lock, flags); @@ -938,9 +940,7 @@ static void update_wall_time(void) wall_to_monotonic.tv_sec -= leap; } - /* check to see if there is a new clocksource to use */ - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); + timekeeping_update(false); } /**