lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221216145802.102374-2-krzysztof.kozlowski@linaro.org>
Date:   Fri, 16 Dec 2022 15:58:02 +0100
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Kevin Hilman <khilman@...nel.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Cc:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Adrien Thierry <athierry@...hat.com>,
        Brian Masney <bmasney@...hat.com>
Subject: [PATCH RFC 2/2] cpuidle: psci: Mark as PREEMPT_RT safe

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@...hat.com>
Cc: Brian Masney <bmasney@...hat.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.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 821984947ed9..5cb78e754b27 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)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