Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (counter): Support for cpumask #271

Closed
wants to merge 3 commits into from

Conversation

cvonelm
Copy link
Member

@cvonelm cvonelm commented Apr 11, 2023

This PR adds support for the cpumask field of PMU events.

Some PMUs do not refer to a core component but to some piece of uncore, such as the amd_iommu_0 PMU found on modern AMD processors.

To be able to still measure them, perf associates every uncore PMU with a logical core. This relationship is recorded in the cpumask field.

This PR makes lo2s respect this cpumask field, only opening the PMU events on the cores recorded in cpumask.

Note that this works as both -E and --userspace-metric-event.

This PR is marked DRAFT for these reasons:

  • This is missing any sanity checks. Currently trying to open an uncore PMU event in process mode will silently ignore the given PMU event.
  • Are we fine with how --list-events looks?

Currently it prints something like this:

List of Kernel PMU events:

  amd_iommu_0/cmd_processed/ # [ UNCORE ]
  amd_iommu_0/cmd_processed_inv/ # [ UNCORE ]
  amd_iommu_0/ign_rd_wr_mmio_1ff8h/ # [ UNCORE ]
  amd_iommu_0/int_dte_hit/ # [ UNCORE ]
  amd_iommu_0/int_dte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_dte_hit/ # [ UNCORE ]
  amd_iommu_0/mem_dte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pde_hit/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pde_mis/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pte_hit/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_pass_excl/ # [ UNCORE ]
  amd_iommu_0/mem_pass_pretrans/ # [ UNCORE ]
  amd_iommu_0/mem_pass_untrans/ # [ UNCORE ]
  amd_iommu_0/mem_target_abort/ # [ UNCORE ]
  amd_iommu_0/mem_trans_total/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_gst/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_nst/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_tot/ # [ UNCORE ]
  amd_iommu_0/smi_blk/ # [ UNCORE ]
  amd_iommu_0/smi_recv/ # [ UNCORE ]
  amd_iommu_0/tlb_inv/ # [ UNCORE ]
  amd_iommu_0/vapic_int_guest/ # [ UNCORE ]
  amd_iommu_0/vapic_int_non_guest/ # [ UNCORE ]
  cpu/branch-instructions/
  cpu/branch-misses/
  cpu/cache-misses/
  cpu/cache-references/
  cpu/cpu-cycles/
  cpu/instructions/
  cpu/stalled-cycles-backend/
  cpu/stalled-cycles-frontend/
  msr/aperf/
  msr/irperf/
  msr/mperf/
  msr/tsc/
  power/energy-pkg/ # [ UNCORE ]

(* Only available in process-monitoring mode
(# Only available in system-monitoring mode

This PR does not address the second part of Issue #262, which is support for uncore events in process mode.

I think before we attempt to band-aid fix support for such a system-mode event in process mode we should have a discussion about a more general solution to combining system-mode and process mode measurements.

@cvonelm cvonelm marked this pull request as draft April 11, 2023 11:39
cvonelm and others added 3 commits April 19, 2023 09:58
cpumask is read now and the counter will only be started on the listed
cpus.

This still lacks pretty much any sanity checks, because the counter
sanity checking code should be refactored a bit before.

The following checks should probably be performed:

- Are we in system programmind mode?
- Are uncore event only given as userspace metric events?
@cvonelm cvonelm force-pushed the issue-259-cpumask-suppport branch from 8f3e59c to 94b8151 Compare April 20, 2023 12:38
@cvonelm
Copy link
Member Author

cvonelm commented Apr 20, 2023

Also the question is if this should be recorded on a new "uncore" location, instead of "core X"

@cvonelm
Copy link
Member Author

cvonelm commented Nov 27, 2023

As this PR is completely based on an EventDescription Rework which turned out to be a cluttery mess, I am closing this PR in favour of an implementation on the current EventDescription or a properly reworked version.

@cvonelm cvonelm closed this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant