diff options
| author | Dan Crowell <dcrowell@us.ibm.com> | 2018-06-08 16:03:18 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-06-10 21:28:53 -0400 |
| commit | 4189613d36cc98d9b52ae72c1bb3727cdb16e34b (patch) | |
| tree | 7dafbc7a76492288aa2c297d9a2a2f0016bc737c /src/usr/targeting/runtime | |
| parent | f290f5d4a9efbf70ae99ec0cdff5b676d63431f1 (diff) | |
| download | blackbird-hostboot-4189613d36cc98d9b52ae72c1bb3727cdb16e34b.tar.gz blackbird-hostboot-4189613d36cc98d9b52ae72c1bb3727cdb16e34b.zip | |
Fix for multinode HBRT use of VPD
Node0 VPD memory is being used for all nodes because we were
using a Singleton pointer across modules. This is a problem
because static memory is specific to each module which meant
we were getting a new copy of the AttrRP object instead of
the real version that had real data in it.
The change here is to create a new static interface that
external modules can call to retrieve the node associated
with a given Target.
There is also a change to cache this data into a map as I
noticed hundreds of accesses during the one function call
I was using to test with.
Change-Id: I148bf1f405d076276193d526d8a4b1f0649b2c1c
CQ: SW431462
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60276
Tested-by: Jenkins Server <pfd-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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/runtime')
| -rw-r--r-- | src/usr/targeting/runtime/attrrp_rt.C | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C index 55be8eaf9..8a7b7824b 100644 --- a/src/usr/targeting/runtime/attrrp_rt.C +++ b/src/usr/targeting/runtime/attrrp_rt.C @@ -31,6 +31,7 @@ #include <targeting/targplatreasoncodes.H> #include <util/runtime/util_rt.H> #include <sys/internode.h> +#include <map> #include "../attrrp_common.C" @@ -436,6 +437,20 @@ namespace TARGETING #undef TARG_FN } + NODE_ID AttrRP::getNodeId(const Target* i_pTarget) + { + #define TARG_FN "getNodeId" + + NODE_ID l_nodeId = 0; + + // Call the class function with my module-local singleton + TARGETING::AttrRP *l_attrRP = &TARG_GET_SINGLETON(TARGETING::theAttrRP); + l_attrRP->getNodeId(i_pTarget, l_nodeId); + + return l_nodeId; + #undef TARG_FN + } + void AttrRP::getNodeId(const Target* i_pTarget, NODE_ID& o_nodeId) const { #define TARG_FN "getNodeId" @@ -445,6 +460,15 @@ namespace TARGETING // Initialize with invalid o_nodeId = INVALID_NODE_ID; + // Check if we have a cached version first + static std::map<const Target*,NODE_ID> s_targToNodeMap; + auto l_nodeItr = s_targToNodeMap.find(i_pTarget); + if( l_nodeItr != s_targToNodeMap.end() ) + { + o_nodeId = l_nodeItr->second; + return; + } + //find the node to which this target belongs for(uint8_t i=0; i<INVALID_NODE_ID; ++i) { @@ -453,6 +477,11 @@ namespace TARGETING if( iv_nodeContainer[i].pSections[j].type == SECTION_TYPE_PNOR_RO) { + TARG_DBG("%d/%d> pTargetMap=%p, end=%p", i, j, iv_nodeContainer[i].pTargetMap, ( + reinterpret_cast<uint8_t*>( + iv_nodeContainer[i].pTargetMap) + + iv_nodeContainer[i].pSections[j].size) ); + // This expects the pTarget to be always in range and !NULL. // If any invalid target is passed (which is still within the // RO Section scope) then behaviour is undefined. @@ -464,6 +493,8 @@ namespace TARGETING { l_found = true; o_nodeId = i; + s_targToNodeMap[i_pTarget] = i; + TARG_DBG("Target %p is on node %d @ %p", i_pTarget, o_nodeId, &o_nodeId ); break; } } |

