Skip to content

Commit eac3fde

Browse files
committed
Merge remote-tracking branch 'opcm-github/master'
Change-Id: I8fd4198cef7e464bf918e4f8c6d70705e2e137b2
2 parents 9303d6f + 8d47369 commit eac3fde

File tree

8 files changed

+48
-145
lines changed

8 files changed

+48
-145
lines changed

.github/workflows/freebsd_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
submodules: recursive
2626
- name: build in FreeBSD VM
2727
id: build
28-
uses: cross-platform-actions/action@cdc9ee69ef84a5f2e59c9058335d9c57bcb4ac86 # v0.25.0
28+
uses: cross-platform-actions/action@2d97d42e1972a17b045fd709a422f7e55a86230d
2929
with:
3030
memory: 2048
3131
shell: sh
3232
operating_system: freebsd
33-
version: '14.1'
33+
version: '14.2'
3434
run: |
3535
sudo mkdir -p /usr/local/etc/pkg/repos
3636
sudo sh -c 'echo "FreeBSD: { url: \"https://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", enabled: yes }" > /usr/local/etc/pkg/repos/FreeBSD.conf'

.github/workflows/freebsd_scan_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
submodules: recursive
2626
- name: clang scan build in FreeBSD VM
2727
id: clang-scan-build
28-
uses: cross-platform-actions/action@cdc9ee69ef84a5f2e59c9058335d9c57bcb4ac86 # v0.25.0
28+
uses: cross-platform-actions/action@2d97d42e1972a17b045fd709a422f7e55a86230d
2929
with:
3030
memory: 2048
3131
shell: sh
3232
operating_system: freebsd
33-
version: '14.1'
33+
version: '14.2'
3434
run: |
3535
sudo mkdir -p /usr/local/etc/pkg/repos
3636
sudo sh -c 'echo "FreeBSD: { url: \"https://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", enabled: yes }" > /usr/local/etc/pkg/repos/FreeBSD.conf'

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM fedora:41@sha256:3ec60eb34fa1a095c0c34dd37cead9fd38afb62612d43892fcf1d3425c32bc1e AS builder
1+
FROM fedora:41@sha256:f84a7b765ce09163d11de44452a4b56c1b2f5571b6f640b3b973c6afc4e63212 AS builder
22
# Dockerfile for Intel PCM sensor server
33
# SPDX-License-Identifier: BSD-3-Clause
44
# Copyright (c) 2020-2024 Intel Corporation
@@ -7,7 +7,7 @@ RUN dnf -y install gcc-c++ git findutils make cmake openssl openssl-devel libasa
77
COPY . /tmp/pcm
88
RUN cd /tmp/pcm && mkdir build && cd build && cmake -DPCM_NO_STATIC_LIBASAN=OFF .. && make -j
99

