Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

WS6: Performance Monitor Unit

Owner: TBD Team Size: 1-2 engineers Duration: 6-8 weeks Priority: Medium

💬 Discuss WS6: Join #powercommons:matrix.org to discuss PMU architecture, event mappings, and Linux perf integration.

Objectives

Replace implementation-specific PMU with architected ISA v3.1C PMU.

Background

The A2 core currently implements A2-specific performance monitoring registers (AESR, CESR, IESR, MESR, XESR). To achieve ISA v3.1C compliance, we need to replace these with the architected Performance Monitor Unit (PMU) defined in Book III-S.

The architected PMU provides:

  • Standardized interface: MMCR0/1/2/A control registers
  • Six performance counters: PMC1-6 (SPR 771-776)
  • Event sampling: SIER for sampled instruction data
  • Portability: Standard event codes across POWER implementations
  • Linux perf support: Required for perf command and performance analysis

Tasks

Remove A2-Specific PMU Registers

Implement Architected PMU Registers

Event Mapping

Testing and Validation

Implementation Notes

Counter Overflow Handling

When PMC[i] overflows (bit 0 transitions from 0 to 1):
1. Set MMCR0[PMAO] (alert occurred)
2. If MMCR0[PMAE]=1, trigger Performance Monitor Interrupt
3. Freeze counters if MMCR0[FCECE]=1
4. Sample instruction data into SIER if enabled

Performance Monitor Interrupt

  • Vector: 0xF00 (Performance Monitor Exception)
  • Saves PC in SRR0
  • Must be enabled via MSR[EE] and MMCR0[PMAE]
  • Critical for profiling tools

Linux Integration

The architected PMU enables:

  • perf stat - hardware counter statistics
  • perf record - sampling-based profiling
  • perf top - real-time profiling
  • perf annotate - instruction-level profiling

Register Summary

SPR NumberRegisterPurpose
768SIERSampled Instruction Event Register
769MMCR2Monitor Mode Control Register 2
770MMCR1, MMCRAMonitor Mode Control Registers
771-776PMC1-6Performance Monitor Counters
779MMCR0Monitor Mode Control Register 0

Dependencies

  • None (can start immediately)
  • Parallel with WS1, WS3, WS4

Success Criteria

  • All A2-specific PMU registers removed
  • All architected PMU registers implemented
  • At least 10 architected events supported
  • PMU interrupts working correctly
  • Counters count accurately (verified against RTL simulation)
  • Linux perf command works on A2 core
  • Pass ISA compliance PMU tests

Performance Impact

  • Minimal impact on core frequency
  • Counters run in parallel with execution
  • Event detection should not be on critical timing path
  • Target: No frequency degradation

Documentation Requirements

  • User Manual chapter on Performance Monitoring
  • List all supported events with descriptions
  • Example code for programming PMU
  • Performance monitoring best practices

Open Questions

  1. Event Selection: Which architected events are feasible to implement in A2?
  2. Sampling Frequency: What is acceptable overhead for SIER sampling?
  3. Backwards Compatibility: Do we provide emulation for old A2 PMU registers?

References

  • Power ISA v3.1C Book III-S, Chapter 4: Performance Monitor
  • OpenPOWER ELF v2 ABI: PMU Programming Interface
  • Linux kernel: arch/powerpc/perf/ implementation
  • IBM POWER PMU documentation

Issues

Status: 10 open, 0 closed (0/10 complete)

#TitleCategoryTagsStatusPriorityAssignee
#49Remove AESR, CESR, IESR1-2, MESR1-2, XESR1-2 registersGeneral-⬜ Open🟡 Medium-
#50Implement PMC1-6 registersGeneral-⬜ Open🟡 Medium-
#51Implement MMCR0 registerGeneral-⬜ Open🟡 Medium-
#52Implement MMCR1 registerGeneral-⬜ Open🟡 Medium-
#53Implement MMCR2 registerGeneral-⬜ Open🟡 Medium-
#54Implement MMCRA registerGeneral-⬜ Open🟡 Medium-
#55Implement SIER registerGeneral-⬜ Open🟡 Medium-
#56Implement architected event selectionGeneral-⬜ Open🟡 Medium-
#57Add implementation-specific eventsGeneral-⬜ Open🟡 Medium-
#58Create PMU test suiteGeneral-⬜ Open🟡 Medium-

Last updated: 2025-12-05 16:48:17