From patchwork Mon Feb 10 21:11:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24425 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4901920143 for ; Mon, 10 Feb 2014 21:12:19 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id y10sf14357001pdj.3 for ; Mon, 10 Feb 2014 13:12:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=SIYpbH87AhseQ6ibKnwR44iiJRhgWUd8WeXjAc8/7+Q=; b=GB+14Z44U4VQlGhOw+Zg9yM1KaadAbKcjApLd6gQ9PzhhyxTI6tf2WiCP2Rk1Bwi15 1ZWhVFL8Sw86lwDSpZeSp6qF/oi91LJPnl8tKywiPea/fjsEsf0EsxfW59JhD97giMAr F821M5eBGEULn2nYbMdVvAk/7KPxX4xzA01cwLnz6+KOLtKMKCj6ttbdxW3TANERA+++ cKabMqjpJQNc8FhOoK0cbhSr/1cdY741lzEhUenGrJ4KHmmRLrY26K6dH1vZSqNM4TRh bd1UR++SAH0U2vOnc7iB3ozHKbtVOwWOCgSstOcvB3C5Ufe8SQAe2aM7evTuCSBDRzFY kkSg== X-Gm-Message-State: ALoCoQnVsK7ZRHm2/B7+YO6rI1Ku5DmGTSsEvRNBMKEeku0g5lMuqtE+mx7Vx756WE5/U70NIlMO X-Received: by 10.68.223.202 with SMTP id qw10mr13057299pbc.6.1392066738383; Mon, 10 Feb 2014 13:12:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.149 with SMTP id c21ls2245679qgd.52.gmail; Mon, 10 Feb 2014 13:12:18 -0800 (PST) X-Received: by 10.58.248.198 with SMTP id yo6mr61939vec.40.1392066738192; Mon, 10 Feb 2014 13:12:18 -0800 (PST) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id cl8si5158416vcb.76.2014.02.10.13.12.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:12:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id c14so5400867vea.17 for ; Mon, 10 Feb 2014 13:12:18 -0800 (PST) X-Received: by 10.221.37.1 with SMTP id tc1mr144000vcb.32.1392066738082; Mon, 10 Feb 2014 13:12:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp198047vcz; Mon, 10 Feb 2014 13:12:03 -0800 (PST) X-Received: by 10.68.201.10 with SMTP id jw10mr40174559pbc.25.1392066723157; Mon, 10 Feb 2014 13:12:03 -0800 (PST) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id qx4si16597432pbc.285.2014.02.10.13.12.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:12:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id rp16so6740771pbb.6 for ; Mon, 10 Feb 2014 13:12:02 -0800 (PST) X-Received: by 10.68.0.35 with SMTP id 3mr39606955pbb.52.1392066722025; Mon, 10 Feb 2014 13:12:02 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qh2sm119192622pab.13.2014.02.10.13.12.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:12:01 -0800 (PST) From: John Stultz To: stable Cc: John Stultz , Sasha Levin , Thomas Gleixner , Prarit Bhargava , Richard Cochran , Ingo Molnar Subject: [PATCH 3/5] 3.10.y: timekeeping: Fix CLOCK_TAI timer/nanosleep delays Date: Mon, 10 Feb 2014 13:11:51 -0800 Message-Id: <1392066713-5025-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392066713-5025-1-git-send-email-john.stultz@linaro.org> References: <1392066713-5025-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This is a 3.10 stable backport of 04005f6011e3b504cd4d791d9769f7cb9a3b2eae A think-o in the calculation of the monotonic -> tai time offset results in CLOCK_TAI timers and nanosleeps to expire late (the latency is ~2x the tai offset). Fix this by adding the tai offset from the realtime offset instead of subtracting. Cc: Sasha Levin Cc: Thomas Gleixner Cc: Prarit Bhargava Cc: Richard Cochran Cc: Ingo Molnar Cc: stable #3.10+ Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 88c2b8b..40f75a0 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -72,7 +72,7 @@ static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec wtm) tk->wall_to_monotonic = wtm; set_normalized_timespec(&tmp, -wtm.tv_sec, -wtm.tv_nsec); tk->offs_real = timespec_to_ktime(tmp); - tk->offs_tai = ktime_sub(tk->offs_real, ktime_set(tk->tai_offset, 0)); + tk->offs_tai = ktime_add(tk->offs_real, ktime_set(tk->tai_offset, 0)); } static void tk_set_sleep_time(struct timekeeper *tk, struct timespec t) @@ -590,7 +590,7 @@ s32 timekeeping_get_tai_offset(void) static void __timekeeping_set_tai_offset(struct timekeeper *tk, s32 tai_offset) { tk->tai_offset = tai_offset; - tk->offs_tai = ktime_sub(tk->offs_real, ktime_set(tai_offset, 0)); + tk->offs_tai = ktime_add(tk->offs_real, ktime_set(tai_offset, 0)); } /**