From patchwork Tue Mar 9 16:37:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 47170 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B0A22B7CF8 for ; Wed, 10 Mar 2010 03:37:29 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Np2Qt-0000IT-4i; Tue, 09 Mar 2010 16:37:23 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Np2Qq-0000I3-Rj for kernel-team@lists.ubuntu.com; Tue, 09 Mar 2010 16:37:20 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1Np2Qq-0007RW-QS; Tue, 09 Mar 2010 16:37:20 +0000 Received: from cpc7-craw6-2-0-cust128.croy.cable.virginmedia.com ([94.172.219.129] helo=[192.168.1.21]) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Np2Qq-0007LT-Mf; Tue, 09 Mar 2010 16:37:20 +0000 Subject: [PATCH] softlockup: stop softlockup messages due to touch_ts math overflow From: Colin Ian King To: kernel-team Date: Tue, 09 Mar 2010 16:37:19 +0000 Message-ID: <1268152639.1715.92.camel@lenovo> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Hi, This patch will fix a math overflow error that causes spurious soft lockup error messages. It catches a corner case, for example, just when the TSC heads towards a 64 bit wrap-around when the upper 32 bits are set to 0xffffffff. While this normally does not happen (since it requires an uptime of possibly thousands of years, it may happen if the TSC warps during S3). If this looks sane, I'll sent it upstream. Colin From 2eca87a1eab20d49ee4edceb1642325bd81ec020 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 9 Mar 2010 16:19:18 +0000 Subject: [PATCH] softlockup: stop softlockup messages due to touch_ts math overflow Ensure math does not overflow when touch_ts is close to the upper bounds. This occurs when the top 32 bits of the TSC reach 0xffffffff causing additions to touch_ts to overflow and this in turn generates spurious softlockup warnings. While this normally does not happen (since it requires an uptime of possibly thousands of years, it may happen if the TSC warps during S3). Signed-off-by: Colin Ian King --- kernel/softlockup.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/softlockup.c b/kernel/softlockup.c index 0d4c789..463652e 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c @@ -155,11 +155,13 @@ void softlockup_tick(void) * Wake up the high-prio watchdog task twice per * threshold timespan. */ - if (now > touch_ts + softlockup_thresh/2) + if ((unsigned long long)now > + (unsigned long long)touch_ts + softlockup_thresh/2) wake_up_process(per_cpu(softlockup_watchdog, this_cpu)); /* Warn about unreasonable delays: */ - if (now <= (touch_ts + softlockup_thresh)) + if ((unsigned long long)now <= + ((unsigned long long)touch_ts + softlockup_thresh)) return; per_cpu(softlockup_print_ts, this_cpu) = touch_ts; -- 1.6.3.3