From patchwork Tue Sep 15 01:05:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 53607 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 575F822B17 for ; Tue, 15 Sep 2015 01:05:37 +0000 (UTC) Received: by lbot4 with SMTP id t4sf2434528lbo.0 for ; Mon, 14 Sep 2015 18:05:36 -0700 (PDT) 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=wvhA1XiDjUtDd5PlouEqEZtXyKBas9+ATMA9hcoPyiw=; b=CYNwt3voVM7eRY2mg4pwER4tqA7TccXptLl23PWchmedMjW6LtTDwhr5Pt3vdBQ8Uq jRrkvkWHzXB/dTb3eBHZ8YULDOdFhYtozOOikOYdxvcENjubpb1jYQVpQ6bSZYzh2mnR lEizOi6AKqIAN9hc+A6W4KmGzGDIPBjxEMPaUQb3CJ1cbxT5uA8UnObGavX6RtgTTijs 5b5JLThiNh7/44GvpGa1VlbFuozmJSHSIDjT9E2O3fW6bm1BNHDuEL3DHPrl6O/s37nE tCuQfpckCfiPsdPEeelVXrXVrAA2hHUGF78XCnOCt9qWlEU+vLfthxzP9HT5L4iQAkjx j4sQ== X-Gm-Message-State: ALoCoQnXJ7QdFsdLTuuAoOiaCI/SLCTaRJ8lKw1TLprNwMCalW9Fwc4A9MDJE+301c2gYZPx5dlK X-Received: by 10.195.12.234 with SMTP id et10mr824713wjd.2.1442279136243; Mon, 14 Sep 2015 18:05:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.232 with SMTP id 8ls647146lap.103.gmail; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) X-Received: by 10.152.10.34 with SMTP id f2mr17175931lab.37.1442279135941; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id e3si3960271lbc.171.2015.09.14.18.05.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lahg1 with SMTP id g1so67783549lah.1 for ; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr17441479lbb.29.1442279135505; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) 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.59.35 with SMTP id w3csp1489173lbq; Mon, 14 Sep 2015 18:05:34 -0700 (PDT) X-Received: by 10.50.126.100 with SMTP id mx4mr1180475igb.3.1442279134220; Mon, 14 Sep 2015 18:05:34 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com. [209.85.220.50]) by mx.google.com with ESMTPS id i34si11211046ioo.198.2015.09.14.18.05.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by pacex6 with SMTP id ex6so159231681pac.0 for ; Mon, 14 Sep 2015 18:05:33 -0700 (PDT) X-Received: by 10.66.66.202 with SMTP id h10mr40726334pat.145.1442279133300; Mon, 14 Sep 2015 18:05:33 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id td5sm18441531pbc.67.2015.09.14.18.05.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Sep 2015 18:05:32 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Prarit Bhargava , Richard Cochran , Ingo Molnar , Thomas Gleixner Subject: [RFC][PATCH 1/5] clocksource: Fix abs() usage w/ 64bit values Date: Mon, 14 Sep 2015 18:05:20 -0700 Message-Id: <1442279124-7309-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> References: <1442279124-7309-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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mailfrom=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 patch fixes one cases where abs() was being used with 64-bit nanosecond values, where the result may be capped at 32-bits. This potentially could cause watchdog false negatives on 32-bit systems, so this patch addresses the issue by using abs64(). Cc: Prarit Bhargava Cc: Richard Cochran Cc: Ingo Molnar Cc: Thomas Gleixner Signed-off-by: John Stultz --- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 841b72f..3a38775 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -217,7 +217,7 @@ static void clocksource_watchdog(unsigned long data) continue; /* Check the deviation from the watchdog clocksource. */ - if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) { + if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n", cs->name); pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n",