From patchwork Thu Feb 5 00:45:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 44396 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9762C2029F for ; Thu, 5 Feb 2015 00:45:34 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf3307031wgh.1 for ; Wed, 04 Feb 2015 16:45:33 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=jkNt2VtEWZl5vxHFhFIH4pzVmTHJq+9mGWweALY8gGI=; b=lajt/9hYu2DIIzvKFvvsQ/2lKejHPi2ClTlgqoRSKELn/lX4sP0YLlVHOQHF0Ie2Fx lRtzK37D3hK73vzodEAZGBgY9HDfXWpxwxhQKt1bSv1VwwrGDDwy9Pvv36buHjI4/SPp RZYRaT+xUWXlLcQTQpyPWhoqDBtpy/N6E/xDjFv0hOWUmIJRx+Xj+sMB0CKj03CI+RFz pwnQo8S2/HXg9EG5CKkRoLZ3Pza6NbEja1qVkZK3lfXG8z+E8snDCYT6KJqNmAysXZbI 4lAhXVnhmtzLwO35gG/MnPHHp7islSHIQTp2ZHXER4ewNWV709R8kcz/pvf83cg2I79J Rshg== X-Gm-Message-State: ALoCoQmdbVOFu+Oask1ZyhsbjDcMQ3gD5/I1qh3a5R8mtvfJBNAktW0QkDgi0mLnb0D0MSOnpNVp X-Received: by 10.152.37.130 with SMTP id y2mr112595laj.8.1423097133509; Wed, 04 Feb 2015 16:45:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.68 with SMTP id k4ls93962lam.85.gmail; Wed, 04 Feb 2015 16:45:33 -0800 (PST) X-Received: by 10.152.37.106 with SMTP id x10mr1004954laj.52.1423097133212; Wed, 04 Feb 2015 16:45:33 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id st5si187097lbb.56.2015.02.04.16.45.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 16:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id hv19so3405399lab.10 for ; Wed, 04 Feb 2015 16:45:32 -0800 (PST) X-Received: by 10.112.25.104 with SMTP id b8mr851594lbg.69.1423097132909; Wed, 04 Feb 2015 16:45:32 -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.112.35.133 with SMTP id h5csp830455lbj; Wed, 4 Feb 2015 16:45:32 -0800 (PST) X-Received: by 10.66.254.68 with SMTP id ag4mr1379758pad.39.1423097131219; Wed, 04 Feb 2015 16:45:31 -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 a9si4128794pas.76.2015.02.04.16.45.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 16:45:31 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.181 as permitted sender) client-ip=209.85.192.181; Received: by pdiy13 with SMTP id y13so4092774pdi.8 for ; Wed, 04 Feb 2015 16:45:30 -0800 (PST) X-Received: by 10.66.160.66 with SMTP id xi2mr1408393pab.3.1423097130220; Wed, 04 Feb 2015 16:45:30 -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 hn4sm453922pdb.58.2015.02.04.16.45.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 16:45:29 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Thomas Gleixner , Ingo Molnar , stable Subject: [PATCH] hrtimer: Fix incorrect tai offset calculation for non high-res timer systems Date: Wed, 4 Feb 2015 16:45:26 -0800 Message-Id: <1423097126-10236-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) 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: , For tip/timers/urgent I noticed some CLOCK_TAI timer test failures on one of my less-frequently used configurations. And after digging in I found in 76f4108892d9 (Cleanup hrtimer accessors to the timekepeing state), the hrtimer_get_softirq_time tai offset calucation was incorrectly rewritten, as the tai offset we return shold be from CLOCK_MONOTONIC, and not CLOCK_REALTIME. This results in CLOCK_TAI timers expiring early on non-highres capable machines. This patch fixes the issue, calculating the tai time properly from the monotonic base. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: stable # 3.17+ Signed-off-by: John Stultz --- kernel/time/hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 37e50aa..d8c724c 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -122,7 +122,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) mono = ktime_get_update_offsets_tick(&off_real, &off_boot, &off_tai); boot = ktime_add(mono, off_boot); xtim = ktime_add(mono, off_real); - tai = ktime_add(xtim, off_tai); + tai = ktime_add(mono, off_tai); base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim; base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono;