• Rajneesh Bhardwaj's avatar
    platform/x86: intel_pmc_core: Add Package cstates residency info · 8aba056a
    Rajneesh Bhardwaj authored
    This patch introduces a new debugfs entry to read current Package
    cstate residency counters. A similar variant of this patch was discussed
    earlier "https://patchwork.kernel.org/patch/9908563/" but didn't make it
    into mainline for various reasons. Current version only adds debugfs
    entry which is quite useful for S0ix debug but excludes the exported API
    that was there in initial version. Though there are tools like turbostat
    and socwatch which can also show this info but sometimes its more
    practical to have it here as it's hard to switch between various tools for
    S0ix debug when pmc_core driver is the primary debug tool. Internal and
    external customers have requested for this patch to be included in the
    PMC driver on many occasions and Google Chrome OS team has already included
    it in their builds. This becomes handy when requesting logs from external
    customers who may not always have above mentioned tools in their integrated
    kernel builds.
    
    Package cstate residency MSRs provide useful debug information about
    system idle states. In idle states system must enter deeper Package
    cstates. Package cstates depend not only on Core cstates but also on
    various IP block's power gating status and LTR values.
    
    For Intel Core SoCs Package C10 entry is a must for deeper sleep states
    such as S0ix. "Suspend-to-idle"  should ideally take this path:
    PC0 -> PC10 -> S0ix. For S0ix debug, its logical to check for
    Package C10 residency first if for some reason system fails to enter S0ix.
    
    Please refer to this link for MSR details:
    https://software.intel.com/sites/default/files/managed/22/0d/335592-sdm-vol-4.pdf
    
    Usage:
    cat /sys/kernel/debug/pmc_core/package_cstate_show
    Package C2       : 0xec2e21735f
    Package C3       : 0xc30113ba4
    Package C6       : 0x9ef4be15c5
    Package C7       : 0x1e011904
    Package C8       : 0x3c5653cfe5a
    Package C9       : 0x0
    Package C10      : 0x16fff4289
    
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Cc: "David E. Box" <david.e.box@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Cc: Anshuman Gupta <anshuman.gupta@intel.com>
    Cc: Len Brown <len.brown@intel.com>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-and-tested-by: default avatarAnshuman Gupta <anshuman.gupta@intel.com>
    Signed-off-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
    Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
    8aba056a
intel_pmc_core.c 24 KB