From patchwork Tue Jul 17 07:05:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10027 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 85D5623E1B for ; Tue, 17 Jul 2012 07:05:44 +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 40666A185E8 for ; Tue, 17 Jul 2012 07:05:44 +0000 (UTC) Received: by yhpp61 with SMTP id p61so64517yhp.11 for ; Tue, 17 Jul 2012 00:05:43 -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=R3lMOpHBkGB16mwQyio8Chtvv5MeD7WR8jD9tW39Lz8=; b=BmZl8cfKAtyhVhLeIyJDU/vYuT7W0ww3jRNWEdj8yK7yzC9rxmhok4rjBLmvJzuMYc wiA37UtJtypWXSbAeKJpS0AjiCrpXbYau9vbBmeiogaqBDoqdBA7r/JHDPDwXl++cQFB Lw43L9nKxK+dS7xBkzBUgGvkgqyX/ii001wj6zjASt4lqHAIob5VnXzEky1x9k0Y6Bby yFuKKgURPiUCxqcdhbit3iKriXHXM7XqLJZ19EZwAM/dprx0Z3FQhbzydUJ9CQl8JZdv IvEoQBppDPuIgIlKfu9LUuHMo2LyJccbmeVyGVch+KGfzK7T7hlBXWrEpr2Os5yrKl6z 3CRg== Received: by 10.50.163.99 with SMTP id yh3mr427884igb.53.1342508743254; Tue, 17 Jul 2012 00:05:43 -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 lc2csp15892ibb; Tue, 17 Jul 2012 00:05:42 -0700 (PDT) Received: by 10.50.11.129 with SMTP id q1mr481349igb.8.1342508742802; Tue, 17 Jul 2012 00:05:42 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com. [32.97.182.139]) by mx.google.com with ESMTPS id l10si23647933icz.4.2012.07.17.00.05.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 00:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.139 as permitted sender) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.139 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 03:05:42 -0400 Received: from d01dlp01.pok.ibm.com (9.56.224.56) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 03:05:40 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 8A24E38C8054; Tue, 17 Jul 2012 03:05:39 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6H75drK349990; Tue, 17 Jul 2012 03:05:39 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6H75bbP016133; Tue, 17 Jul 2012 03:05:38 -0400 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6H75aBM015997; Tue, 17 Jul 2012 03:05:37 -0400 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.2.x: time: Move common updates to a function Date: Tue, 17 Jul 2012 03:05:17 -0400 Message-Id: <1342508724-14527-5-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342508724-14527-1-git-send-email-johnstul@us.ibm.com> References: <1342508724-14527-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071707-7182-0000-0000-000001FFF2A8 X-Gm-Message-State: ALoCoQn5yfr4Dw52+n/xq8euhGAEWOk+1OFvq76jCrjrF+vXda9eELgjuVmce+NuY0lYZRzJbkT/ 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 5c9b67e..5d55185 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); @@ -636,10 +641,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); @@ -1052,9 +1054,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); } /**