10-
FROM fedora:41@sha256:3ec60eb34fa1a095c0c34dd37cead9fd38afb62612d43892fcf1d3425c32bc1e
10+
FROM fedora:41@sha256:f84a7b765ce09163d11de44452a4b56c1b2f5571b6f640b3b973c6afc4e63212
1111
COPY --from=builder /tmp/pcm/build/bin/* /usr/local/bin/
1212
COPY --from=builder /tmp/pcm/build/bin/opCode*.txt /usr/local/share/pcm/
1313
COPY --from=builder /usr/share/hwdata/pci.ids /usr/share/hwdata/pci.ids

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PCM provides a number of command-line utilities for real-time monitoring:
4242

4343
- **pcm-latency** : monitor L1 cache miss and DDR/PMM memory latency
4444
- **pcm-pcie** : monitor PCIe bandwidth per-socket
45-
- **pcm-iio** : monitor PCIe bandwidth per PCIe device
45+
- **pcm-iio** : [monitor PCIe bandwidth per PCIe bus/device](doc/PCM_IIO_README.md)
4646

4747
![pcm-iio output](https://raw.githubusercontent.com/wiki/intel/pcm/pcm-iio.png)
4848
- **pcm-numa** : monitor local and remote memory accesses

doc/PCM_ACCEL_README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
## Purpose:
22

3-
Intel® Xeon® Scalable Processors UNCORE accelerator(start from 4th Gen Intel® Xeon® Scalable Processor (codenamed Sapphire Rapids)) including Intel® In-Memory Analytics Accelerator (Intel® IAA), Intel® Data Streaming Accelerator (Intel® DSA) and Intel® QuickAssist Technology (Intel® QAT), etc are key feature of Intel® Xeon® Scalable Processors that can benefit the Intel architecture platform performance in the data center industry.
3+
Intel® Xeon® Scalable Processors, starting from the 4th Generation (codenamed Sapphire Rapids), feature accelerators, which include the Intel® In-Memory Analytics Accelerator (Intel® IAA), Intel® Data Streaming Accelerator (Intel® DSA), and Intel® QuickAssist Technology (Intel® QAT), among others. These accelerators are essential components that can enhance the performance of Intel architecture platforms.
44

5-
The accelerator and related software stack can be a key contributor to data center system performance, but sometimes it’s NOT easy for customer/user to get/understand the performance data of the accelerator like utilization, throughput, etc since low level hardware event sets is complex to understand without the deep knowledge of the accelerator hardware/software architecture.
5+
Although these accelerators and their associated software stacks can significantly contribute to data center system performance, customers and users often find it challenging to access and understand performance data such as utilization and throughput. This difficulty arises from the complexity of low-level hardware event sets, which require a deep understanding of the accelerator's hardware and software architecture.
66

7-
This pcm-accel tool will sample the performance data from accelerator hardware and show it to end user in an easy-to-understanding format.
8-
9-
The goal is to help the user to quickly and accurately see a high-level performance picture or identify issues related to accelerator with or without solid knowledge of it.
7+
The pcm-accel tool addresses this challenge by sampling performance data from the accelerator hardware and presenting it to end users in an easy-to-understand format. Its goal is to enable users to quickly and accurately gain a high-level overview of performance or identify issues related to the accelerator, regardless of their level of expertise in the underlying technology.
108

119
## Command syntax:
1210

doc/PCM_IIO_README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Purpose:
2+
3+
PCM-IIO tool monitors PCIe transactions with a breakdown per PCIe bus (IIO stack) and/or PCIe devices.
4+
5+
## Tool UI introduction:
6+
7+
Inbound (PCIe device DMA into system) metrics:
8+
9+
* IB write (inbound write): the number of bytes per second that the PCIe device requested to write to main memory through DMA
10+
* IB read (inbound read): the number of bytes per second that the PCIe device requested to read from main memory through DMA
11+
12+
Outbound (CPU MMIO to the PCIe device) metrics:
13+
14+
* OB read (outbound write): the number of bytes per second that the CPU requested to write to the PCIe device through MMIO (Memory-mapped I/O)
15+
* OB write (outbound read): the number of bytes per second that the CPU requested to read from the PCIe device through MMIO
16+
17+
IOMMU metrics:
18+
19+
* IOTLB Lookup: IOTLB lookups per second
20+
* IOTLB Miss: IOTLB misses per second
21+
* Ctxt Cache Hit: Context cache hits per second
22+
* 256T Cache Hit: Second Level Page Walk Cache Hits to a 256T page per second
23+
* 512G Cache Hit: Second Level Page Walk Cache Hits to a 512G page per second
24+
* 1G Cache Hit: Second Level Page Walk Cache Hits to a 1G page per second
25+
* 2M Cache Hit: Second Level Page Walk Cache Hits to a 2M page per second
26+
* IOMMU Mem Access: IOMMU memory accesses per second
27+
28+
Sample output:
29+
30+
![image](https://github.com/user-attachments/assets/e8cce396-b210-49d5-ac95-dc43f9ae69d3)
31+
32+
## Event config file:
33+
34+
pcm-iio tool allows the user to customize the performance events with a config file as an advanced feature. The event config files are in opCode-x-y.txt files where x/y is cpu family is model id, for example 6/143 for Sapphire Rapids.
35+

src/pci.cpp

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -481,98 +481,6 @@ int PciHandle::openMcfgTable() {
481481
return handle;
482482
}
483483

484-
#ifndef PCM_USE_PCI_MM_LINUX
485-
486-
PciHandleM::PciHandleM(uint32 bus_, uint32 device_, uint32 function_) :
487-
fd(-1),
488-
bus(bus_),
489-
device(device_),
490-
function(function_),
491-
base_addr(0)
492-
{
493-
int handle = ::open("/dev/mem", O_RDWR);
494-
if (handle < 0) throw std::exception();
495-
fd = handle;
496-
497-
int mcfg_handle = PciHandle::openMcfgTable();
498-
if (mcfg_handle < 0) throw std::runtime_error("Cannot open any of /[pcm]/sys/firmware/acpi/tables/MCFG* files!");
499-
500-
int32 result = ::pread(mcfg_handle, (void *)&base_addr, sizeof(uint64), 44);
501-
502-
if (result != sizeof(uint64))
503-
{
504-
::close(mcfg_handle);
505-
throw std::exception();
506-
}
507-
508-
unsigned char max_bus = 0;
509-
510-
result = ::pread(mcfg_handle, (void *)&max_bus, sizeof(unsigned char), 55);
511-
512-
::close(mcfg_handle);
513-
if (result != sizeof(unsigned char))
514-
{
515-
throw std::exception();
516-
}
517-
518-
if (bus > (unsigned)max_bus)
519-
{
520-
std::cout << "WARNING: Requested bus number " << bus << " is larger than the max bus number " << (unsigned)max_bus << "\n";
521-
throw std::exception();
522-
}
523-
524-
// std::cout << "PCI config base addr: "<< std::hex << base_addr<< "\n" << std::dec;
525-
526-
base_addr += (bus * 1024ULL * 1024ULL + device * 32ULL * 1024ULL + function * 4ULL * 1024ULL);
527-
}
528-
529-
530-
bool PciHandleM::exists(uint32 /*groupnr_*/, uint32 /* bus_*/, uint32 /* device_ */, uint32 /* function_ */)
531-
{
532-
int handle = ::open("/dev/mem", O_RDWR);
533-
534-
if (handle < 0) {
535-
perror("error opening /dev/mem");
536-
return false;
537-
}
538-
539-
::close(handle);
540-
541-
handle = PciHandle::openMcfgTable();
542-
if (handle < 0) {
543-
return false;
544-
}
545-
546-
::close(handle);
547-
548-
return true;
549-
}
550-
551-
int32 PciHandleM::read32(uint64 offset, uint32 * value)
552-
{
553-
warnAlignment<4>("PciHandleM::read32", false, offset);
554-
return ::pread(fd, (void *)value, sizeof(uint32), offset + base_addr);
555-
}
556-
557-
int32 PciHandleM::write32(uint64 offset, uint32 value)
558-
{
559-
warnAlignment<4>("PciHandleM::write32", false, offset);
560-
return ::pwrite(fd, (const void *)&value, sizeof(uint32), offset + base_addr);
561-
}
562-
563-
int32 PciHandleM::read64(uint64 offset, uint64 * value)
564-
{
565-
warnAlignment<4>("PciHandleM::read64", false, offset);
566-
return ::pread(fd, (void *)value, sizeof(uint64), offset + base_addr);
567-
}
568-
569-
PciHandleM::~PciHandleM()
570-
{
571-
if (fd >= 0) ::close(fd);
572-
}
573-
574-
#endif // PCM_USE_PCI_MM_LINUX
575-
576484
// mmapped I/O version
577485

