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 C6AECC05027 for ; Thu, 26 Jan 2023 12:38:47 +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:Cc: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=0I1FZMqFOrm70ldka6OdwkjZZ+gtdOnbU3atkJWrjo8=; b=nog1guPqowrqDJ J0TimdNdE/yPjcODrnn/G9/vtdE5C+OsoQfEjRZKYJbNpQS60eWw7+v12OBcv8Vdz45Wi7exqx8o1 XVq1HZU3vrtkGSKTIXBy3eaxIcpO890Rc4SL1cl8UKJJPMShliKZXgy5F3e6aANPUGfp0FuMiFBLt rZ/2OsF/NACzHw4ThWa8obfrKK8/nr1aZPN0QEQYSYynrZlseY9Z3vH95FcUlkcTDmGOVylWECCfS K54ZzI+4DhoTt19y7S2Vo2SVe8USC2EZEDdoI9DxPQEjGdS/f33kPITLj1oxZBd6fvs3XWUqg7oPN XLjAHWRnjuh2xaeUI3qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL1Ve-00Ar2b-Fz; Thu, 26 Jan 2023 12:37:42 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL1Va-00Ar1v-9x for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2023 12:37:39 +0000 Received: by mail-pl1-x62a.google.com with SMTP id 5so1706509plo.3 for ; Thu, 26 Jan 2023 04:37:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=f781q+d7HKEn4nTTqyctm+PVJ5b9hnewFfXGjR2FR58=; b=CHbklH8jsL2VpxKAGklgkoHvXa6yco6vkdgNXOlro8mHSw6Oj+1FryUEPLh0fLoit9 05zylBhQuwuGuycYe3kT5qfddarPljpltZ1sM9kt7oQSaggIcNbjpfJHKV3GP/GCyuah t9Lu5ysv9ogonIeWMD/3niWi+EFXi1IEZo3XTs2LvWk1QZTDVG/47sz5hBWw6z+VrKq/ MI6mLRhK32BXsM6grX+3SNO6mkOFAquw1bD42BhLuWb3SXID6y97ouAvCYBTpP1F/WkZ zDp3E8KBx4TtDdw8keDmc7dQn1xtKXTzD56AcRAhlgHPa4gC39bSZDD6x8DnVJYmIkAO f2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f781q+d7HKEn4nTTqyctm+PVJ5b9hnewFfXGjR2FR58=; b=wM0b1zfg2YnKndSvM+TrrWU8AlJwqQzpBQ/WsWocSUws73kti4OMjn69XKm5J2ZYdQ s/WjQbxGvZlf9aLG/rT15eUbKHjCzvDdGi3iZ41u/dlwt1t6hxNpQ6IxgNjCQieH1JhB iDMfqdFJj3CjsWuWYsstPqyzBLQjfyEYOHWc8BeufneIBtZCLsOGObdE7sbRBq9FI55f VM5osKjlY/yG+L9LlKayYO4DD+s0nLZLPpvcTBXtE0NagsdREze5LnuASrLPXYy0NCRa joGlTj0Xmp6dK5usO6mRIHNGaXJBmzdNJYWfns1jH3QdNK9ShgmQwCgA69HKT6jqEKJY 80jw== X-Gm-Message-State: AO0yUKXCV81CNsv86n+hQJ/ysU9VjeAorInE+YJYzNgsI7NBTXZXfaYf ew/KuP5ETOVEo/u+kW5iukES/0bYzq3SHl14yberdg== X-Google-Smtp-Source: AK7set8Cz8o/NquUec8I5fw/D7OCJ13899t+RvbRoO/PabAfwQcg6y7wHOKozkf+cz1PNgnw2z/zILbQzXxf/3U0MIY= X-Received: by 2002:a17:90a:70cc:b0:22c:1dd5:db7 with SMTP id a12-20020a17090a70cc00b0022c1dd50db7mr508437pjm.148.1674736654542; Thu, 26 Jan 2023 04:37:34 -0800 (PST) MIME-Version: 1.0 References: <20230125113418.455089-1-krzysztof.kozlowski@linaro.org> In-Reply-To: <20230125113418.455089-1-krzysztof.kozlowski@linaro.org> From: Ulf Hansson Date: Thu, 26 Jan 2023 13:36:58 +0100 Message-ID: Subject: Re: [PATCH v4] cpuidle: psci: Do not suspend topology CPUs on PREEMPT_RT To: Krzysztof Kozlowski Cc: "Rafael J. Wysocki" , Daniel Lezcano , Lorenzo Pieralisi , Sudeep Holla , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Adrien Thierry , Brian Masney , linux-rt-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230126_043738_389557_0E9232C9 X-CRM114-Status: GOOD ( 28.04 ) 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 Wed, 25 Jan 2023 at 12:34, Krzysztof Kozlowski wrote: > > The runtime Power Management of CPU topology is not compatible with > PREEMPT_RT: > 1. Core cpuidle path disables IRQs. > 2. Core cpuidle calls cpuidle-psci. > 3. cpuidle-psci in __psci_enter_domain_idle_state() calls > pm_runtime_put_sync_suspend() and pm_runtime_get_sync() which use > spinlocks (which are sleeping on PREEMPT_RT). > > Deep sleep modes are not a priority of Realtime kernels because the > latencies might become unpredictable. On the other hand the PSCI CPU > idle power domain is a parent of other devices and power domain > controllers, thus it cannot be simply skipped (e.g. on Qualcomm SM8250). > > Disable the idle callbacks in cpuidle-psci and mark the domain as > always on. This is a trade-off between making PREEMPT_RT working and > still having a proper power domain hierarchy in the system. > > Cc: Adrien Thierry > Cc: Brian Masney > Cc: linux-rt-users@vger.kernel.org > Signed-off-by: Krzysztof Kozlowski Reviewed-by: Ulf Hansson Kind regards Uffe > > --- > > Changes since v3: > 1. Rework - disable idle states, mark as always on (Ulf). > 2. Extend Kconfig warning (Ulf). > > Changes since v1: > 1. Re-work commit msg. > 2. Add note to Kconfig. > > Several other patches were dropped, as this is the only one actually > needed. It effectively stops PSCI cpuidle power domains from suspending > thus solving all other issues I experienced. > --- > drivers/cpuidle/Kconfig.arm | 8 ++++++++ > drivers/cpuidle/cpuidle-psci-domain.c | 7 +++++-- > drivers/cpuidle/cpuidle-psci.c | 3 +++ > 3 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm > index 747aa537389b..8deaa2e05206 100644 > --- a/drivers/cpuidle/Kconfig.arm > +++ b/drivers/cpuidle/Kconfig.arm > @@ -24,6 +24,14 @@ config ARM_PSCI_CPUIDLE > It provides an idle driver that is capable of detecting and > managing idle states through the PSCI firmware interface. > > + The driver has limitations when used with PREEMPT_RT: > + - If the idle states are described with the non-hierarchical layout, > + all idle states are still available. > + > + - If the idle states are described with the hierarchical layout, > + only the idle states defined per CPU are available, but not the ones > + being shared among a group of CPUs (aka cluster idle states). > + > config ARM_PSCI_CPUIDLE_DOMAIN > bool "PSCI CPU idle Domain" > depends on ARM_PSCI_CPUIDLE > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > index c80cf9ddabd8..6ad2954948a5 100644 > --- a/drivers/cpuidle/cpuidle-psci-domain.c > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > @@ -64,8 +64,11 @@ static int psci_pd_init(struct device_node *np, bool use_osi) > > pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN; > > - /* Allow power off when OSI has been successfully enabled. */ > - if (use_osi) > + /* > + * Allow power off when OSI has been successfully enabled. > + * PREEMPT_RT is not yet ready to enter domain idle states. > + */ > + if (use_osi && !IS_ENABLED(CONFIG_PREEMPT_RT)) > pd->power_off = psci_pd_power_off; > else > pd->flags |= GENPD_FLAG_ALWAYS_ON; > diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c > index 312a34ef28dc..6de027f9f6f5 100644 > --- a/drivers/cpuidle/cpuidle-psci.c > +++ b/drivers/cpuidle/cpuidle-psci.c > @@ -222,6 +222,9 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv, > if (!psci_has_osi_support()) > return 0; > > + if (IS_ENABLED(CONFIG_PREEMPT_RT)) > + return 0; > + > data->dev = psci_dt_attach_cpu(cpu); > if (IS_ERR_OR_NULL(data->dev)) > return PTR_ERR_OR_ZERO(data->dev); > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel