From patchwork Wed Jan 9 02:16:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 10753377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E901613BF for ; Wed, 9 Jan 2019 02:16:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D3E28D8C for ; Wed, 9 Jan 2019 02:16:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC1F928DDD; Wed, 9 Jan 2019 02:16:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 80BB028D8C for ; Wed, 9 Jan 2019 02:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=nU7FmuCWyHbC3pT4NiBeCHOOFfpAO/TndI26v7yKwfw=; b=RxE ksktyeJcO3uUPad2EXWIs/BdqLc9plFxl0T+WXAqfQuFbRkEbvVbwIJZ9vdNXTk7NolntN1ACTOUQ fSspYf7VF/eFXKFZk37fhFnSf9IPH3QkQiczywWU4yeetv544AOLHYJyB37ilrRxUO8+tu5r9bV0s 3jGajNfhaHh4/OPfJoenTCUcD1LzU+FBok95r78s8g7AoXf4Uv1ec0gI5Om2GSJMRNtZiWuqlnRTh j15hrhIEz/qxH5f8jdrr0NMcD2Yz6J6fYp4Fe48IYd9qaojzG35gt+soVPWOHypyhbqtsk+9/XPpl zAkCapQAZtToXzsIPwAIS1A1m6+7VAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gh3QE-0001Yx-QO; Wed, 09 Jan 2019 02:16:46 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gh3QB-0001YU-LY for linux-arm-kernel@lists.infradead.org; Wed, 09 Jan 2019 02:16:45 +0000 Received: by mail-wr1-x443.google.com with SMTP id c14so6123369wrr.0 for ; Tue, 08 Jan 2019 18:16:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WP9AW2JaG2LYFg4TVAG2uP0iTiVnN9sSaijovwmMgCA=; b=FGd1q2ZpBbRxqQ0wO1/P0y/CbKZc1qTxCyQzI1rgw11OxyFC23dTX3tQPoHuj6i/zT MD91x6bIGAOBTTJELUhElWEj+e0Wuled9B/dXM8oKU9OSYOyHrW7dCg5GMVwHpyYe/NI 3HfgtCKlViuEDhPp3SjgiVNidqanC/i2vb1wE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WP9AW2JaG2LYFg4TVAG2uP0iTiVnN9sSaijovwmMgCA=; b=Gt5we1I5XsoZJOTk8DSVPElTquW2g523sxRNS4/a9dPUWtQ3T4xGWrpb1eJEn9Sw9o S2uwVbH4bAO/5x8AYJQU7iq2ahLCWwg2bVxqMEr5AqO4mJlbWr7SczAnTvaGfQRyunSL jWeoab9oSFLvud7YD0IvH0UoIqeuHxns3VZi4DUO+45vIS1vyQf5QplBm5ruIWvGIhxw +U1jZQzIf7npUCYsQsG9LSleO1GuBOgvsMxuxJA7rcHvVfmqIiF7gKxhyqTxf4EV4cG1 uUfVsLKg2hRasDGWvGsjPGIk7NEN0yqKlPtSfX4bFc7VbeAhmw7W7WDeBywN+EANude/ 51nA== X-Gm-Message-State: AJcUukfoizphBTekfF9tAI+YvH0xHPbFlGm9ewhaw3/rqnu0mUs7EuqA Mo0DjrNJZmEAInR9B/kYIidWrQ== X-Google-Smtp-Source: ALg8bN5cGvuXep07gNEPr8i3CgOuh0Op0TtjqX2nym7Dvuk+QpqQNOQMhjTSn7vNj4ZGHHzIaGTibw== X-Received: by 2002:a5d:5182:: with SMTP id k2mr3184118wrv.121.1547000201816; Tue, 08 Jan 2019 18:16:41 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:99e2:bc56:9ad9:69c5]) by smtp.gmail.com with ESMTPSA id w18sm48118868wru.54.2019.01.08.18.16.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Jan 2019 18:16:41 -0800 (PST) From: Vincent Guittot To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, tony@atomide.com Subject: [PATCH] PM/runtime: Fix autosuspend_delay on 32bits arch Date: Wed, 9 Jan 2019 03:16:28 +0100 Message-Id: <1547000188-2732-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190108_181643_714925_4AA5C0C9 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Cast autosuspend_delay in u64 to make sure that the full computation of expires will be done in u64, even on 32bits arch. Otherwise, any delay greater than 2^31 nsec can overflow if signed 32bits is used when moving delay from msec to nsec Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers") Reported-by: Tony Lindgren Tested-by: Tony Lindgren Signed-off-by: Vincent Guittot --- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 7062469..44c5c76 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -141,7 +141,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) last_busy = READ_ONCE(dev->power.last_busy); - expires = last_busy + autosuspend_delay * NSEC_PER_MSEC; + expires = last_busy + (u64)(autosuspend_delay) * NSEC_PER_MSEC; if (expires <= now) expires = 0; /* Already expired. */