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: 155041 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp190374jaa; Tue, 8 Jan 2019 18:16:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN4zo79Sh8kuPJArkDcEK7PbVf32v9TjlhxVQU4cLmVh6aNpTM/tU05sMSuUMSMrXXOx1/Ch X-Received: by 2002:a65:4904:: with SMTP id p4mr3755871pgs.384.1547000205493; Tue, 08 Jan 2019 18:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547000205; cv=none; d=google.com; s=arc-20160816; b=bykl/p8VP9Yz68lzrKvM1CT6mxJUaIdWD/R/7/BuK9BOk0HacAjMP3lxwzejpDrXLW zBRk2FWyONB4iYTlHzdWMIQYTPp+auKZWT2wTDpuoxTQu+7fBSs+unxGexlL5sJ6CzoA gYsA2AjrpzKRqiiYKYoAQ7GXPpRA+Q/xJBE83zOuBE78x2xvqI2bWWuKp47MtJUhbhBV Axr+HwHdtLT38twOUSU+NhaX8VlYV7kJO8vTLcqSukfLGVlfIuiOolmlPRujkKkcIZk0 36TQI+acs/3tRIhjenTXhmHP8X/w5qJDRaa7+HrtYECX3GHVnCFCzHU2p8hGPKplOdPz nPmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=WP9AW2JaG2LYFg4TVAG2uP0iTiVnN9sSaijovwmMgCA=; b=Ri9n+FqE3xPTwLNk9rWoBJVIH5547d2Kf7+RqF1rCDKoRL4JUXyvOpGKClblZ/uhgo dcHjS9k2fdMwJzBwdlfUZxrpUd2/nPD4JOJ43OXv/z9ieEvH1OI2ne+VqJoZ1ZSaFCEG avHOFEU3fpxMKV9dhdcXk4TUc9k7t6XS0pdE0exgWIaoXssfPz1xhmqYNE/I+1f551Oj rS7rKFXOF6HTzdfF3PkluhR/Z+C7mSkzSCVq9QfCSMcOuCpEE1OTMk+IriZfP8zTCtV0 Pw6OwHtZiisfbUomyuIITg3tcEpoZyFtftpxga/qiE33YgII4SIff6Zvnu8Z4dAgiBqi vBWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGd1q2Zp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t63si24754813pgd.78.2019.01.08.18.16.45; Tue, 08 Jan 2019 18:16:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGd1q2Zp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729543AbfAICQo (ORCPT + 31 others); Tue, 8 Jan 2019 21:16:44 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36655 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728569AbfAICQn (ORCPT ); Tue, 8 Jan 2019 21:16:43 -0500 Received: by mail-wr1-f68.google.com with SMTP id u4so6088556wrp.3 for ; Tue, 08 Jan 2019 18:16:42 -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=cPG8B42s5F7PQTf5WXoCQlE4uZEYWWV0wJtLJL07ni/l/MG1P1lcSMbnuHSQH8unL8 VQP7ncnZ74Iy/NlPECmWb2CMhRmoIJQ1J8RGCLSJu1hH6bTpIH4d2oVSI7x+oE/9Jm0+ qt00g65ftQpk8ifdt/IbyhMPQtDMZNtxBMKWz+ufahJWi0v97ztkaLAz+X3bOhxrn3KP eD+y0zpcGDHpn34hb4xkjtP26BREYuCz/1m6gU18z9yxj0JTcUBLCeSlu1E9T3o/zhf0 lp3oI+R4NRPvWxP48bdxjgSdmjcZSKfiq0tLEzFhNeNnRMdF+iCdqSdKoE4wUOO9hvUm Jjgw== X-Gm-Message-State: AJcUukddzsbzBLz9ZjdZAke0cpRv6HgpMXKMRyUHWF42jWmA1celbr4Y 7sg2I7+hZUNdrkt1aIPgQvQj/w== 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 Cc: Vincent Guittot 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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. */