• Sandipan Das's avatar
    perf/x86/amd/uncore: Add memory controller support · 25e56847
    Sandipan Das authored
    Unified Memory Controller (UMC) events were introduced with Zen 4 as a
    part of the Performance Monitoring Version 2 (PerfMonV2) enhancements.
    An event is specified using the EventSelect bits and the RdWrMask bits
    can be used for additional filtering of read and write requests.
    
    As of now, a maximum of 12 channels of DDR5 are available on each socket
    and each channel is controlled by a dedicated UMC. Each UMC, in turn,
    has its own set of performance monitoring counters.
    
    Since the MSR address space for the UMC PERF_CTL and PERF_CTR registers
    are reused across sockets, uncore groups are created on the basis of
    socket IDs. Hence, group exclusivity is mandatory while opening events
    so that events for an UMC can only be opened on CPUs which are on the
    same socket as the corresponding memory channel.
    
    For each socket, the total number of available UMC counters and active
    memory channels are determined from CPUID leaf 0x80000022 EBX and ECX
    respectively. Usually, on Zen 4, each UMC has four counters.
    
    MSR assignments are determined on the basis of active UMCs. E.g. if
    UMCs 1, 4 and 9 are active for a given socket, then
    
      * UMC 1 gets MSRs 0xc0010800 to 0xc0010807 as PERF_CTLs and PERF_CTRs
      * UMC 4 gets MSRs 0xc0010808 to 0xc001080f as PERF_CTLs and PERF_CTRs
      * UMC 9 gets MSRs 0xc0010810 to 0xc0010817 as PERF_CTLs and PERF_CTRs
    
    If there are sockets without any online CPUs when the amd_uncore driver
    is loaded, UMCs for such sockets will not be discoverable since the
    mechanism relies on executing the CPUID instruction on an online CPU
    from the socket.
    Signed-off-by: default avatarSandipan Das <sandipan.das@amd.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/b25f391205c22733493abec1ed850b71784edc5f.1696425185.git.sandipan.das@amd.com
    25e56847
perf_event.h 18.3 KB