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 AB499CCA47F for ; Wed, 8 Jun 2022 00:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389607AbiFHAvK (ORCPT ); Tue, 7 Jun 2022 20:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382875AbiFGVwB (ORCPT ); Tue, 7 Jun 2022 17:52:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E12223F22D; Tue, 7 Jun 2022 12:09:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20B58B823AE; Tue, 7 Jun 2022 19:09:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84890C385A2; Tue, 7 Jun 2022 19:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628989; bh=0Fo+vnLS+m2NgyDYTXErJyrh2tt8kExYo9NWHnEnXzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Srv2o0r9w4f2RIWaltIY1ofVM3XKfdCnM25uLFH7y4LabN8xJV+naZNbW276eBOru iyRtVDwYm7pOZqenaXN6OY8QvcLjPjQjROvs4jPZOekC9rWsqLZBhy6X5O37kjOZtM 91lsyCPV4ItfY4n/bc7AOQAYFwF7XEsmuklLh18A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 502/879] PM: domains: Fix initialization of genpds next_wakeup Date: Tue, 7 Jun 2022 19:00:20 +0200 Message-Id: <20220607165017.445605712@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit 622d9b5577f19a6472db21df042fea8f5fefe244 ] 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 Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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 1ee878d126fd..f0e4b0ea93e8 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1997,6 +1997,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(); -- 2.35.1