linux-stable/drivers/cpuidle
Russell Currey 953c54dfdc powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT
[ Upstream commit eac030b22e ]

lppaca_shared_proc() takes a pointer to the lppaca which is typically
accessed through get_lppaca().  With DEBUG_PREEMPT enabled, this leads
to checking if preemption is enabled, for example:

  BUG: using smp_processor_id() in preemptible [00000000] code: grep/10693
  caller is lparcfg_data+0x408/0x19a0
  CPU: 4 PID: 10693 Comm: grep Not tainted 6.5.0-rc3 #2
  Call Trace:
    dump_stack_lvl+0x154/0x200 (unreliable)
    check_preemption_disabled+0x214/0x220
    lparcfg_data+0x408/0x19a0
    ...

This isn't actually a problem however, as it does not matter which
lppaca is accessed, the shared proc state will be the same.
vcpudispatch_stats_procfs_init() already works around this by disabling
preemption, but the lparcfg code does not, erroring any time
/proc/powerpc/lparcfg is accessed with DEBUG_PREEMPT enabled.

Instead of disabling preemption on the caller side, rework
lppaca_shared_proc() to not take a pointer and instead directly access
the lppaca, bypassing any potential preemption checks.

Fixes: f13c13a005 ("powerpc: Stop using non-architected shared_proc field in lppaca")
Signed-off-by: Russell Currey <ruscur@russell.cc>
[mpe: Rework to avoid needing a definition in paca.h and lppaca.h]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230823055317.751786-4-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-19 12:20:15 +02:00
..
governors
Kconfig
Kconfig.arm cpuidle: Fix ARM_QCOM_SPM_CPUIDLE configuration 2021-05-14 09:50:16 +02:00
Kconfig.mips
Kconfig.powerpc
Makefile
coupled.c
cpuidle-arm.c
cpuidle-at91.c
cpuidle-big_little.c
cpuidle-calxeda.c
cpuidle-clps711x.c
cpuidle-cps.c
cpuidle-exynos.c
cpuidle-haltpoll.c
cpuidle-kirkwood.c
cpuidle-mvebu-v7.c
cpuidle-powernv.c powerpc/powernv/idle: add a basic stop 0-3 driver for POWER10 2020-09-15 22:13:38 +10:00
cpuidle-psci-domain.c cpuidle: psci: Iterate backwards over list in psci_pd_remove() 2023-03-22 13:30:05 +01:00
cpuidle-psci.c cpuidle: psci: Fix suspicious RCU usage 2020-09-21 15:56:53 +02:00
cpuidle-psci.h cpuidle: psci: Fix error path via converting to a platform driver 2020-07-29 18:38:30 +02:00
cpuidle-pseries.c powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT 2023-09-19 12:20:15 +02:00
cpuidle-qcom-spm.c
cpuidle-tegra.c cpuidle: tegra: Fix C7 idling state on Tegra114 2021-05-11 14:47:16 +02:00
cpuidle-ux500.c
cpuidle-zynq.c
cpuidle.c Merge back cpuidle material for 5.10. 2020-09-28 16:31:25 +02:00
cpuidle.h
driver.c
dt_idle_states.c cpuidle: dt: Return the correct numbers of parsed idle states 2023-01-14 10:15:15 +01:00
dt_idle_states.h
governor.c
poll_state.c
sysfs.c cpuidle: Fix kobject memory leaks in error paths 2021-11-18 14:04:05 +01:00