Skip to content

Commit 99e8bd9

Browse files
authored
Merge pull request #950 from intel/push-2025-05-07.2
Push 2025 05 07.2
2 parents 1388f45 + d0e8e15 commit 99e8bd9

File tree

13 files changed

+127
-207
lines changed

13 files changed

+127
-207
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ latex/
3232
.vs/
3333
.idea/
3434
build
35-
src/simdjson
35+
src/simdjson
36+
.vscode/

pcm.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ rm -rf $RPM_BUILD_ROOT
7272
%{_sbindir}/pcm-core
7373
%{_sbindir}/pcm-iio
7474
%{_sbindir}/pcm-latency
75-
%{_sbindir}/pcm-lspci
7675
%{_sbindir}/pcm-memory
7776
%{_sbindir}/pcm-msr
7877
%{_sbindir}/pcm-mmio

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
include(FindOpenSSL)
55

66
# All pcm-* executables
7-
set(PROJECT_NAMES pcm pcm-numa pcm-latency pcm-power pcm-msr pcm-memory pcm-tsx pcm-pcie pcm-core pcm-iio pcm-lspci pcm-pcicfg pcm-mmio pcm-tpmi pcm-raw pcm-accel)
7+
set(PROJECT_NAMES pcm pcm-numa pcm-latency pcm-power pcm-msr pcm-memory pcm-tsx pcm-pcie pcm-core pcm-iio pcm-pcicfg pcm-mmio pcm-tpmi pcm-raw pcm-accel)
88

99
set(MINIMUM_OPENSSL_VERSION 1.1.1)
1010

src/MacMSRDriver/PcmMsr/PcmMsr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ void cpuGetTopoData(void* pTopos){
6464
uint32 smtMaskWidth = 0;
6565
uint32 coreMaskWidth = 0;
6666
uint32 l2CacheMaskShift = 0;
67-
initCoreMasks(smtMaskWidth, coreMaskWidth, l2CacheMaskShift);
67+
uint32 l3CacheMaskShift = 0;
68+
initCoreMasks(smtMaskWidth, coreMaskWidth, l2CacheMaskShift, l3CacheMaskShift);
6869
PCM_CPUID_INFO cpuid_args;
6970
pcm_cpuid(0xb, 0x0, cpuid_args);
70-
fillEntry(entry, smtMaskWidth, coreMaskWidth, l2CacheMaskShift, cpuid_args.array[3]);
71+
const auto apic_id = cpuid_args.array[3];
72+
fillEntry(entry, smtMaskWidth, coreMaskWidth, l2CacheMaskShift, apic_id);
73+
entry.l3_cache_id = extract_bits_32(apic_id, l3CacheMaskShift, 31);
7174
}
7275

7376
OSDefineMetaClassAndStructors(com_intel_driver_PcmMsr, IOService)

src/cpucounters.cpp

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,7 @@ bool PCM::discoverSystemTopology()
11011101
uint32 smtMaskWidth = 0;
11021102
uint32 coreMaskWidth = 0;
11031103
uint32 l2CacheMaskShift = 0;
1104+
uint32 l3CacheMaskShift = 0;
11041105

