lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1696425185.git.sandipan.das@amd.com>
Date:   Thu, 5 Oct 2023 10:53:10 +0530
From:   Sandipan Das <sandipan.das@....com>
To:     <linux-kernel@...r.kernel.org>, <linux-perf-users@...r.kernel.org>,
        <x86@...nel.org>
CC:     <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
        <mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
        <jolsa@...nel.org>, <namhyung@...nel.org>, <irogers@...gle.com>,
        <adrian.hunter@...el.com>, <tglx@...utronix.de>, <bp@...en8.de>,
        <dave.hansen@...ux.intel.com>, <hpa@...or.com>,
        <eranian@...gle.com>, <ananth.narayan@....com>,
        <ravi.bangoria@....com>, <santosh.shukla@....com>,
        <sandipan.das@....com>
Subject: [PATCH v2 0/6] perf/x86/amd: Add memory controller events

Unified Memory Controller (UMC) events were introduced with Zen 4 as a
part of the Performance Monitoring Version 2 (PerfMonV2) enhancements.
Currently, Zen 4 supports up to 12 channels of DDR5 memory and each of
them are controlled by a dedicated UMC. Each UMC, in turn, has its own
set of performance monitoring counters. These counters can provide info
on UMC command activity which in turn can be used to derive utilization
and bandwidth. Using perf tool, users can profile activity either on a
combined basis (includes all active UMCs) or for individual UMCs.

E.g. measurement across all UMCs

  $ sudo perf stat -e amd_umc/umc_cas_cmd.all/ -a -- sleep 1

   Performance counter stats for 'system wide':

	     544,810      amd_umc/umc_cas_cmd.all/

	 1.002012663 seconds time elapsed

E.g. measurement specific to certain UMCs

  $ sudo perf stat -e amd_umc_0/umc_cas_cmd.all/ -e amd_umc_4/umc_cas_cmd.all/ -a -- sleep 1

   Performance counter stats for 'system wide':

	      27,096      amd_umc_0/umc_cas_cmd.all/
	      35,136      amd_umc_4/umc_cas_cmd.all/

	 1.001602807 seconds time elapsed

The available UMCs can be found from sysfs and the socket to which they
belong can be derived from the cpumask.

E.g.

  $ find /sys/bus/event_source/devices/ -maxdepth 1 -name "amd_umc_*" | sort

  /sys/bus/event_source/devices/amd_umc_0
  /sys/bus/event_source/devices/amd_umc_1
  /sys/bus/event_source/devices/amd_umc_2
  /sys/bus/event_source/devices/amd_umc_3
  /sys/bus/event_source/devices/amd_umc_4
  /sys/bus/event_source/devices/amd_umc_5
  /sys/bus/event_source/devices/amd_umc_6
  /sys/bus/event_source/devices/amd_umc_7

  $ cat /sys/devices/amd_umc_0/cpumask
  0

  $ cat /sys/devices/amd_umc_4/cpumask
  96

All of the output above comes from a dual socket Genoa system having
96 cores and 4 populated memory channels per socket.

Previous versions can be found at:
v1: https://lore.kernel.org/all/cover.1689748843.git.sandipan.das@amd.com/

Changes in v2:
 - Move collection of PMU CPUID info to startup of UNCORE_STARTING.
 - Remove mechanism to read CPUID information using SMP callbacks.
 - Defer PMU registration to startup of UNCORE_ONLINE since this can
   only be done after collection of CPUID information.
 - Remove mechanism to collect and free up unused uncore contexts as
   this is no longer required.
 - Rename some structures (amd_uncore is now called amd_uncore_pmu and
   amd_uncore is instead a collection of amd_uncore_pmu instances).
 - Add new uncore management handlers (scan, init, move, free) which are
   called at different stages of CPU hotplug.
 - Add Acked-by from Ian Rogers for the JSON events.

Sandipan Das (6):
  perf/x86/amd/uncore: Refactor uncore management
  perf/x86/amd/uncore: Move discovery and registration
  perf/x86/amd/uncore: Use rdmsr if rdpmc is unavailable
  perf/x86/amd/uncore: Add group exclusivity
  perf/x86/amd/uncore: Add memory controller support
  perf vendor events amd: Add Zen 4 memory controller events

 arch/x86/events/amd/uncore.c                  | 1036 +++++++++++------
 arch/x86/include/asm/msr-index.h              |    4 +
 arch/x86/include/asm/perf_event.h             |    9 +
 .../arch/x86/amdzen4/memory-controller.json   |  101 ++
 .../arch/x86/amdzen4/recommended.json         |   84 ++
 tools/perf/pmu-events/jevents.py              |    2 +
 6 files changed, 879 insertions(+), 357 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen4/memory-controller.json

-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