Message ID | 20221219151503.385816-3-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2447801wrn; Mon, 19 Dec 2022 07:17:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+o9iTw/cghry1WNftQ3U9Luz5ew2K6zhfaK0zMggOO66uvRoez1Z4Z/Xy4KlBQxgnz/5z X-Received: by 2002:a05:6402:540b:b0:461:e82b:be07 with SMTP id ev11-20020a056402540b00b00461e82bbe07mr37702847edb.2.1671463035298; Mon, 19 Dec 2022 07:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671463035; cv=none; d=google.com; s=arc-20160816; b=CLWbU0iKfc/Xc7PE0a3cbx9WxBZGoxbXXiIDbAajiEmxbkVea0x/sp7ylZhG0S5Zit CSj/swTSFWM3B9Sq3rjPR+B6Lw4IIPkTTrMNpfUFEjcg/VlNdHHjKh52Y1LiZjgV2iqM lsdylq7Z8BxdSSRqeCrqBqgblRoZQ2vj17Cxjh3d7hF3zixHU5YKsvyeSKv3n/mBtdrQ b5zonQlbJgM9fqZX2DbZmDfen633kGEHl9Wu2JuNw0ZS/JbWr7B63HkYyCrAIofSwqzt J0Unrb0DiL5W3EDboCHhnlkFhE2C5efK0XnOBdRx4nskqElMlryxRPVXbBDnICCAXBYi kK8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=710npLST/xPzuXiih2c1d9pFv9jXZIz92buQVuG0oAE=; b=hpjCM9Lgsugkn3j416UJbL2nZh26YLUPU8Gyb7Xcyl8M5JrA0RNxkQted6SQIjlWZt mmEjLdol0Zgw177iVcZ9S3YeVdnAcgDEqjlD9ooIln4xjZT8SDqX6lORdaBMOngsG+OC 3ANPyUfUWxSTdZR5lr1bbFjsOtXkQSJ8ygqZDura91XhnEHOCwq1gG4r/ni18LVjMUTz m737Cojw/a0z0uyiVgDkJVS8AO78ehPwEvC61N5/Fb0y31SJxj3i6wWo7ZtWUfa9rr2s tqm4zfXTiLGHIKdZ7BPMbpBBTtTW0TIXGeYXWi2J5Eyr4jFB+clHI+LSmZnNG3G7A/YA WR+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uEio8Rqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx28-20020a0564020b5c00b00472be93436csi8159234edb.371.2022.12.19.07.16.51; Mon, 19 Dec 2022 07:17:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uEio8Rqg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232604AbiLSPP2 (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Mon, 19 Dec 2022 10:15:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232850AbiLSPPQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Dec 2022 10:15:16 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C68ACB7DB for <linux-kernel@vger.kernel.org>; Mon, 19 Dec 2022 07:15:14 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id 1so14128767lfz.4 for <linux-kernel@vger.kernel.org>; Mon, 19 Dec 2022 07:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=710npLST/xPzuXiih2c1d9pFv9jXZIz92buQVuG0oAE=; b=uEio8RqgLj7kCKnMrT/ndnvx/qtape0C21ameHDn5oxR1frx1ZVQ/UjjKEP/ibeWWh /FrAeFueaLx7BNbF218RzyfLQhs6ts56jbLBL2inGVZ8II/hhK38SdmB46mvrjRjuhWs LneaquS3DyNt64GkklXVgbkS2zL9bf6bEp74uvqATEfY07UyjJTqmZM+QFcOLM4uy8Bo CE/mOMKX0Cwc47pRYdikRdnVWrHoU5LoezIzgPZcUuo1I6KJTFkMPX9rvq5ht+fmfcMC ONvGwjkQVW0VtSI8uJhE12tdg/7q+CM2fWOMU6PmvL3H+i1ZDUpFhpWuX439KLEKV4MS LZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=710npLST/xPzuXiih2c1d9pFv9jXZIz92buQVuG0oAE=; b=kw+b73cq/61U1ewy4Yr7tJlGnvuEGbMm+xMxYTE1zoy060BFXfDjX3MNOoC5jMLDMf rNTIfyCku5Pk/bSwyq8r3WLNjcO6lAKcgYIigkpVZMCq2VEqSVJq7QlEiw/jHaOe1hU4 4IlJRLsFcgQuMhtLizrJ1G32qtz70NepR9e5z8OXz0gm4Rahh5WMHIi288oIY3+t8usi aQXAfH+uP1ym3ukIs02VCljT2Qf8mQnaYxIWppd5dp03MFQyMBKNWnflYueYPmKX1MbJ 5S37i78w02oge1cunMWQoVOj48auuT1nw+pY25XeTt/9ppCZ1OHiDGmTx4Kxc6cQdgw2 e2JQ== X-Gm-Message-State: ANoB5pmJT1frRtwImj3vpt525FB+lPliWseSzNatQMHvsaYABIcKOc39 FdwZXqqE4jc5ZAX0NJf1CyZg8w== X-Received: by 2002:a05:6512:261b:b0:4b4:dd3d:4310 with SMTP id bt27-20020a056512261b00b004b4dd3d4310mr16841834lfb.19.1671462913205; Mon, 19 Dec 2022 07:15:13 -0800 (PST) Received: from krzk-bin.NAT.warszawa.vectranet.pl (088156142067.dynamic-2-waw-k-3-2-0.vectranet.pl. [88.156.142.67]) by smtp.gmail.com with ESMTPSA id e1-20020a05651236c100b004bd8534ebbcsm1109894lfs.37.2022.12.19.07.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 07:15:12 -0800 (PST) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Kevin Hilman <khilman@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Sudeep Holla <sudeep.holla@arm.com>, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Adrien Thierry <athierry@redhat.com>, Brian Masney <bmasney@redhat.com>, linux-rt-users@vger.kernel.org Subject: [PATCH v2 2/5] cpuidle: psci: Mark as PREEMPT_RT safe Date: Mon, 19 Dec 2022 16:15:00 +0100 Message-Id: <20221219151503.385816-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221219151503.385816-1-krzysztof.kozlowski@linaro.org> References: <20221219151503.385816-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752656023504134768?= X-GMAIL-MSGID: =?utf-8?q?1752656023504134768?= |
Series |
PM: Fixes for Realtime systems
|
|
Commit Message
Krzysztof Kozlowski
Dec. 19, 2022, 3:15 p.m. UTC
The PSCI cpuidle power domain in power_off callback uses
__this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in
Realtime kernels and solves errors like:
BUG: scheduling while atomic: swapper/2/0/0x00000002
Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
Call trace:
dump_backtrace.part.0+0xe0/0xf0
show_stack+0x18/0x40
dump_stack_lvl+0x68/0x84
dump_stack+0x18/0x34
__schedule_bug+0x60/0x80
__schedule+0x628/0x800
schedule_rtlock+0x28/0x5c
rtlock_slowlock_locked+0x360/0xd30
rt_spin_lock+0x88/0xb0
genpd_lock_nested_spin+0x1c/0x30
genpd_power_off.part.0.isra.0+0x20c/0x2a0
genpd_runtime_suspend+0x150/0x2bc
__rpm_callback+0x48/0x170
rpm_callback+0x6c/0x7c
rpm_suspend+0x108/0x660
__pm_runtime_suspend+0x4c/0x8c
__psci_enter_domain_idle_state.constprop.0+0x54/0xe0
psci_enter_domain_idle_state+0x18/0x2c
cpuidle_enter_state+0x8c/0x4e0
cpuidle_enter+0x38/0x50
do_idle+0x248/0x2f0
cpu_startup_entry+0x24/0x30
secondary_start_kernel+0x130/0x154
__secondary_switched+0xb0/0xb4
Cc: Adrien Thierry <athierry@redhat.com>
Cc: Brian Masney <bmasney@redhat.com>
Cc: linux-rt-users@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/cpuidle/cpuidle-psci-domain.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 2022-12-19 16:15:00 [+0100], Krzysztof Kozlowski wrote: > The PSCI cpuidle power domain in power_off callback uses > __this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in Why does __this_cpu_write() matter here? > Realtime kernels and solves errors like: > > BUG: scheduling while atomic: swapper/2/0/0x00000002 > Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) > Call trace: > dump_backtrace.part.0+0xe0/0xf0 > show_stack+0x18/0x40 > dump_stack_lvl+0x68/0x84 > dump_stack+0x18/0x34 > __schedule_bug+0x60/0x80 > __schedule+0x628/0x800 > schedule_rtlock+0x28/0x5c > rtlock_slowlock_locked+0x360/0xd30 > rt_spin_lock+0x88/0xb0 > genpd_lock_nested_spin+0x1c/0x30 > genpd_power_off.part.0.isra.0+0x20c/0x2a0 > genpd_runtime_suspend+0x150/0x2bc > __rpm_callback+0x48/0x170 > rpm_callback+0x6c/0x7c > rpm_suspend+0x108/0x660 > __pm_runtime_suspend+0x4c/0x8c > __psci_enter_domain_idle_state.constprop.0+0x54/0xe0 > psci_enter_domain_idle_state+0x18/0x2c > cpuidle_enter_state+0x8c/0x4e0 > cpuidle_enter+0x38/0x50 > do_idle+0x248/0x2f0 > cpu_startup_entry+0x24/0x30 > secondary_start_kernel+0x130/0x154 > __secondary_switched+0xb0/0xb4 This is to a sleeping lock (spinlock_t) in an IRQ-off region which starts in do_idle(). You could describe the problem and to solution you aim for instead pasting a backtrace into the commit description and adding a flow in the code. I don't see how your commit description matches your change in code. One might think "Oh. If I see this pattern, I need an irqsafe lock to fix it". Sebastian
On 12/01/2023 12:00, Sebastian Andrzej Siewior wrote: > On 2022-12-19 16:15:00 [+0100], Krzysztof Kozlowski wrote: >> The PSCI cpuidle power domain in power_off callback uses >> __this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in > > Why does __this_cpu_write() matter here? I'll reword to "not using sleeping primitives nor spinlock_t" > >> Realtime kernels and solves errors like: >> >> BUG: scheduling while atomic: swapper/2/0/0x00000002 >> Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) >> Call trace: >> dump_backtrace.part.0+0xe0/0xf0 >> show_stack+0x18/0x40 >> dump_stack_lvl+0x68/0x84 >> dump_stack+0x18/0x34 >> __schedule_bug+0x60/0x80 >> __schedule+0x628/0x800 >> schedule_rtlock+0x28/0x5c >> rtlock_slowlock_locked+0x360/0xd30 >> rt_spin_lock+0x88/0xb0 >> genpd_lock_nested_spin+0x1c/0x30 >> genpd_power_off.part.0.isra.0+0x20c/0x2a0 >> genpd_runtime_suspend+0x150/0x2bc >> __rpm_callback+0x48/0x170 >> rpm_callback+0x6c/0x7c >> rpm_suspend+0x108/0x660 >> __pm_runtime_suspend+0x4c/0x8c >> __psci_enter_domain_idle_state.constprop.0+0x54/0xe0 >> psci_enter_domain_idle_state+0x18/0x2c >> cpuidle_enter_state+0x8c/0x4e0 >> cpuidle_enter+0x38/0x50 >> do_idle+0x248/0x2f0 >> cpu_startup_entry+0x24/0x30 >> secondary_start_kernel+0x130/0x154 >> __secondary_switched+0xb0/0xb4 > > This is to a sleeping lock (spinlock_t) in an IRQ-off region which > starts in do_idle(). You could describe the problem and to solution you > aim for instead pasting a backtrace into the commit description and > adding a flow in the code. I'll extend the description. > > I don't see how your commit description matches your change in code. One > might think "Oh. If I see this pattern, I need an irqsafe lock to fix > it". Best regards, Krzysztof
On Mon, 19 Dec 2022 at 16:15, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > The PSCI cpuidle power domain in power_off callback uses > __this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in > Realtime kernels and solves errors like: > > BUG: scheduling while atomic: swapper/2/0/0x00000002 > Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) > Call trace: > dump_backtrace.part.0+0xe0/0xf0 > show_stack+0x18/0x40 > dump_stack_lvl+0x68/0x84 > dump_stack+0x18/0x34 > __schedule_bug+0x60/0x80 > __schedule+0x628/0x800 > schedule_rtlock+0x28/0x5c > rtlock_slowlock_locked+0x360/0xd30 > rt_spin_lock+0x88/0xb0 > genpd_lock_nested_spin+0x1c/0x30 > genpd_power_off.part.0.isra.0+0x20c/0x2a0 > genpd_runtime_suspend+0x150/0x2bc > __rpm_callback+0x48/0x170 > rpm_callback+0x6c/0x7c > rpm_suspend+0x108/0x660 > __pm_runtime_suspend+0x4c/0x8c > __psci_enter_domain_idle_state.constprop.0+0x54/0xe0 > psci_enter_domain_idle_state+0x18/0x2c > cpuidle_enter_state+0x8c/0x4e0 > cpuidle_enter+0x38/0x50 > do_idle+0x248/0x2f0 > cpu_startup_entry+0x24/0x30 > secondary_start_kernel+0x130/0x154 > __secondary_switched+0xb0/0xb4 > > Cc: Adrien Thierry <athierry@redhat.com> > Cc: Brian Masney <bmasney@redhat.com> > Cc: linux-rt-users@vger.kernel.org > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- > 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 c80cf9ddabd8..d15a91fb7048 100644 > --- a/drivers/cpuidle/cpuidle-psci-domain.c > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > @@ -62,7 +62,8 @@ static int psci_pd_init(struct device_node *np, bool use_osi) > if (!pd_provider) > goto free_pd; > > - pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN; > + pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_RT_SAFE | \ > + GENPD_FLAG_CPU_DOMAIN; My main concern with this, is that it will affect the parent domains too. Whether those would be able to use the GENPD_FLAG_RT_SAFE or not, is a different story. In one way or the other, I think it would be better to limit the GENPD_FLAG_RT_SAFE to be used only for PREEMPT_RT kernels. > > /* Allow power off when OSI has been successfully enabled. */ > if (use_osi) > -- > 2.34.1 > Kind regards Uffe
On 17/01/2023 16:27, Ulf Hansson wrote: > On Mon, 19 Dec 2022 at 16:15, Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> wrote: >> >> The PSCI cpuidle power domain in power_off callback uses >> __this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in >> Realtime kernels and solves errors like: >> >> BUG: scheduling while atomic: swapper/2/0/0x00000002 >> Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) >> Call trace: >> dump_backtrace.part.0+0xe0/0xf0 >> show_stack+0x18/0x40 >> dump_stack_lvl+0x68/0x84 >> dump_stack+0x18/0x34 >> __schedule_bug+0x60/0x80 >> __schedule+0x628/0x800 >> schedule_rtlock+0x28/0x5c >> rtlock_slowlock_locked+0x360/0xd30 >> rt_spin_lock+0x88/0xb0 >> genpd_lock_nested_spin+0x1c/0x30 >> genpd_power_off.part.0.isra.0+0x20c/0x2a0 >> genpd_runtime_suspend+0x150/0x2bc >> __rpm_callback+0x48/0x170 >> rpm_callback+0x6c/0x7c >> rpm_suspend+0x108/0x660 >> __pm_runtime_suspend+0x4c/0x8c >> __psci_enter_domain_idle_state.constprop.0+0x54/0xe0 >> psci_enter_domain_idle_state+0x18/0x2c >> cpuidle_enter_state+0x8c/0x4e0 >> cpuidle_enter+0x38/0x50 >> do_idle+0x248/0x2f0 >> cpu_startup_entry+0x24/0x30 >> secondary_start_kernel+0x130/0x154 >> __secondary_switched+0xb0/0xb4 >> >> Cc: Adrien Thierry <athierry@redhat.com> >> Cc: Brian Masney <bmasney@redhat.com> >> Cc: linux-rt-users@vger.kernel.org >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> --- >> 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 c80cf9ddabd8..d15a91fb7048 100644 >> --- a/drivers/cpuidle/cpuidle-psci-domain.c >> +++ b/drivers/cpuidle/cpuidle-psci-domain.c >> @@ -62,7 +62,8 @@ static int psci_pd_init(struct device_node *np, bool use_osi) >> if (!pd_provider) >> goto free_pd; >> >> - pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN; >> + pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_RT_SAFE | \ >> + GENPD_FLAG_CPU_DOMAIN; > > My main concern with this, is that it will affect the parent domains > too. Whether those would be able to use the GENPD_FLAG_RT_SAFE or not, > is a different story. > > In one way or the other, I think it would be better to limit the > GENPD_FLAG_RT_SAFE to be used only for PREEMPT_RT kernels. I can do it... or maybe we should just drop the flags (RT and IRQ safe) when parent domain does not have it? Best regards, Krzysztof
On 19/01/2023 16:40, Krzysztof Kozlowski wrote: > On 17/01/2023 16:27, Ulf Hansson wrote: >> On Mon, 19 Dec 2022 at 16:15, Krzysztof Kozlowski >> <krzysztof.kozlowski@linaro.org> wrote: >>> >>> The PSCI cpuidle power domain in power_off callback uses >>> __this_cpu_write() so it is PREEMPT_RT safe. This allows to use it in >>> Realtime kernels and solves errors like: >>> >>> BUG: scheduling while atomic: swapper/2/0/0x00000002 >>> Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) >>> Call trace: >>> dump_backtrace.part.0+0xe0/0xf0 >>> show_stack+0x18/0x40 >>> dump_stack_lvl+0x68/0x84 >>> dump_stack+0x18/0x34 >>> __schedule_bug+0x60/0x80 >>> __schedule+0x628/0x800 >>> schedule_rtlock+0x28/0x5c >>> rtlock_slowlock_locked+0x360/0xd30 >>> rt_spin_lock+0x88/0xb0 >>> genpd_lock_nested_spin+0x1c/0x30 >>> genpd_power_off.part.0.isra.0+0x20c/0x2a0 >>> genpd_runtime_suspend+0x150/0x2bc >>> __rpm_callback+0x48/0x170 >>> rpm_callback+0x6c/0x7c >>> rpm_suspend+0x108/0x660 >>> __pm_runtime_suspend+0x4c/0x8c >>> __psci_enter_domain_idle_state.constprop.0+0x54/0xe0 >>> psci_enter_domain_idle_state+0x18/0x2c >>> cpuidle_enter_state+0x8c/0x4e0 >>> cpuidle_enter+0x38/0x50 >>> do_idle+0x248/0x2f0 >>> cpu_startup_entry+0x24/0x30 >>> secondary_start_kernel+0x130/0x154 >>> __secondary_switched+0xb0/0xb4 >>> >>> Cc: Adrien Thierry <athierry@redhat.com> >>> Cc: Brian Masney <bmasney@redhat.com> >>> Cc: linux-rt-users@vger.kernel.org >>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >>> --- >>> 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 c80cf9ddabd8..d15a91fb7048 100644 >>> --- a/drivers/cpuidle/cpuidle-psci-domain.c >>> +++ b/drivers/cpuidle/cpuidle-psci-domain.c >>> @@ -62,7 +62,8 @@ static int psci_pd_init(struct device_node *np, bool use_osi) >>> if (!pd_provider) >>> goto free_pd; >>> >>> - pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN; >>> + pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_RT_SAFE | \ >>> + GENPD_FLAG_CPU_DOMAIN; >> >> My main concern with this, is that it will affect the parent domains >> too. Whether those would be able to use the GENPD_FLAG_RT_SAFE or not, >> is a different story. >> >> In one way or the other, I think it would be better to limit the >> GENPD_FLAG_RT_SAFE to be used only for PREEMPT_RT kernels. > > I can do it... or maybe we should just drop the flags (RT and IRQ safe) > when parent domain does not have it? Actually, with next patch, I can skip this one entirely. This is needed if PSCI cpuidle driver invokes runtime PM functions which eventually puts PSCI cpuidle power domain into suspend/resume. If the former does not happen, the domain driver won't be even called so my problem disappears. Since I need patch 3/5 - effectively disabling PSCI cpuidle runtime PM - we can drop this one, till we find a real user needing it. Best regards, Krzysztof
diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index c80cf9ddabd8..d15a91fb7048 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -62,7 +62,8 @@ static int psci_pd_init(struct device_node *np, bool use_osi) if (!pd_provider) goto free_pd; - pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN; + pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_RT_SAFE | \ + GENPD_FLAG_CPU_DOMAIN; /* Allow power off when OSI has been successfully enabled. */ if (use_osi)