Skip to content
Snippets Groups Projects
  1. Nov 10, 2020
    • Ulf Hansson's avatar
      cpuidle: psci: Enable suspend-to-idle for PSCI OSI mode · 670c90de
      Ulf Hansson authored
      
      To select domain idlestates for cpuidle-psci when OSI mode has been
      enabled, the PM domains via genpd are being managed through runtime PM.
      This works fine for the regular idlepath, but it doesn't during system wide
      suspend. More precisely, the domain idlestates becomes temporarily
      disabled, which is because the PM core disables runtime PM for devices
      during system wide suspend.
      
      Later in the system suspend phase, genpd intends to deal with this from its
      ->suspend_noirq() callback, but this doesn't work as expected for a device
      corresponding to a CPU, because the domain idlestates needs to be selected
      on a per CPU basis (the PM core doesn't invoke the callbacks like that).
      
      To address this problem, let's enable the syscore flag for the
      corresponding CPU device that becomes successfully attached to its PM
      domain (applicable only in OSI mode). This informs the PM core to skip
      invoke the system wide suspend/resume callbacks for the device, thus also
      prevents genpd from screwing up its internal state of it.
      
      Moreover, to properly select a domain idlestate for the CPUs during
      suspend-to-idle, let's assign a specific ->enter_s2idle() callback for the
      corresponding domain idlestate (applicable only in OSI mode). From that
      callback, let's invoke dev_pm_genpd_suspend|resume(), as this allows a
      domain idlestate to be selected for the current CPU by genpd.
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      670c90de
  2. Sep 21, 2020
    • Ulf Hansson's avatar
      cpuidle: psci: Fix suspicious RCU usage · 36050d89
      Ulf Hansson authored
      
      The commit eb1f0023 ("lockdep,trace: Expose tracepoints"), started to
      expose us for tracepoints. This lead to the following RCU splat on an ARM64
      Qcom board.
      
      [    5.529634] WARNING: suspicious RCU usage
      [    5.537307] sdhci-pltfm: SDHCI platform and OF driver helper
      [    5.541092] 5.9.0-rc3 #86 Not tainted
      [    5.541098] -----------------------------
      [    5.541105] ../include/trace/events/lock.h:37 suspicious rcu_dereference_check() usage!
      [    5.541110]
      [    5.541110] other info that might help us debug this:
      [    5.541110]
      [    5.541116]
      [    5.541116] rcu_scheduler_active = 2, debug_locks = 1
      [    5.541122] RCU used illegally from extended quiescent state!
      [    5.541129] no locks held by swapper/0/0.
      [    5.541134]
      [    5.541134] stack backtrace:
      [    5.541143] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.9.0-rc3 #86
      [    5.541149] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
      [    5.541157] Call trace:
      [    5.568185] sdhci_msm 7864900.sdhci: Got CD GPIO
      [    5.574186]  dump_backtrace+0x0/0x1c8
      [    5.574206]  show_stack+0x14/0x20
      [    5.574229]  dump_stack+0xe8/0x154
      [    5.574250]  lockdep_rcu_suspicious+0xd4/0xf8
      [    5.574269]  lock_acquire+0x3f0/0x460
      [    5.574292]  _raw_spin_lock_irqsave+0x80/0xb0
      [    5.574314]  __pm_runtime_suspend+0x4c/0x188
      [    5.574341]  psci_enter_domain_idle_state+0x40/0xa0
      [    5.574362]  cpuidle_enter_state+0xc0/0x610
      [    5.646487]  cpuidle_enter+0x38/0x50
      [    5.650651]  call_cpuidle+0x18/0x40
      [    5.654467]  do_idle+0x228/0x278
      [    5.657678]  cpu_startup_entry+0x24/0x70
      [    5.661153]  rest_init+0x1a4/0x278
      [    5.665061]  arch_call_rest_init+0xc/0x14
      [    5.668272]  start_kernel+0x508/0x540
      
      Following the path in pm_runtime_put_sync_suspend() from
      psci_enter_domain_idle_state(), it seems like we end up using the RCU.
      Therefore, let's simply silence the splat by informing the RCU about it
      with RCU_NONIDLE.
      
      Note that, this is a temporary solution. Instead we should strive to avoid
      using RCU_NONIDLE (and similar), but rather push rcu_idle_enter|exit()
      further down, closer to the arch specific code. However, as the CPU PM
      notifiers are also using the RCU, additional rework is needed.
      
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Acked-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      36050d89
  3. Jul 29, 2020
  4. May 19, 2020
  5. May 15, 2020
  6. Mar 14, 2020
  7. Jan 02, 2020
  8. Aug 09, 2019
    • Lorenzo Pieralisi's avatar
      PSCI: cpuidle: Refactor CPU suspend power_state parameter handling · 9ffeb6d0
      Lorenzo Pieralisi authored
      
      Current PSCI code handles idle state entry through the
      psci_cpu_suspend_enter() API, that takes an idle state index as a
      parameter and convert the index into a previously initialized
      power_state parameter before calling the PSCI.CPU_SUSPEND() with it.
      
      This is unwieldly, since it forces the PSCI firmware layer to keep track
      of power_state parameter for every idle state so that the
      index->power_state conversion can be made in the PSCI firmware layer
      instead of the CPUidle driver implementations.
      
      Move the power_state handling out of drivers/firmware/psci
      into the respective ACPI/DT PSCI CPUidle backends and convert
      the psci_cpu_suspend_enter() API to get the power_state
      parameter as input, which makes it closer to its firmware
      interface PSCI.CPU_SUSPEND() API.
      
      A notable side effect is that the PSCI ACPI/DT CPUidle backends
      now can directly handle (and if needed update) power_state
      parameters before handing them over to the PSCI firmware
      interface to trigger PSCI.CPU_SUSPEND() calls.
      
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      9ffeb6d0
    • Lorenzo Pieralisi's avatar
      ARM: psci: cpuidle: Introduce PSCI CPUidle driver · 81d549e0
      Lorenzo Pieralisi authored
      
      PSCI firmware is the standard power management control for
      all ARM64 based platforms and it is also deployed on some
      ARM 32 bit platforms to date.
      
      Idle state entry in PSCI is currently achieved by calling
      arm_cpuidle_init() and arm_cpuidle_suspend() in a generic
      idle driver, which in turn relies on ARM/ARM64 CPUidle back-end
      to relay the call into PSCI firmware if PSCI is the boot method.
      
      Given that PSCI is the standard idle entry method on ARM64 systems
      (which means that no other CPUidle driver are expected on ARM64
      platforms - so PSCI is already a generic idle driver), in order to
      simplify idle entry and code maintenance, it makes sense to have a PSCI
      specific idle driver so that idle code that it is currently living in
      drivers/firmware directory can be hoisted out of it and moved
      where it belongs, into a full-fledged PSCI driver, leaving PSCI code
      in drivers/firmware as a pure firmware interface, as it should be.
      
      Implement a PSCI CPUidle driver. By default it is a silent Kconfig entry
      which is left unselected, since it selection would clash with the
      generic ARM CPUidle driver that provides a PSCI based idle driver
      through the arm/arm64 arches back-ends CPU operations.
      
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      81d549e0
Loading