From patchwork Mon Feb 10 21:07:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24419 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 05E0920143 for ; Mon, 10 Feb 2014 21:07:41 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf14945481pbc.0 for ; Mon, 10 Feb 2014 13:07:41 -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=Cg/mIHF86GNkVT8JH64+bfXfzSWaXD7QAIkGAwqpRjFae7pRsDenEpUcMWv9LKq7ii TVQNHf5IRhGvwjjANe9MFFwp/l4opybHI0RAPI8VA/qjYeCJCk2KRIEuS0DuWvUdgS/l LdVnmJj8KOza2THdhTOSSaOVd5NkJp8vLyGoOqxWtmSfcHHrLBAOaTpCsaccG1xMVDUq 0f21Bu2AfQ8rF3vmON1Po8yqSberHed+qezncb3RH4aVBI/WACZE0GkvImuCwACQR3z3 SU7rQlI9Z20xcN+6C2ridXS8GCBk5EQCo+Wc9L6qT4xS1Gmhi8RaX9eWezxeLdGzrwXM GgBQ== X-Gm-Message-State: ALoCoQmrB9rsbtH1XY5icuGJDKjYgX8q2b5jpwCRizvVMuyMBI/5860J5tgZqfLCJnV7+yF1ANYE X-Received: by 10.66.144.228 with SMTP id sp4mr10390737pab.5.1392066461202; Mon, 10 Feb 2014 13:07:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.149 with SMTP id c21ls2244355qgd.52.gmail; Mon, 10 Feb 2014 13:07:41 -0800 (PST) X-Received: by 10.52.185.196 with SMTP id fe4mr2708121vdc.27.1392066461084; Mon, 10 Feb 2014 13:07:41 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id bj3si5156050vcb.64.2014.02.10.13.07.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:41 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id i11so2112404vbh.1 for ; Mon, 10 Feb 2014 13:07:41 -0800 (PST) X-Received: by 10.53.13.44 with SMTP id ev12mr21367688vdd.17.1392066460963; Mon, 10 Feb 2014 13:07:40 -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 u4csp197767vcz; Mon, 10 Feb 2014 13:07:40 -0800 (PST) X-Received: by 10.67.3.40 with SMTP id bt8mr27582236pad.78.1392066460041; Mon, 10 Feb 2014 13:07:40 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id gx4si16566004pbc.351.2014.02.10.13.07.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:40 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id y10so6575276pdj.40 for ; Mon, 10 Feb 2014 13:07:39 -0800 (PST) X-Received: by 10.66.119.172 with SMTP id kv12mr28035078pab.34.1392066459603; Mon, 10 Feb 2014 13:07:39 -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 bz4sm45596387pbb.12.2014.02.10.13.07.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:38 -0800 (PST) From: John Stultz To: stable Cc: John Stultz , Sasha Levin , Thomas Gleixner , Prarit Bhargava , Richard Cochran , Ingo Molnar Subject: [PATCH 5/7] 3.13.y: timekeeping: Fix CLOCK_TAI timer/nanosleep delays Date: Mon, 10 Feb 2014 13:07:22 -0800 Message-Id: <1392066444-4940-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392066444-4940-1-git-send-email-john.stultz@linaro.org> References: <1392066444-4940-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.212.42 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)); } /**