From patchwork Wed Dec 11 19:11:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22255 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 46D3C202E6 for ; Wed, 11 Dec 2013 19:11:51 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf14396443veb.8 for ; Wed, 11 Dec 2013 11:11:51 -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=+iBeu+Qx7cYufHx4Zjm3L7RJOgBpTsSjhfGnoxKG/fg=; b=J17riDOFvrc8e6jYw6vFE0uqZjJeTy9c+zs252c1cFw5bv0kkAlIzBaZox/2wExEXC LXwHEzEm2UVLdu4uP9wtzIZ3s2pVdjOuB64iEn2qsJOfK+tLejnSGBppSeFPPjauqWAi 63SrQN/kREVnsXufcDUGQRtKl38liaOED+5YBdFvktkIO2DNb6fDl2VHXN2xQZfER6xi A36KUBpgBoMMlC0CmaQ/IFC3hXJv9m6Rv9MKSK8i3D9WwkUFfsmXPE/rmGvIwB4mvBhd ZM/gau3QCPHKd9a8KAu5X7S93Ay/a+XkD7F+vogpFMKriTq0p21JaKAfhDyxabe87emW gFRg== X-Gm-Message-State: ALoCoQmTmNK2QpbcsBEMrBo6z6ly4zySxtRq2vu+g9II0VXI7CPQ2uiX4AP5Hp/NyRs0vte/pdAt X-Received: by 10.52.244.136 with SMTP id xg8mr1075684vdc.7.1386789111124; Wed, 11 Dec 2013 11:11:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.76 with SMTP id gc12ls195097qeb.44.gmail; Wed, 11 Dec 2013 11:11:51 -0800 (PST) X-Received: by 10.58.155.162 with SMTP id vx2mr704170veb.46.1386789111000; Wed, 11 Dec 2013 11:11:51 -0800 (PST) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id x16si171749vct.30.2013.12.11.11.11.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.54 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.54; Received: by mail-vb0-f54.google.com with SMTP id g10so1974495vbg.13 for ; Wed, 11 Dec 2013 11:11:50 -0800 (PST) X-Received: by 10.52.72.49 with SMTP id a17mr1060283vdv.20.1386789110854; Wed, 11 Dec 2013 11:11:50 -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 u4csp296254vcz; Wed, 11 Dec 2013 11:11:50 -0800 (PST) X-Received: by 10.68.197.165 with SMTP id iv5mr4023488pbc.150.1386789110033; Wed, 11 Dec 2013 11:11:50 -0800 (PST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id yd9si14326294pab.321.2013.12.11.11.11.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id w10so10041530pde.7 for ; Wed, 11 Dec 2013 11:11:49 -0800 (PST) X-Received: by 10.69.29.107 with SMTP id jv11mr3909354pbd.147.1386789109588; Wed, 11 Dec 2013 11:11:49 -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 ki1sm34506989pbd.1.2013.12.11.11.11.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 11:11:48 -0800 (PST) From: John Stultz To: LKML Cc: John Stultz , Thomas Gleixner , Prarit Bhargava , Richard Cochran , Ingo Molnar , stable Subject: [RFC][PATCH 4/5] timekeeping: Fix CLOCK_TAI timer/nanosleep delays Date: Wed, 11 Dec 2013 11:11:37 -0800 Message-Id: <1386789098-17391-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386789098-17391-1-git-send-email-john.stultz@linaro.org> References: <1386789098-17391-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.54 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: , 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: 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 c1d36b6..a4c5742 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)); } /**