]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/idle: Store PURR snapshot in a per-cpu global variable
authorGautham R. Shenoy <ego@linux.vnet.ibm.com>
Tue, 7 Apr 2020 08:47:40 +0000 (14:17 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 30 Apr 2020 02:35:26 +0000 (12:35 +1000)
commit95caf20378483aeb2715e1c661a9de7539af66b7
tree994b84d8582d386910ae90f055415899b8bd367f
parent38323b072bd105e749f5377850c80de83657ee19
powerpc/idle: Store PURR snapshot in a per-cpu global variable

Currently when CPU goes idle, we take a snapshot of PURR via
pseries_idle_prolog() which is used at the CPU idle exit to compute
the idle PURR cycles via the function pseries_idle_epilog().  Thus,
the value of idle PURR cycle thus read before pseries_idle_prolog() and
after pseries_idle_epilog() is always correct.

However, if we were to read the idle PURR cycles from an interrupt
context between pseries_idle_prolog() and pseries_idle_epilog() (this
will be done in a future patch), then, the value of the idle PURR thus
read will not include the cycles spent in the most recent idle period.
Thus, in that interrupt context, we will need access to the snapshot
of the PURR before going idle, in order to compute the idle PURR
cycles for the latest idle duration.

In this patch, we save the snapshot of PURR in pseries_idle_prolog()
in a per-cpu variable, instead of on the stack, so that it can be
accessed from an interrupt context.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1586249263-14048-3-git-send-email-ego@linux.vnet.ibm.com
arch/powerpc/include/asm/idle.h
arch/powerpc/platforms/pseries/setup.c
drivers/cpuidle/cpuidle-pseries.c