From patchwork Tue Jul 17 22:05:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 10091 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 6015023F2A for ; Tue, 17 Jul 2012 22:05:51 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1A4B2A1829A for ; Tue, 17 Jul 2012 22:05:51 +0000 (UTC) Received: by yenq6 with SMTP id q6so1059443yen.11 for ; Tue, 17 Jul 2012 15:05: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=Z7iSbmgtEHi05W/KaRzvvnAgRg2dwR9s3K2kbpA6KlI=; b=OBy2L5z2ZT39HblMLreWUgofexVOXEEOvyNs95zVaM0cQLm1esYmsaG60Hrz4tV3Be kvSSW56ucDyzizIOH1IJCurQ4vIo6sBNqUVWnZIUr9GAwFDzIcMowcskRKY0IVk//bYD kSgPsG4IPQJel5UeqxSzviQeyG7RL7emRFPUu8/0ekrrVdc1l/IL959X4Njvcm9jyy0H kxMjtFVBMsdUt8YcjCEA+AMeA/v6mPSvfWyf3OpLC+kzgjbHJvLoyd7D39Cah45xBgkb uX70K/PiQ6HLvmiGcx05QyoKKnBGRYfTfEFI4bpZUDhnu24yKwcRFhSzGXOmeLDr0z68 Y9lg== Received: by 10.50.203.39 with SMTP id kn7mr194334igc.53.1342562750282; Tue, 17 Jul 2012 15:05: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 lc2csp25039ibb; Tue, 17 Jul 2012 15:05:48 -0700 (PDT) Received: by 10.42.10.73 with SMTP id p9mr2443448icp.43.1342562748124; Tue, 17 Jul 2012 15:05:48 -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 mw1si26613111icb.16.2012.07.17.15.05.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2012 15:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.142 as permitted sender) client-ip=32.97.182.142; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.142 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 18:05:47 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e2.ny.us.ibm.com (192.168.1.102) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 18:05:44 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 39A876E8057; Tue, 17 Jul 2012 18:05:44 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HM5h9i385938; Tue, 17 Jul 2012 18:05:43 -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 q6HM5hUW022965; Tue, 17 Jul 2012 19:05:43 -0300 Received: from kernel.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 q6HM5hMc022948; Tue, 17 Jul 2012 19:05:43 -0300 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.32.x: time: Move common updates to a function Date: Tue, 17 Jul 2012 18:05:28 -0400 Message-Id: <1342562735-55870-5-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342562735-55870-1-git-send-email-johnstul@us.ibm.com> References: <1342562735-55870-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071722-5112-0000-0000-00000A296A3D X-Gm-Message-State: ALoCoQlBx48g7ZJsZBh7t/lkXRpNdrUFP/JhT7Wh0g6dHSw18RTaDzVrfYqfHonh6pSPG+1Iw5ka 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 6d19a00..a969adf 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; @@ -341,10 +353,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); @@ -832,8 +841,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); } /**