From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15A23C433EF for ; Wed, 11 May 2022 14:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245514AbiEKO7O (ORCPT ); Wed, 11 May 2022 10:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245338AbiEKO5l (ORCPT ); Wed, 11 May 2022 10:57:41 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5378920CDAE for ; Wed, 11 May 2022 07:57:37 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id o22so2055642ljp.8 for ; Wed, 11 May 2022 07:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PO0ibnivlYlQHsSzGsoFDn9GSobE9qvHUHbEZcsOBy0=; b=eZKENx22PLLnXCK4/RWqmJUBzs4H+TVmExklvHsjsUlgPBN81qUOsWlzGDaoO3K+Cy b0UldU/sshvcS11Ya4efKtzTB/3qoymbAcHWQ5ohd1pUzs6mXaQplzOJP+RkZSg88zZi m04gMKBge8gTwQPBwn0ejNIEASf8HrdnnoaeYERmzOfXNw1F371WCYnYEr1wdgBpZj1M HESDDiz954jB4oZYQ2ekP/uznn5f5+8J+XIxmCv93rfH42upje90xP5wt++16rYvutpg Fqi+XGoRDLEndtES+TCdYJR3dCT9d1odLgs+1JnJ1Zr4PA1puOUi0U1pG9jr84+6Ihwf jPGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PO0ibnivlYlQHsSzGsoFDn9GSobE9qvHUHbEZcsOBy0=; b=jy9V3j7ZlX5HhUIwEjL9oIjUuSaQ2NUodg5QsA7Fv0l742O9agdw8Y8z3sHts1wsnc 422rEKbFbi90CEErwuYl/Qjm0Q31ZVTBwWfPBen1xpCNMLnd0ko5efMQxZ1pn1SiPCRo MtNaYAfIW6IFai+O4lZbaQVWIzwOWd2OwOj4ftu49Fbw36YeReQM7hwfzvAhqJk2A/tD opKGIbOWs9sjP7HtSddypR47c1Vc8wo8G7Vkcwudzs+AgEAUL+S8Cvf1aIpGEOM+sMv2 C7O+4nqA+ZGwp/mdSKuYco6On9uqou0SNR77s+mpuW8MPf8rMA45YvFzb1kTSzwpyM6j ynmQ== X-Gm-Message-State: AOAM531Kav4jagV/LMWPffbhCb2e4J5ubLup0NOSwfKEfm0t2C6hdiu4 UxRtY15ELo2cVHCIw94VKTRBYw== X-Google-Smtp-Source: ABdhPJxZphuNVJWtuCo9Ewl3xjNfgWKEwCNvRcPem+7IU9+w73SPhap+pUAL2jolkDfLctkvmSy/6Q== X-Received: by 2002:a05:651c:1994:b0:250:5b1c:69e7 with SMTP id bx20-20020a05651c199400b002505b1c69e7mr17054484ljb.192.1652281056576; Wed, 11 May 2022 07:57:36 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id z26-20020a19f71a000000b0047255d210f3sm320793lfe.34.2022.05.11.07.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 07:57:35 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Geert Uytterhoeven , Maulik Shah , Gabriel Fernandez , Alexandre Torgue , Dmitry Osipenko , Kevin Hilman , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/14] PM: domains: Fix initialization of genpd's next_wakeup Date: Wed, 11 May 2022 16:57:00 +0200 Message-Id: <20220511145704.698189-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220511145704.698189-1-ulf.hansson@linaro.org> References: <20220511145704.698189-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the genpd governor we walk the list of child-domains to take into account their next_wakeup. If the child-domain itself, doesn't have a governor assigned to it, we can end up using the next_wakeup value before it has been properly initialized. To prevent a possible incorrect behaviour in the governor, let's initialize next_wakeup to KTIME_MAX. Fixes: c79aa080fb0f ("PM: domains: use device's next wakeup to determine domain idle state") Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 48101232fcb9..9922fd763739 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2007,6 +2007,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd, genpd->device_count = 0; genpd->max_off_time_ns = -1; genpd->max_off_time_changed = true; + genpd->next_wakeup = KTIME_MAX; genpd->provider = NULL; genpd->has_provider = false; genpd->accounting_time = ktime_get_mono_fast_ns(); -- 2.25.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C3D5C433F5 for ; Wed, 11 May 2022 15:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nPOk/aYmJGLPi/C6ofhN1yEDbcx6x2om3PJkdz/nFxw=; b=c3JJt9T4DOq2D8 tsmsfy6QL7aIdcOiuzNKCttpcDBC4LgvkhibTRMVpNcLbpyEWpiwZqMYwWsw3Bgwj48hW4SmkIsAo 53lz8xPGiopHLyHV2asG3WyqoMSoj5WnGhKzPiVEnbAGZoyERktGk48sXvnFi7q+dzo7rZZR0iylq qxt/LSpbXqo4EUjG0xmUbnvBscBjP9/on6uGQtV5Njgkhdhwb4oXc6Mv4oMD+oW0mVjUxh9PYzske iiV0D4E/6kU4oYOS9DDpPtS4fSQYH710MXYNowM0dozqKC+TkfsPB4Weowom3a9F//Md4zbdKN4pA 4ywTdsloQvQXoHcMKP6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nonpe-007NTE-Bk; Wed, 11 May 2022 15:00:54 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nonmT-007LwK-T4 for linux-arm-kernel@lists.infradead.org; Wed, 11 May 2022 14:57:39 +0000 Received: by mail-lj1-x22e.google.com with SMTP id q130so2956341ljb.5 for ; Wed, 11 May 2022 07:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PO0ibnivlYlQHsSzGsoFDn9GSobE9qvHUHbEZcsOBy0=; b=eZKENx22PLLnXCK4/RWqmJUBzs4H+TVmExklvHsjsUlgPBN81qUOsWlzGDaoO3K+Cy b0UldU/sshvcS11Ya4efKtzTB/3qoymbAcHWQ5ohd1pUzs6mXaQplzOJP+RkZSg88zZi m04gMKBge8gTwQPBwn0ejNIEASf8HrdnnoaeYERmzOfXNw1F371WCYnYEr1wdgBpZj1M HESDDiz954jB4oZYQ2ekP/uznn5f5+8J+XIxmCv93rfH42upje90xP5wt++16rYvutpg Fqi+XGoRDLEndtES+TCdYJR3dCT9d1odLgs+1JnJ1Zr4PA1puOUi0U1pG9jr84+6Ihwf jPGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PO0ibnivlYlQHsSzGsoFDn9GSobE9qvHUHbEZcsOBy0=; b=TfWTfG2fORHLKUm90o7s1i1C+/zlhymx9JqypjGfUa9HFhrO9K3JQrXEm51R9BSwsm nJ5QYsxyUDUmbX/k21RvfYoPaVBshlGNBcYfgDiZDpl8uz+U2cs6PhETImVloy+lV2T4 TKBiCW1DLFeGepk9/mKvV2SF1Ce1fY3KUIc8ldGMl4bjUDg7M1DHGqE4tcTB9A3SB4cl ILt3AyyNRVj6+27RaaEff7bCPH5Ix/Mlu8FQGe7g0dLOG1vGCAcRLYkDOzudVom2z5Oy Fmm+oRPVkacgqHV6WBdIa42EoN4XSJypufGWiphmFlFhrFwe4z+5YKEvklxIDYiVmSMq rsbA== X-Gm-Message-State: AOAM530CmtonaEIhP95pcY3hCCyFQZUH/qHozGI76MIp4Mhtbi6sg2yA i0HUtTNDexH6J7EWgBlCG0j2CQ== X-Google-Smtp-Source: ABdhPJxZphuNVJWtuCo9Ewl3xjNfgWKEwCNvRcPem+7IU9+w73SPhap+pUAL2jolkDfLctkvmSy/6Q== X-Received: by 2002:a05:651c:1994:b0:250:5b1c:69e7 with SMTP id bx20-20020a05651c199400b002505b1c69e7mr17054484ljb.192.1652281056576; Wed, 11 May 2022 07:57:36 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id z26-20020a19f71a000000b0047255d210f3sm320793lfe.34.2022.05.11.07.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 07:57:35 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Geert Uytterhoeven , Maulik Shah , Gabriel Fernandez , Alexandre Torgue , Dmitry Osipenko , Kevin Hilman , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/14] PM: domains: Fix initialization of genpd's next_wakeup Date: Wed, 11 May 2022 16:57:00 +0200 Message-Id: <20220511145704.698189-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220511145704.698189-1-ulf.hansson@linaro.org> References: <20220511145704.698189-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220511_075737_983393_32183FB9 X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In the genpd governor we walk the list of child-domains to take into account their next_wakeup. If the child-domain itself, doesn't have a governor assigned to it, we can end up using the next_wakeup value before it has been properly initialized. To prevent a possible incorrect behaviour in the governor, let's initialize next_wakeup to KTIME_MAX. Fixes: c79aa080fb0f ("PM: domains: use device's next wakeup to determine domain idle state") Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 48101232fcb9..9922fd763739 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2007,6 +2007,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd, genpd->device_count = 0; genpd->max_off_time_ns = -1; genpd->max_off_time_changed = true; + genpd->next_wakeup = KTIME_MAX; genpd->provider = NULL; genpd->has_provider = false; genpd->accounting_time = ktime_get_mono_fast_ns(); -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel