summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/common/iterators
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2013-09-06 16:25:14 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-10-08 16:37:41 -0500
commit31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67 (patch)
treec0d1847802950d4ff41cdc1bc4eed8933a1f5774 /src/usr/targeting/common/iterators
parent6b7a65cc7ec85b4937c444dd7f3bb8424b9255ab (diff)
downloadtalos-hostboot-31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67.tar.gz
talos-hostboot-31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67.zip
Support multinode targeting
- Added support for master processor type attributes - Made attribute sync multinode aware - Added platform properties constants - Added multinode iterator support - Extended default iterator to skip hidden system targets - Added raw iterator to "see" hidden system targets - Updated target service to be multinode aware - Added new API to query master proc per node - Modified MRW parser to support cross node peers - Modified MRW parser to default master proc per node - Removed cross node peer workarounds in node splitter script - Added common support for master system targets - Updated attribute compiler to serialize cross node peer targets - Updated attribute compiler to generate attribute size map - Updated attribute compiler to impose special ordering on target layout - Inhibited XML merge script from merging itself in xmltohb makefile - Inhibited duplicate weak symbol errors in trace statements Change-Id: I661eca12f3a7cc16c0ff5476a7ae66cea3bad7d3 RTC: 63940 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6103 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/iterators')
-rw-r--r--src/usr/targeting/common/iterators/rangefilter.C59
-rw-r--r--src/usr/targeting/common/iterators/rawtargetiterator.C91
-rw-r--r--src/usr/targeting/common/iterators/targetiterator.C95
3 files changed, 183 insertions, 62 deletions
diff --git a/src/usr/targeting/common/iterators/rangefilter.C b/src/usr/targeting/common/iterators/rangefilter.C
index 7e3ddf333..961db1ea7 100644
--- a/src/usr/targeting/common/iterators/rangefilter.C
+++ b/src/usr/targeting/common/iterators/rangefilter.C
@@ -1,30 +1,30 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/targeting/iterators/rangefilter.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/targeting/common/iterators/rangefilter.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
/**
* @file common/targeting/iterators/rangefilter.C
*
- * @brief Implementation of an object which takes an iterator range and
+ * @brief Implementation of an object which takes an iterator range and
* allows caller to iterate through the elements which match a supplied
* predicate (filter)
*/
@@ -39,6 +39,7 @@
// Targeting Component
#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/trace.H>
//******************************************************************************
// Macros
@@ -66,17 +67,21 @@ namespace TARGETING
template<typename IteratorType>
void RangeFilter<IteratorType>::advance()
{
+ #define TARG_FN "RangeFilter<IteratorType>::advance()"
+
if(iv_current != iv_end)
{
while( (++iv_current) != iv_end )
{
- if( (!iv_pPredicate)
+ if( (!iv_pPredicate)
|| ((*iv_pPredicate)(*iv_current)))
{
break;
}
}
}
+
+ #undef TARG_FN
}
//******************************************************************************
@@ -100,8 +105,8 @@ void RangeFilter<IteratorType>::advanceIfNoMatch()
template<typename IteratorType>
RangeFilter<IteratorType>::operator fake_bool() const
-{
- return (iv_current != iv_end)
+{
+ return (iv_current != iv_end)
? &RangeFilter::notComparable : NULL;
}
@@ -115,7 +120,7 @@ template void RangeFilter<ConstTargetIterator>::advance();
template void RangeFilter<TargetIterator>::advanceIfNoMatch();
template void RangeFilter<ConstTargetIterator>::advanceIfNoMatch();
-template RangeFilter<TargetIterator>::operator fake_bool() const;
+template RangeFilter<TargetIterator>::operator fake_bool() const;
template RangeFilter<ConstTargetIterator>::operator fake_bool() const;
#undef TARG_CLASS
diff --git a/src/usr/targeting/common/iterators/rawtargetiterator.C b/src/usr/targeting/common/iterators/rawtargetiterator.C
new file mode 100644
index 000000000..9946a3d0f
--- /dev/null
+++ b/src/usr/targeting/common/iterators/rawtargetiterator.C
@@ -0,0 +1,91 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/targeting/common/iterators/rawtargetiterator.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/**
+ * @file targeting/common/iterators/rawtargetiterator.C
+ *
+ * @brief Implementation of raw iterator/const raw iterator used to iterate
+ * through all target service targets
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+
+// Other Host Boot Components
+
+// Targeting Component
+#include <targeting/common/iterators/iterators.H>
+#include <targeting/common/targetservice.H>
+
+//******************************************************************************
+// Macros
+//******************************************************************************
+
+#undef TARG_NAMESPACE
+#undef TARG_CLASS
+#undef TARG_FUNC
+
+//******************************************************************************
+// Implementation
+//******************************************************************************
+
+namespace TARGETING
+{
+
+#define TARG_NAMESPACE "TARGETING::"
+
+#define TARG_CLASS "_TargetRawIterator<T>::"
+
+//******************************************************************************
+// TargetIterator::advance
+//******************************************************************************
+
+template<typename T>
+void _TargetRawIterator<T>::advance()
+{
+ static TargetService& l_targetService = targetService();
+
+ // If cursor points to end()/NULL, do nothing. Otherwise, check to see if
+ // it should advance (possibly to NULL)
+ if(iv_pCurrent != NULL)
+ {
+ iv_pCurrent = l_targetService.getNextTarget(iv_pCurrent);
+ }
+}
+
+//******************************************************************************
+// Explicit template class member function instantiations
+//******************************************************************************
+
+template void _TargetRawIterator<Target*>::advance();
+template void _TargetRawIterator<const Target*>::advance();
+
+#undef TARG_CLASS
+
+#undef TARG_NAMESPACE
+
+} // End namespace TARGETING
+
diff --git a/src/usr/targeting/common/iterators/targetiterator.C b/src/usr/targeting/common/iterators/targetiterator.C
index 76b687641..ff73641ea 100644
--- a/src/usr/targeting/common/iterators/targetiterator.C
+++ b/src/usr/targeting/common/iterators/targetiterator.C
@@ -1,31 +1,31 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/targeting/iterators/targetiterator.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/targeting/common/iterators/targetiterator.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
/**
* @file targeting/common/iterators/targetiterator.C
*
* @brief Implementation of iterator/const iterator used to iterate through
- * target service targets
+ * target service targets
*/
//******************************************************************************
@@ -66,30 +66,55 @@ namespace TARGETING
template<typename T>
void _TargetIterator<T>::advance()
{
- TargetService& l_targetService = targetService();
+ static TargetService& l_targetService = targetService();
- // If cursor points to end()/NULL, do nothing. Otherwise, check to see if
+ // If cursor points to end()/NULL, do nothing. Otherwise, check to see if
// it should advance (possibly to NULL)
- if(iv_pCurrent != NULL)
+ if(likely (iv_pCurrent != NULL) )
{
- // Advance to end() if no targets available. Otherwise, check to see if
- // it should advance (possibly to NULL)
- if (l_targetService.iv_maxTargets > 0)
+ // In HB the first block will always compile to run and take the optimal
+ // iterator performance path that assumes only one node's worth of data
+ if(!PLAT::PROPERTIES::MULTINODE_AWARE)
{
- // If at or past last element, advance to end() else advance
- if(iv_pCurrent >=
- &(*l_targetService.iv_targets)[l_targetService.iv_maxTargets-1])
+ if ( likely( (!l_targetService.iv_nodeInfo.empty()) )
+ && likely( (l_targetService.iv_nodeInfo[0].maxTargets > 0) ) )
{
- iv_pCurrent = NULL;
+ // If at or past last element, advance to end() else advance
+ if(unlikely (
+ iv_pCurrent >=
+ &(*(l_targetService.iv_nodeInfo[0]).targets)
+ [l_targetService.iv_nodeInfo[0].maxTargets-1]
+ ))
+ {
+ iv_pCurrent = NULL;
+ }
+ else
+ {
+ iv_pCurrent++;
+ }
}
else
{
- iv_pCurrent++;
+ iv_pCurrent = NULL;
}
+
}
else
{
- iv_pCurrent = NULL;
+ iv_pCurrent = l_targetService.getNextTarget(iv_pCurrent);
+ if(likely(iv_pCurrent != NULL))
+ {
+ // Targeting XML and compiler ensure that there are no back to
+ // back hidden system targets; therefore, if the current one is
+ // a hidden system target, skip it and the next one will either
+ // be valid or NULL (i.e. end())
+ if(unlikely(
+ l_targetService.isNonMasterNodeSystemTarget(iv_pCurrent)))
+ {
+ iv_pCurrent = l_targetService.getNextTarget(iv_pCurrent);
+ }
+ }
+
}
}
}
OpenPOWER on IntegriCloud