From patchwork Tue Jul 17 21:49:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10079 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 48E3023E3D for ; Tue, 17 Jul 2012 21:49:51 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id F05E0A181FE for ; Tue, 17 Jul 2012 21:49:50 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1041205ghb.11 for ; Tue, 17 Jul 2012 14:49:50 -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=CsK/XxhExyOPXOXmhl8R4E33A+WA8rkpScDGoFy0Sb0=; b=Vvd3CgrPSfCSItDORj1akoMbOkeKyWIpEL5XIRsMKz8JlIbj0dqLwKorvsirP95xdc mwSxV6UCTWnHzMpntjQHYOW3qWlxppexJFBnq5QxxvzFsI9OFHDWaFt/h8K7VPeq3xxs S3Du1XHrEwMyNt9+AeXl8hydACoX/hXOHPmdMOKS3DuTj+qswyRQVnj7Ypjqu87RC9cI C2e6OPTzSQ0VtmENZy2UnaO4Fjy2Mbkgk0qHo0L+n/0Abtj00cRoffYo84pinQnEu2+I 1xMzSX1zxCLwf3LhDmIS+RQE79qhFYyEjTnvJ2RhwFarBNVF/ESa2g2xduyokzOdhTsV Uvhw== Received: by 10.50.160.198 with SMTP id xm6mr248339igb.0.1342561790195; Tue, 17 Jul 2012 14:49:50 -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 lc2csp24861ibb; Tue, 17 Jul 2012 14:49:49 -0700 (PDT) Received: by 10.50.47.166 with SMTP id e6mr166109ign.55.1342561789796; Tue, 17 Jul 2012 14:49:49 -0700 (PDT) Received: from e36.co.us.ibm.com (e36.co.us.ibm.com. [32.97.110.154]) by mx.google.com with ESMTPS id dk7si18182896igb.70.2012.07.17.14.49.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 14:49:49 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.154 as permitted sender) client-ip=32.97.110.154; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.154 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 15:49:49 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 15:49:47 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id D3AD73E40051; Tue, 17 Jul 2012 21:49:45 +0000 (WET) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HLnimS157984; Tue, 17 Jul 2012 15:49:45 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HLneUG026635; Tue, 17 Jul 2012 15:49:41 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HLnZI2026401; Tue, 17 Jul 2012 15:49:39 -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] 2.6.34.x: time: Move common updates to a function Date: Tue, 17 Jul 2012 17:49:24 -0400 Message-Id: <1342561771-55678-5-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342561771-55678-1-git-send-email-johnstul@us.ibm.com> References: <1342561771-55678-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071721-7606-0000-0000-0000021489B7 X-Gm-Message-State: ALoCoQkeSIdY4dPpfOjxo97rhd3oWSv8stSgaKEQmvsWu1/CZkomGgYX1Gmc0Uo8aXrQMbjF9Wu8 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index f8d4877..adfa89d 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -166,6 +166,18 @@ static struct timespec total_sleep_time; */ 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, timekeeper.clock, timekeeper.mult); +} + + + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; @@ -330,10 +342,7 @@ int do_settimeofday(struct timespec *tv) update_xtime_cache(0); - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); + timekeeping_update(true); write_sequnlock_irqrestore(&xtime_lock, flags); @@ -858,8 +867,7 @@ void update_wall_time(void) nsecs = clocksource_cyc2ns(offset, timekeeper.mult, timekeeper.shift); update_xtime_cache(nsecs); - /* check to see if there is a new clocksource to use */ - update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); + timekeeping_update(false); } /**