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 67B3DC433EF for ; Fri, 25 Feb 2022 08:32:19 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XoiXwj0IwYGSqLWBgSu8EaQ4/NnGnrIvVijrnbpgz9Y=; b=wQUtT+11I1A8mj Vky5Q4/DbVSbVf+XxVJ4M4/IPva7Vt5CYlEbo9PnccAFFIMX12xFAcPxLeGJclGAyG/sgzIeXWNeQ 470Fo8HngDwROFvBYyHpq3ga6BXwq2oLDVXGMyddBgpDdpvKISol+nbe7YznIZH03WCiIKN9z3h7z W94KGygYz6aTnpVq+y/68Rw3nlxP9HOYBgqukRmN5L/Acm0CQKtYjXflz39Cdh60jQdmYAEEm2ti3 va/LgcFu17FDygGFuUSXRT6LobrVrYNKM3jtTInLtKZtOSyIpjJb4vZ3W7yFTV71dVVfHKU/+iaeE MaHL8kZ5K0rm7UsyPQhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNW0D-003xxX-5I; Fri, 25 Feb 2022 08:31:01 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNW01-003xtg-IA for linux-arm-kernel@lists.infradead.org; Fri, 25 Feb 2022 08:30:51 +0000 Received: by mail-pj1-x1033.google.com with SMTP id v5-20020a17090ac90500b001bc40b548f9so7882118pjt.0 for ; Fri, 25 Feb 2022 00:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=umjNYNhgnIxE5VvC0JbQD7toURbbqbp0XwksnmHUrBk=; b=u8zHs+9LnkJgCALSy6ds+Yd6X2VPqHpIFdGf8+KEnCsbZxxg2Pymyp5hP6OrRP4WnA K4deMddtit22sYeHlSZsYTLsc6QhVn3KQFZYaI/lkgwvtqe4Xs3f1VvYcYSxwSVlY2yz sNepcUDim4t4wyRz/RSc4jRwLnIYnRW1LtlU66tMq5LdVOJF/GagbDlpqTpYSMSSXADR rmzMKGf+ZeT8iKCoAiHggyfwAtXtHVFdQsy7D0mq4YNyRCR2FWChuN1SR92GWnDDYEL5 WVG9lheJII5ZkK3uVN/W/9pvHVK+OyaBzEhp8Khn4v/jHWDbUFmYdCpn3AVclfrD9XKC Q7Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=umjNYNhgnIxE5VvC0JbQD7toURbbqbp0XwksnmHUrBk=; b=3I9QT5teX3n/+1U0gN0RCW8pMDNOms53lfY51v6GmCz+Y3iBGeKEnKdLaWs8JFK7OJ GR58B35eac0VYrhyA0SdQyXObXZAKNkUB1z6Xa3oblwOS7qVv4XKHGD9nF9UyOnzsYMr 5HOv+jm6C1HaHcV+kezQVSluwOFP8UY4yZorwRHJZBYdGsm59jJMSGUzalGMekQFBsJH LboueRQQ3WE5DWrrpd7DDAzpMHYFI61ynoz1XpbkLrchUVDOK8Bh7R/OwrF3bPClN9ui qK02pkEi6K8u64zJmLZOpr05o80Z8hjOKhAozScFBZivV8va8YINffm3VQk4mtZBgtJI A/lQ== X-Gm-Message-State: AOAM530vEnCcPbjfgRIFv2KMIUDgZCho7AsPHA39/pX60LAoz/OA8fGj w2QHv0uQLdo55hclR1lFR9oT3w== X-Google-Smtp-Source: ABdhPJw0uLU4lqngX7/k9zLZXpp650nEStictQd4H3d3J4CHpNkXYKfPxxAYJ70h3fuhgk3W3eB0IQ== X-Received: by 2002:a17:90a:c296:b0:1bc:7a6e:623b with SMTP id f22-20020a17090ac29600b001bc7a6e623bmr2135245pjt.68.1645777848494; Fri, 25 Feb 2022 00:30:48 -0800 (PST) Received: from dragon (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id c18-20020a056a000ad200b004cdccd3da08sm2142663pfl.44.2022.02.25.00.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 00:30:47 -0800 (PST) Date: Fri, 25 Feb 2022 16:30:42 +0800 From: Shawn Guo To: Daniel Lezcano , "Rafael J . Wysocki" Cc: Sudeep Holla , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpuidle: psci: Iterate backwards over list in psci_pd_remove() Message-ID: <20220225083042.GC269879@dragon> References: <20220225082420.450620-1-shawn.guo@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220225082420.450620-1-shawn.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_003049_634551_3477FB9A X-CRM114-Status: GOOD ( 19.79 ) 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 On Fri, Feb 25, 2022 at 04:24:20PM +0800, Shawn Guo wrote: > In case that psci_pd_init_topology() fails for some reason, > psci_pd_remove() will be responsible for deleting provider and removing > genpd from psci_pd_providers list. There will be a failure when removing > the cluster PD, because the cpu (child) PDs haven't been removed. > > [ 0.050232] CPUidle PSCI: init PM domain cpu0 > [ 0.050278] CPUidle PSCI: init PM domain cpu1 > [ 0.050329] CPUidle PSCI: init PM domain cpu2 > [ 0.050370] CPUidle PSCI: init PM domain cpu3 > [ 0.050422] CPUidle PSCI: init PM domain cpu-cluster0 > [ 0.050475] PM: genpd_remove: unable to remove cpu-cluster0 > [ 0.051412] PM: genpd_remove: removed cpu3 > [ 0.051449] PM: genpd_remove: removed cpu2 > [ 0.051499] PM: genpd_remove: removed cpu1 > [ 0.051546] PM: genpd_remove: removed cpu0 > > Fix the problem by iterating the provider list in a reversely order, so s/reversely/reversed > that parent PD gets removed before child's PDs. s/before/after Essentially, with this change, the PM domains will be removed in the same order how they were added. [ 0.029052] CPUidle PSCI: init PM domain cpu0 [ 0.029076] CPUidle PSCI: init PM domain cpu1 [ 0.029103] CPUidle PSCI: init PM domain cpu2 [ 0.029124] CPUidle PSCI: init PM domain cpu3 [ 0.029151] CPUidle PSCI: init PM domain cpu-cluster0 [ 0.029647] PM: genpd_remove: removed cpu0 [ 0.029666] PM: genpd_remove: removed cpu1 [ 0.029690] PM: genpd_remove: removed cpu2 [ 0.029714] PM: genpd_remove: removed cpu3 [ 0.029738] PM: genpd_remove: removed cpu-cluster0 Shawn > > Signed-off-by: Shawn Guo > --- > drivers/cpuidle/cpuidle-psci-domain.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > index ff2c3f8e4668..ce5c415fb04d 100644 > --- a/drivers/cpuidle/cpuidle-psci-domain.c > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > @@ -182,7 +182,8 @@ static void psci_pd_remove(void) > struct psci_pd_provider *pd_provider, *it; > struct generic_pm_domain *genpd; > > - list_for_each_entry_safe(pd_provider, it, &psci_pd_providers, link) { > + list_for_each_entry_safe_reverse(pd_provider, it, > + &psci_pd_providers, link) { > of_genpd_del_provider(pd_provider->node); > > genpd = of_genpd_remove_last(pd_provider->node); > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel