• Gautham R. Shenoy's avatar
    powerpc/idle: Store PURR snapshot in a per-cpu global variable · c4019198
    Gautham R. Shenoy authored
    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: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/1586249263-14048-3-git-send-email-ego@linux.vnet.ibm.com
    c4019198
setup.c 27 KB