11051106
struct domain
11061107
{
@@ -1111,7 +1112,7 @@ bool PCM::discoverSystemTopology()
11111112
{
11121113
TemporalThreadAffinity aff0(0);
11131114

1114-
if (initCoreMasks(smtMaskWidth, coreMaskWidth, l2CacheMaskShift) == false)
1115+
if (initCoreMasks(smtMaskWidth, coreMaskWidth, l2CacheMaskShift, l3CacheMaskShift) == false)
11151116
{
11161117
std::cerr << "ERROR: Major problem? No leaf 0 under cpuid function 11.\n";
11171118
return false;
@@ -1151,20 +1152,18 @@ bool PCM::discoverSystemTopology()
11511152
for (size_t l = 0; l < topologyDomains.size(); ++l)
11521153
{
11531154
topologyDomainMap[topologyDomains[l].type] = topologyDomains[l];
1154-
#if 0
1155-
std::cerr << "Topology level: " << l <<
1156-
" type: " << topologyDomains[l].type <<
1157-
" (" << TopologyEntry::getDomainTypeStr(topologyDomains[l].type) << ")" <<
1158-
" width: " << topologyDomains[l].width <<
1159-
" levelShift: " << topologyDomains[l].levelShift <<
1160-
" nextLevelShift: " << topologyDomains[l].nextLevelShift << "\n";
1161-
#endif
1155+
DBG(1 , "Topology level: " , l ,
1156+
" type: " , topologyDomains[l].type ,
1157+
" (" , TopologyEntry::getDomainTypeStr(topologyDomains[l].type) , ")" ,
1158+
" width: " , topologyDomains[l].width ,
1159+
" levelShift: " , topologyDomains[l].levelShift ,
1160+
" nextLevelShift: " , topologyDomains[l].nextLevelShift);
11621161
}
11631162
}
11641163
}
11651164

11661165
#ifndef __APPLE__
1167-
auto populateEntry = [&topologyDomainMap,&smtMaskWidth, &coreMaskWidth, &l2CacheMaskShift](TopologyEntry& entry)
1166+
auto populateEntry = [&topologyDomainMap,&smtMaskWidth, &coreMaskWidth, &l2CacheMaskShift, &l3CacheMaskShift](TopologyEntry& entry)
11681167
{
11691168
auto getAPICID = [&](const uint32 leaf)
11701169
{
@@ -1218,6 +1217,7 @@ bool PCM::discoverSystemTopology()
12181217
{
12191218
fillEntry(entry, smtMaskWidth, coreMaskWidth, l2CacheMaskShift, getAPICID(0xb));
12201219
}
1220+
entry.l3_cache_id = extract_bits_32(getAPICID(0xb), l3CacheMaskShift, 31);
12211221
};
12221222
#endif
12231223

@@ -3231,7 +3231,7 @@ void PCM::printDetailedSystemTopology(const int detailLevel)
32313231
std::cerr << "Tile_Id ";
32323232
if (detailLevel > 0) std::cerr << "Die_Id Die_Group_Id ";
32333233
std::cerr << "Package_Id Core_Type Native_CPU_Model\n";
3234-
std::map<uint32, std::vector<uint32> > os_id_by_core, os_id_by_tile, core_id_by_socket;
3234+
std::map<uint32, std::vector<uint32> > os_id_by_core, os_id_by_tile, core_id_by_socket, os_id_by_l3_cache;
32353235
size_t counter = 0;
32363236
for (auto it = topology.begin(); it != topology.end(); ++it)
32373237
{
@@ -3252,6 +3252,7 @@ void PCM::printDetailedSystemTopology(const int detailLevel)
32523252
// add socket offset to distinguish cores and tiles from different sockets
32533253
os_id_by_core[(it->socket_id << 15) + it->core_id].push_back(it->os_id);
32543254
os_id_by_tile[(it->socket_id << 15) + it->tile_id].push_back(it->os_id);
3255+
os_id_by_l3_cache[(it->socket_id << 15) + it->l3_cache_id].push_back(it->os_id);
32553256

32563257
++counter;
32573258
}
@@ -3288,6 +3289,16 @@ void PCM::printDetailedSystemTopology(const int detailLevel)
32883289
}
32893290
std::cerr << ")";
32903291
}
3292+
std::cerr << "\nL3$ ";
3293+
for (auto core = os_id_by_l3_cache.begin(); core != os_id_by_l3_cache.end(); ++core)
3294+
{
3295+
auto os_id = core->second.begin();
3296+
std::cerr << "(" << *os_id;
3297+
for (++os_id; os_id != core->second.end(); ++os_id) {
3298+
std::cerr << "," << *os_id;
3299+
}
3300+
std::cerr << ")";
3301+
}
32913302
std::cerr << "\n";
32923303
std::cerr << "\n";
32933304
}
@@ -7560,14 +7571,23 @@ void PCM::getPCICFGPMUsFromDiscovery(const unsigned int BoxType, const size_t s,
75607571
{
75617572
std::vector<std::shared_ptr<HWRegister> > CounterControlRegs, CounterValueRegs;
75627573
const auto n_regs = uncorePMUDiscovery->getBoxNumRegs(BoxType, s, pos);
7563-
auto makeRegister = [](const uint64 rawAddr)
7574+
auto makeRegister = [&pos, &numBoxes, &BoxType, &s](const uint64 rawAddr)
75647575
{
75657576
#ifndef PCI_ENABLE
75667577
constexpr auto PCI_ENABLE = 0x80000000ULL;
75677578
#endif
75687579
UncorePMUDiscovery::PCICFGAddress Addr;
75697580
Addr.raw = rawAddr;
7570-
assert(Addr.raw & PCI_ENABLE);
7581+
if ((Addr.raw & PCI_ENABLE) == 0)
7582+
{
7583+
std::cerr << "PCM Error: PCI_ENABLE bit not set in address 0x" << std::hex << Addr.raw << std::dec << "\n";
7584+
std::cerr << "This is likely a bug in the uncore PMU discovery BIOS table. Contact your BIOS vendor.\n";
7585+
std::cerr << "Socket: " << s << "\n";
7586+
std::cerr << "Box type: " << BoxType << "\n";
7587+
std::cerr << "Box position: " << pos << "/" << numBoxes << "\n";
7588+
std::cerr << "Address: " << Addr.getStr() << "\n";
7589+
return std::shared_ptr<PCICFGRegister64>();
7590+
}
75717591
try {
75727592
auto handle = std::make_shared<PciHandleType>(0, (uint32)Addr.fields.bus,
75737593
(uint32)Addr.fields.device,

src/lspci.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,6 @@ bool probe_pci(struct pci *p)
9494
return p->exist;
9595
}
9696

97-
void print_pci(struct pci p, const PCIDB & pciDB)
98-
{
99-
printf("Parent bridge info:");
100-
printf("%x:%x.%d [%04x:%04x] %s %s %d P:%x S:%x S:%x ",
101-
p.bdf.busno, p.bdf.devno, p.bdf.funcno,
102-
p.vendor_id, p.device_id,
103-
(pciDB.first.count(p.vendor_id) > 0)?pciDB.first.at(p.vendor_id).c_str():"unknown vendor",
104-
(pciDB.second.count(p.vendor_id) > 0 && pciDB.second.at(p.vendor_id).count(p.device_id) > 0)?pciDB.second.at(p.vendor_id).at(p.device_id).c_str():"unknown device",
105-
p.header_type,
106-
p.primary_bus_number, p.secondary_bus_number, p.subordinate_bus_number);
107-
printf("Device info:");
108-
printf("%x:%x.%d [%04x:%04x] %s %s %d Gen%d x%d\n",
109-
p.bdf.busno, p.bdf.devno, p.bdf.funcno,
110-
p.vendor_id, p.device_id,
111-
(pciDB.first.count(p.vendor_id) > 0)?pciDB.first.at(p.vendor_id).c_str():"unknown vendor",
112-
(pciDB.second.count(p.vendor_id) > 0 && pciDB.second.at(p.vendor_id).count(p.device_id) > 0)?pciDB.second.at(p.vendor_id).at(p.device_id).c_str():"unknown device",
113-
p.header_type,
114-
p.link_speed, p.link_width);
115-
}
116-
11797
void load_PCIDB(PCIDB & pciDB)
11898
{
11999
std::ifstream in(PCI_IDS_PATH);

src/lspci.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,6 @@ struct pci {
242242
bool isIntelDeviceById(uint16_t device_id) const { return (isIntelDevice() && (this->device_id == device_id)); }
243243
};
244244

245-
struct iio_skx {
246-
struct {
247-
struct {
248-
struct pci root_pci_dev; /* single device represent root port */
249-
std::vector<struct pci> child_pci_devs; /* Contain child switch and end-point devices */
250-
} parts[4]{}; /* part 0, 1, 2, 3 */
251-
uint8_t busno{}; /* holding busno for each IIO stack */
252-
std::string stack_name{};
253-
std::vector<uint64_t> values{};
254-
bool flipped = false;
255-
} stacks[6]; /* iio stack 0, 1, 2, 3, 4, 5 */
256-
uint32_t socket_id{};
257-
};
258-
259245
struct iio_bifurcated_part {
260246
int part_id{0};
261247
/* single device represent root port */
@@ -296,8 +282,6 @@ bool probe_pci(struct pci *p);
296282
*/
297283
typedef std::pair< std::map<int, std::string> ,std::map< int, std::map<int, std::string> > > PCIDB;
298284

299-
void print_pci(struct pci p, const PCIDB & pciDB);
300-
301285
void load_PCIDB(PCIDB & pciDB);
302286

303287
} // namespace pcm

src/pcm-iio-pmu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ string build_pci_header(const PCIDB & pciDB, uint32_t column_width, const struct
5555
for (auto& part : p.parts_no) {
5656
s += std::to_string(part) + ", ";
5757
}
58-
s += "\b\b ";
58+
s.erase(s.size() - 2);
5959
}
6060

6161
/* row with data */

src/pcm-lspci.cpp

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)