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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2587C4741F for ; Thu, 1 Oct 2020 11:26:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 857CC20691 for ; Thu, 1 Oct 2020 11:26:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vJNw6FGo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 857CC20691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NTsc/dry3f6O/QM9qegBksEEV3w/Rlv8/3YsJ3ZusUo=; b=vJNw6FGogu+qQRO1BBLqMqPG6 US3br77sZMjJ0zILIJ6LAOFz5/JNPa70sCSs80aMedmKiVZ0Wg6E6TddyH8Npt8r61TiaVYaCfwzB kYH2VcJZ0mHQ84Az1XBDoTsVzk6nCAWklp85htaT26fMLqMfn5ngbaKNu3jiKB58Wr3F1sjUNGeBN Cl9CVfrPiG7WcALf64A7bHq7QBFKsa+Fq2NOht29p8uS+2jwhAyH7XhhyoAPyV7KvMQl2Yf/qckSg TYnwsNJGOmltDn7Sj5J5wK2qRXorhmZWflvSn3VgV1qV9KGVTwVZxY/0Vinad2wxR9xd3taPl0cTj V0OH85n2g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNwhw-0003qI-M5; Thu, 01 Oct 2020 11:25:08 +0000 Received: from mail-ot1-f66.google.com ([209.85.210.66]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNwhr-0003nc-FO for linux-arm-kernel@lists.infradead.org; Thu, 01 Oct 2020 11:25:04 +0000 Received: by mail-ot1-f66.google.com with SMTP id 60so4981589otw.3 for ; Thu, 01 Oct 2020 04:25:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EtZ6soe4Web0rzh5iPw/y1rfCvGvEU4upGzzC1GIut8=; b=JoPDcP2zRZdCCpnRNXk0C8ouyxnuTKuWfNJvdsEQbvzyoxoKgnrZGnqzgQ7haQN0XS W+eEKjJJWycicD5FmxjlpiJ6tzoYFgKoZGRtwnpNCsbcRx1d+2bhIb7iGONrySLlKn5u /WNcN5xvxrpMLahqR4n50eNXddZrMnlA8x44NJprtqR+8VpGc22YyLZT1DcUitkNTaKZ 8xqldm5zrUTDTP+uXJzr0QwWwLe1Tz7zq8HDrFmGPSNoqBzWZRbJE9BYS5dMbQLen2sx jsPshNTrEDYwvphlqeG5ZeCIKQ8GuaKAUmMdriIcEmGkRcnG45RXt/fiFHwtdZ18nQdh vEmg== X-Gm-Message-State: AOAM531geOPg/KXWaI2OkUKqPXjhX6DEUOQykWl/kSqRl3+Fqmzy+phs itwJIAKarcJD+VEIuu+CXV7cdxFgkRAz8WLGDkU= X-Google-Smtp-Source: ABdhPJyL8PPJSzJg7q2uVTh6on6G2gG1lDDr7VfeQJ4b6NQVFGA/ftm9GG/aRmEYkhY+BzOfGznOXAShBikYNxu9jOY= X-Received: by 2002:a05:6830:150a:: with SMTP id k10mr4312555otp.167.1601551502463; Thu, 01 Oct 2020 04:25:02 -0700 (PDT) MIME-Version: 1.0 References: <20200901082707.106860-1-ulf.hansson@linaro.org> <20200901082707.106860-3-ulf.hansson@linaro.org> <20201001101756.GB906@bogus> In-Reply-To: <20201001101756.GB906@bogus> From: "Rafael J. Wysocki" Date: Thu, 1 Oct 2020 13:24:48 +0200 Message-ID: Subject: Re: [PATCH 2/2] cpuidle: psci: Enable s2idle when using OSI with the PM domain topology To: Sudeep Holla X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201001_072503_576226_A50C38BA X-CRM114-Status: GOOD ( 31.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Lorenzo Pieralisi , Vincent Guittot , Benjamin Gaignard , Linux PM , Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , Linux ARM , Lukasz Luba 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 Thu, Oct 1, 2020 at 12:18 PM Sudeep Holla wrote: > > On Tue, Sep 01, 2020 at 10:27:07AM +0200, Ulf Hansson wrote: > > To select domain idle states for cpuidle-psci, the PM domains via genpd are > > being managed by using runtime PM. This works fine for the regular idle > > path, but it doesn't when doing s2idle. > > > > More precisely, the domain idle states becomes temporarily disabled, which > > is because the PM core disables runtime PM for devices during system > > suspend. > > When you refer system suspend above, you mean both S2R and S2I ? > > > Even if genpd tries to power off the PM domain in the > > suspend_noirq phase, that doesn't help to properly select a domain idle > > state, as this needs to be done on per CPU basis. > > > > And what prevents doing per CPU basis ? > > > Let's address the issue by enabling the syscore flag for the attached CPU > > devices. This prevents genpd from trying to power off the corresponding PM > > domains in the suspend_noirq phase. Moreover, let's assign a specific > > ->enter_s2idle() callback for the corresponding domain idle state and let > > it invoke pm_genpd_syscore_poweroff|poweron(), rather than using runtime > > PM. > > > > The syscore_suspend is not executed for S2I and using syscore APIs here > is bit confusing IMO. Right. > If Rafael is fine, No, I'm not. Cheers! > I have no objections. > > > Signed-off-by: Ulf Hansson > > --- > > drivers/cpuidle/cpuidle-psci-domain.c | 2 ++ > > drivers/cpuidle/cpuidle-psci.c | 30 +++++++++++++++++++++++---- > > 2 files changed, 28 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > > index b6e9649ab0da..65437ba5fa78 100644 > > --- a/drivers/cpuidle/cpuidle-psci-domain.c > > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > > @@ -324,6 +324,8 @@ struct device *psci_dt_attach_cpu(int cpu) > > if (cpu_online(cpu)) > > pm_runtime_get_sync(dev); > > > > + dev_pm_syscore_device(dev, true); > > + > > return dev; > > } > > > > diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c > > index 74463841805f..6322d55a0a7d 100644 > > --- a/drivers/cpuidle/cpuidle-psci.c > > +++ b/drivers/cpuidle/cpuidle-psci.c > > @@ -19,6 +19,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -52,8 +53,9 @@ static inline int psci_enter_state(int idx, u32 state) > > return CPU_PM_CPU_IDLE_ENTER_PARAM(psci_cpu_suspend_enter, idx, state); > > } > > > > -static int psci_enter_domain_idle_state(struct cpuidle_device *dev, > > - struct cpuidle_driver *drv, int idx) > > +static int __psci_enter_domain_idle_state(struct cpuidle_device *dev, > > + struct cpuidle_driver *drv, int idx, > > + bool s2idle) > > { > > struct psci_cpuidle_data *data = this_cpu_ptr(&psci_cpuidle_data); > > u32 *states = data->psci_states; > > @@ -66,7 +68,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, > > return -1; > > > > /* Do runtime PM to manage a hierarchical CPU toplogy. */ > > - pm_runtime_put_sync_suspend(pd_dev); > > + if (s2idle) > > + pm_genpd_syscore_poweroff(pd_dev); > > + else > > + pm_runtime_put_sync_suspend(pd_dev); > > Since CPU genpd is special and handled so in core, can this be moved to core ? > I mean pm_runtime_put_sync_suspend handle that based genpd_is_cpu_domain. > > -- > Regards, > Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel