Skip to content

Commit 05a741c

Browse files
committed
pcm-pcie: allow core offlining on select processor generations
1 parent 1b81f45 commit 05a741c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/cpucounters.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10283,6 +10283,7 @@ uint32 PCM::getMaxNumOfCBoxesInternal() const
1028310283
break;
1028410284
case SNOWRIDGE:
1028510285
num = (uint32)num_phys_cores_per_socket / 4;
10286+
maxNumOfCBoxesBasedOnCoreCount = true;
1028610287
break;
1028710288
default:
1028810289
/*
@@ -10291,6 +10292,7 @@ uint32 PCM::getMaxNumOfCBoxesInternal() const
1029110292
* value to be returned.
1029210293
*/
1029310294
num = (uint32)num_phys_cores_per_socket;
10295+
maxNumOfCBoxesBasedOnCoreCount = true;
1029410296
}
1029510297
#ifdef PCM_USE_PERF
1029610298
if (num <= 0)

src/cpucounters.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ class PCM_API PCM
624624
int32 num_phys_cores_per_socket;
625625
int32 num_online_cores;
626626
int32 num_online_sockets;
627+
mutable bool maxNumOfCBoxesBasedOnCoreCount{false};
627628
uint32 accel;
628629
uint32 accel_counters_num_max;
629630
uint32 core_gen_counter_num_max;
@@ -1886,6 +1887,12 @@ class PCM_API PCM
18861887
*/
18871888
bool isSomeCoreOfflined();
18881889

1890+
//! \brief Returns true if the CBox or CHA PMU count detection relies on physical core count
1891+
bool isMaxNumOfCBoxesBasedOnCoreCount() const
1892+
{
1893+
return maxNumOfCBoxesBasedOnCoreCount;
1894+
}
1895+
18891896
/*! \brief Returns the maximum number of custom (general-purpose) core events supported by CPU
18901897
*/
18911898
int32 getMaxCustomCoreEvents();

src/pcm-pcie.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,19 @@ void IPlatform::init()
7070
{
7171
print_cpu_details();
7272

73-
if (m_pcm->isSomeCoreOfflined())
73+
if (m_pcm->isMaxNumOfCBoxesBasedOnCoreCount() && m_pcm->isSomeCoreOfflined())
7474
{
75-
cerr << "Core offlining is not supported. Program aborted\n";
75+
/*
76+
The bandwwidth metrics can be calculated correctly only if we aggregate
77+
the event counts from all CHAs (CBoxes) in the socket. For this need to
78+
know the number of CBoxes in the socket. For some processors we do not
79+
have access to a register containing the CHA count but on those processors
80+
the number of CBoxes is equal to the number of cores. On such systems if
81+
the cores are offlined then the number of CBoxes can't be determined.
82+
pcm-pcie does not support such systems because the bandwidth can't be
83+
computed correctly.
84+
*/
85+
cerr << "Core offlining is not supported on your processor. Program aborted\n";
7686
exit(EXIT_FAILURE);
7787
}
7888
}

0 commit comments

Comments
 (0)