summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Raybuck <matthew.raybuck@ibm.com>2019-02-26 14:24:31 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-03-01 09:02:52 -0600
commitd2899da82cb004acbcba439673dc1dfb02ae6fb6 (patch)
treebe96bb25c3135dcf2c274fb5e879a03067415a16
parent37e67698be56632c6505990dc3375136494d2a67 (diff)
downloadblackbird-hostboot-d2899da82cb004acbcba439673dc1dfb02ae6fb6.tar.gz
blackbird-hostboot-d2899da82cb004acbcba439673dc1dfb02ae6fb6.zip
Improve performance of Partial Good logic
The function PARTIAL_GOOD::findRulesForTarget() would call masterProcChipTargetHandle() to figure out if a rule applied to a specific target based on the ATTR_MODEL of a system. Since finding the master proc that way is an expensive operation, findRulesForTarget() will now use an instance variable initialized once instead of querying for it repeatedly thereby increasing performance substantially. Change-Id: I6e9c01daf356fe21d76d920f5d3210717f5094c1 CQ:SW450113 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72620 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/include/usr/hwas/common/pgLogic.H4
-rw-r--r--src/usr/hwas/common/pgLogic.C27
2 files changed, 23 insertions, 8 deletions
diff --git a/src/include/usr/hwas/common/pgLogic.H b/src/include/usr/hwas/common/pgLogic.H
index cfe5d599f..1adf5509f 100644
--- a/src/include/usr/hwas/common/pgLogic.H
+++ b/src/include/usr/hwas/common/pgLogic.H
@@ -420,6 +420,7 @@ namespace PARTIAL_GOOD
struct PartialGoodRulesTable
{
+ PartialGoodRulesTable();
~PartialGoodRulesTable();
/**
@@ -444,6 +445,9 @@ namespace PARTIAL_GOOD
pgLogic_t &o_pgLogic) const;
private:
+
+ mutable TARGETING::TargetHandle_t iv_pMasterProc;
+
// A map that will hold all of the PG rules for all targets. If a target
// doesn't have a pg checking logic or special rules it will still be
// represented in this map because the generic algorithm will consider
diff --git a/src/usr/hwas/common/pgLogic.C b/src/usr/hwas/common/pgLogic.C
index 307527fc3..b8f32f714 100644
--- a/src/usr/hwas/common/pgLogic.C
+++ b/src/usr/hwas/common/pgLogic.C
@@ -213,6 +213,9 @@ namespace PARTIAL_GOOD
const PartialGoodRulesTable pgTable;
+ PartialGoodRulesTable::PartialGoodRulesTable() : iv_pMasterProc(nullptr)
+ {}
+
PartialGoodRulesTable::~PartialGoodRulesTable()
{
for (auto const& type : pgRules_map)
@@ -231,6 +234,21 @@ namespace PARTIAL_GOOD
{
errlHndl_t l_errl = nullptr;
+ if (iv_pMasterProc == nullptr)
+ {
+ // Since many targets don't have ATTR_MODEL filled in, lookup the
+ // master proc so that we can use to verify if a PG rule is
+ // applicable for this chip type.
+ // NOTE: This is done only once since querying for the master proc
+ // is an expensive operation.
+ TARGETING::targetService()
+ .masterProcChipTargetHandle(iv_pMasterProc);
+
+ HWAS_ASSERT(iv_pMasterProc, "findRulesForTarget: couldn't get "
+ "master proc.");
+
+ }
+
// Lookup the Target in the PG Rules Table
auto rulesIterator =
pgRules_map.find(i_target->getAttr<TARGETING::ATTR_TYPE>());
@@ -245,13 +263,6 @@ namespace PARTIAL_GOOD
pgRules_t l_allRules = rulesIterator->second;
- // Since many targets don't have ATTR_MODEL filled in, lookup
- // the master proc and use that to verify if this chip type is
- // applicable for the target.
- TARGETING::TargetService& ts = TARGETING::targetService();
- TARGETING::TargetHandle_t masterProc;
- ts.masterProcChipTargetHandle(masterProc);
-
// Iterate through all of the pg rules and compose a list of
// applicable rules based on chip unit and chip type.
for (pgRules_t::const_iterator pgRule = l_allRules.begin();
@@ -262,7 +273,7 @@ namespace PARTIAL_GOOD
// Compare the pgRule's chip type to the target. Encode the
// target's chip unit and see if it is a match for this rule.
- if ((*pgRule)->iv_applicableChipTypes(masterProc)
+ if ((*pgRule)->iv_applicableChipTypes(iv_pMasterProc)
&& (*pgRule)->isApplicableToChipUnit(targetCU))
{
// Current PG Rule is applicable to this target so create
OpenPOWER on IntegriCloud