From ef33733ac4930135e88ab70efa91875ac694acc9 Mon Sep 17 00:00:00 2001 From: "Dementiev, Roman" Date: Wed, 6 Nov 2024 09:30:54 +0100 Subject: [PATCH] handle invalid CXL PMU entries Change-Id: I621725d4d0e5300b3b1052d91f7d18e3887c845a --- src/cpucounters.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cpucounters.cpp b/src/cpucounters.cpp index 9d2443b0..d0d7f545 100644 --- a/src/cpucounters.cpp +++ b/src/cpucounters.cpp @@ -2858,7 +2858,14 @@ void PCM::initUncorePMUsDirect() uncorePMUDiscovery->getNumBoxes(SPR_CXLDP_BOX_TYPE, s)); for (size_t pos = 0; pos < n_units; ++pos) { - cxlPMUs[s].push_back(std::make_pair(createCXLPMU(s, SPR_CXLCM_BOX_TYPE, pos), createCXLPMU(s, SPR_CXLDP_BOX_TYPE, pos))); + try + { + cxlPMUs[s].push_back(std::make_pair(createCXLPMU(s, SPR_CXLCM_BOX_TYPE, pos), createCXLPMU(s, SPR_CXLDP_BOX_TYPE, pos))); + } + catch (const std::exception& e) + { + std::cerr << "CXL PMU initialization for socket " << s << " at position " << pos << " failed: " << e.what() << std::endl; + } } } break;