From patchwork Thu Jan 23 01:34:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 23562 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DA06B203C6 for ; Thu, 23 Jan 2014 01:35:18 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id j1sf5071453iga.0 for ; Wed, 22 Jan 2014 17:35: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=XWWfOQD3ZI5xQzJIe8t31ZpFYou4+HujofjW7rMDZXc=; b=PCfZube350mV8/q2QrnK+OI4jwe0dAJdsz0LaI+8MBuwO40sxqCi8XK9zTjCC+bHUJ H4l+S8A4EUMBD1rbxO7MGF3jwAHhSlNWaUoBNyXNKdeMDLaMKKNarXUaIv5AFunNAoAi XHgGZ4Qi48rd6PMsPcEOGKzfdBYGsHCTQF/aQpUyGhEMFA+BRYsuQ308Hlde+LxxspM8 sWsFPDfOT3AJ8XwjBQxp/2l8jQH24DhIN07qLSfGtn1/fndBB79+nfplJKlX4xi8d7pL c7Z6V6NvBTXbYUxzTln/IsjeHiLhKNiH6vWoh0rJjoiQnze+yOc18T69AZfw8xuPAndf Ix0w== X-Gm-Message-State: ALoCoQl0u32rmo8DmGyTbjS1xHQmxLY65Ym5Ql7fDuOYnT8+ifvksXqweGdJR08fyFMMX+7jy5Yp X-Received: by 10.182.111.134 with SMTP id ii6mr1959466obb.38.1390440918071; Wed, 22 Jan 2014 17:35:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.36.229 with SMTP id t5ls225077qej.61.gmail; Wed, 22 Jan 2014 17:35:18 -0800 (PST) X-Received: by 10.220.193.132 with SMTP id du4mr91074vcb.39.1390440917960; Wed, 22 Jan 2014 17:35:17 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id wm4si1655233vcb.4.2014.01.22.17.35.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ia6so692636vcb.24 for ; Wed, 22 Jan 2014 17:35:17 -0800 (PST) X-Received: by 10.220.139.136 with SMTP id e8mr94697vcu.34.1390440917837; Wed, 22 Jan 2014 17:35:17 -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 u4csp224917vcz; Wed, 22 Jan 2014 17:35:17 -0800 (PST) X-Received: by 10.68.92.98 with SMTP id cl2mr4962460pbb.81.1390440916939; Wed, 22 Jan 2014 17:35:16 -0800 (PST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by mx.google.com with ESMTPS id dv5si11857679pbb.343.2014.01.22.17.35.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.52 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.52; Received: by mail-pa0-f52.google.com with SMTP id bj1so1172645pad.25 for ; Wed, 22 Jan 2014 17:35:16 -0800 (PST) X-Received: by 10.66.138.40 with SMTP id qn8mr5167626pab.154.1390440916266; Wed, 22 Jan 2014 17:35:16 -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 j3sm29268483pbh.38.2014.01.22.17.35.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:15 -0800 (PST) From: John Stultz To: stable Cc: John Stultz , Sasha Levin , Thomas Gleixner , Prarit Bhargava , Richard Cochran , Ingo Molnar Subject: [PATCH 4/6] 3.13.y: timekeeping: Fix CLOCK_TAI timer/nanosleep delays Date: Wed, 22 Jan 2014 17:34:57 -0800 Message-Id: <1390440899-10273-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390440899-10273-1-git-send-email-john.stultz@linaro.org> References: <1390440899-10273-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.220.179 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.13-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 89bf18e..139aaee 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -77,7 +77,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) @@ -595,7 +595,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)); } /**