578486
MCFGHeader PciHandleMM::mcfgHeader;

src/pci.h

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class PciHandle
4949
DWORD pciAddress;
5050
#endif
5151

52-
friend class PciHandleM;
5352
friend class PciHandleMM;
5453

5554
PciHandle(); // forbidden
@@ -79,40 +78,7 @@ typedef PciHandle PciHandleType;
7978
typedef PciHandle PciHandleType;
8079
#elif defined(__FreeBSD__) || defined(__DragonFly__)
8180
typedef PciHandle PciHandleType;
82-
#else
83-
84-
// read/write PCI config space using physical memory
85-
class PciHandleM
86-
{
87-
#ifdef _MSC_VER
88-
89-
#else
90-
int32 fd;
91-
#endif
92-
93-
uint32 bus;
94-
uint32 device;
95-
uint32 function;
96-
uint64 base_addr;
97-
98-
PciHandleM() = delete; // forbidden
99-
PciHandleM(PciHandleM &) = delete; // forbidden
100-
PciHandleM & operator = (PciHandleM &) = delete; // forbidden
101-
102-
public:
103-
PciHandleM(uint32 bus_, uint32 device_, uint32 function_);
104-
105-
static bool exists(uint32 groupnr_, uint32 bus_, uint32 device_, uint32 function_);
106-
107-
int32 read32(uint64 offset, uint32 * value);
108-
int32 write32(uint64 offset, uint32 value);
109-
110-
int32 read64(uint64 offset, uint64 * value);
111-
112-
virtual ~PciHandleM();
113-
};
114-
115-
#ifndef _MSC_VER
81+
#elif defined(__linux__)
11682

11783
// read/write PCI config space using physical memory using mmapped file I/O
11884
class PciHandleMM
@@ -125,11 +91,9 @@ class PciHandleMM
12591
uint32 function;
12692
uint64 base_addr;
12793

128-
#ifdef __linux__
12994
static MCFGHeader mcfgHeader;
13095
static std::vector<MCFGRecord> mcfgRecords;
13196
static void readMCFG();
132-
#endif
13397

13498
PciHandleMM() = delete; // forbidden
13599
PciHandleMM(const PciHandleMM &) = delete; // forbidden
@@ -147,9 +111,7 @@ class PciHandleMM
147111

148112
virtual ~PciHandleMM();
149113

150-
#ifdef __linux__
151114
static const std::vector<MCFGRecord> & getMCFGRecords();
152-
#endif
153115
};
154116

155117
#ifdef PCM_USE_PCI_MM_LINUX
@@ -158,8 +120,8 @@ class PciHandleMM
158120
#define PciHandleType PciHandle
159121
#endif
160122

161-
#endif // _MSC_VER
162-
123+
#else
124+
#error "Platform not supported"
163125
#endif
164126

165127
template <class F>

0 commit comments

Comments
 (0)