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: 10753379 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 25EAC6C5 for ; Wed, 9 Jan 2019 02:16:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1629128D8C for ; Wed, 9 Jan 2019 02:16:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A3C428DA5; Wed, 9 Jan 2019 02:16:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB85D28DCE for ; Wed, 9 Jan 2019 02:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728835AbfAICQo (ORCPT ); Tue, 8 Jan 2019 21:16:44 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41109 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbfAICQn (ORCPT ); Tue, 8 Jan 2019 21:16:43 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so6052279wrs.8 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=WG49aUxz/jrFZXvEk8mzU3vQzzzS7E7PBczrUkiWsrXGEouAZiy90VLnGIE+bnY2Js v7lQWwvQ7kfDm3RFWs6RVtsUwGopZ7gNoHCeXsX8PwqD4pgPLudLeW7uCX0xSrk0IgjI 7cUhSaASmn/S/lGV06T/5+DB+OE5clHLN/82WVNmZYssx/opw6ze89GvuQy0XxYS/qgM t94nOkKiTusT3wKtyD2BRRCqVbd7Ln+NACP6yHb2yGPJdGtXMqnuXGrwvWin2wTh8mMC /TNNBhpD6hbQ+/y33JQ7WuVS0QZaRt4ODy9eEybVUCRh3XaQ79LSi3XCtGk1xXaEiYSU p2zA== X-Gm-Message-State: AJcUukfMNo/bswH/lnL5nOGykArStSnVradGWSRLgIEwIwQD6jdXlftL CGEaA9wEdIl1jSfZJFTgcGy1zA== 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 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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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. */