Skip to content

iommu/vt-d: Support performance monitoring for IOMMU

[email protected] linux-iommu lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest7 patches 2 repliesIn review
  2. v37 patches 2 repliesSuperseded
  3. v27 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches14 repliesSuperseded

Changes in v4 from the cover letter

- Fix issues found by "./scripts/checkpatch.pl --strict" scripts Doesn't fix the "macros should not use a trailing semicolon" warning, since the macros has to include several struct and functions to further reduce the code duplication.
- To fix the 0 value filter issue, introduce new "*_filter_en" attrs for each filter. The end user must set both filter_en and filter to utilize a filter.
- Re-organize the layout of config1 and config2.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7iommu/vt-d: Support size of the register set in DRHDdrivers/iommu/intel/dmar.c include/acpi/actbl1.h include/linux/dmar.h+9 -50 replies
2/7iommu/vt-d: Retrieve IOMMU perfmon capability informationdrivers/iommu/intel/Kconfig drivers/iommu/intel/Makefile drivers/iommu/intel/dmar.c +3 more+273 -11 reply
3/7iommu/vt-d: Support Enhanced Command Interfacedrivers/iommu/intel/dmar.c drivers/iommu/intel/iommu.c drivers/iommu/intel/iommu.h+99 -00 replies
4/7iommu/vt-d: Add IOMMU perfmon supportDocumentation/ABI/testing/sysfs-bus-event_source-devices-iommu drivers/iommu/intel/iommu.h drivers/iommu/intel/perfmon.c +1 more+594 -00 replies
5/7iommu/vt-d: Support cpumask for IOMMU perfmonDocumentation/ABI/testing/sysfs-bus-event_source-devices-iommu drivers/iommu/intel/perfmon.c include/linux/cpuhotplug.h+114 -80 replies
6/7iommu/vt-d: Add IOMMU perfmon overflow handler supportdrivers/iommu/intel/dmar.c drivers/iommu/intel/iommu.h drivers/iommu/intel/perfmon.c +1 more+95 -20 replies
7/7iommu/vt-d: Enable IOMMU perfmon supportdrivers/iommu/intel/dmar.c drivers/iommu/intel/iommu.c+6 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH V4 0/7] iommu/vt-d: Support performance monitoring for IOMMU

From: Kan Liang <[email protected]>

Changes since V3:
- Fix issues found by "./scripts/checkpatch.pl --strict" scripts Doesn't fix the "macros should not use a trailing semicolon" warning, since the macros has to include several struct and functions to further reduce the code duplication.
- To fix the 0 value filter issue, introduce new "*_filter_en" attrs for each filter. The end user must set both filter_en and filter to utilize a filter.
- Re-organize the layout of config1 and config2.

Changes since V2:
- Move ecmd_submit_sync() to iommu.c to avoid #ifdef CONFIG_INTEL_IOMMU

Changes since V1:
- The cap and ecap registers are always in the first page. It's not necessary to use the reg size in dmar_validate_one_drhd(). (Patch 1)
- Move reg_size up and pair it with reg_base_addr in struct dmar_drhd_unit (Patch 1)
- Update the year of Copyright (Patch 2)
- Return 0 if PMS is not supported (Patch 2)
- Refine the comments and add a pr_warn for per-counter capabilities check (Patch 2)
- Remove unnecessary iommu_pmu->num_cntr = i (Patch 2)
- Remove has_ob of ecmd_submit_sync() (Patch 3)
- Remove the helpers from non-INTEL_IOMMU. (Patch 3)
- Still keep #ifdef CONFIG_INTEL_IOMMU for ecmd_submit_sync() to avoid compile warning with non-INTEL_IOMMU config.
- Use pr_warn_once() to replace WARN_ONCE() (Patch 4 & 6)
- Free iommu PMU if it fails to be registered. (Patch 4)
- Remove unnecessary 'handled' variable. (Patch 6)

A performance monitoring infrastructure, perfmon, is introduced with the VT-d Spec 4.0. The purpose of perfmon is to support collection of information about key events occurring during operation of the remapping hardware, to aid performance tuning and debug. The patch series is to support the perfmon for IOMMU.

To facilitate the perfmon support, the patch series also supports two new generic features of VT-d Spec 4.0.
- Support the 'size' field to retrieve the accurate size of the register set for each dmar device from DRHD. (Patch 1)
- Support the new Enhanced Command Interface. (Patch 3)

With the patch series, users can collect the performance data of IOMMU via Linux perf tool. For example,

 $ perf stat -e dmar1/iommu_requests,filter_ats_en=0x1,filter_ats=0x1/
   -a sleep 1

Performance counter stats for 'system wide':

368,947 dmar1/iommu_requests,filter_ats_en=0x1,filter_ats=0x1/

1.002592074 seconds time elapsed

Kan Liang (7):
iommu/vt-d: Support size of the register set in DRHD iommu/vt-d: Retrieve IOMMU perfmon capability information iommu/vt-d: Support Enhanced Command Interface iommu/vt-d: Add IOMMU perfmon support iommu/vt-d: Support cpumask for IOMMU perfmon iommu/vt-d: Add IOMMU perfmon overflow handler support iommu/vt-d: Enable IOMMU perfmon support

 .../sysfs-bus-event_source-devices-iommu      |  37 +
 drivers/iommu/intel/Kconfig                   |  11 +
 drivers/iommu/intel/Makefile                  |   1 +
 drivers/iommu/intel/dmar.c                    |  33 +-
 drivers/iommu/intel/iommu.c                   |  59 ++
 drivers/iommu/intel/iommu.h                   | 102 +-
 drivers/iommu/intel/perfmon.c                 | 877 ++++++++++++++++++
 drivers/iommu/intel/perfmon.h                 |  64 ++
 drivers/iommu/intel/svm.c                     |   2 +-
 include/acpi/actbl1.h                         |   2 +-
 include/linux/cpuhotplug.h                    |   1 +
 include/linux/dmar.h                          |   1 +
 12 files changed, 1182 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-iommu
 create mode 100644 drivers/iommu/intel/perfmon.c
 create mode 100644 drivers/iommu/intel/perfmon.h
Signature · 1 line
2.35.1