From 6340a95a7e95dc55fc947ecaaabb9b60b88a2915 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Fri, 12 Apr 2013 10:19:28 -0500 Subject: MDIA: Avoid starting commands on same Centaur RTC: 38370 Change-Id: I55fb7d9046e54fbcc31dab595bc597724a9a09d4 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4050 Tested-by: Jenkins Server Reviewed-by: Zane Shelley Reviewed-by: Christopher T. Phan Reviewed-by: Brian H. Horton Reviewed-by: A. Patrick Williams III --- src/usr/diag/mdia/mdiasm.C | 8 ++- src/usr/diag/mdia/mdiasmimpl.H | 5 ++ src/usr/diag/mdia/mdiaworkitem.C | 60 ++++++++++-------- src/usr/diag/mdia/mdiaworkitem.H | 57 ++++++++++------- src/usr/diag/mdia/test/mdiatestsm.H | 12 ++-- src/usr/diag/mdia/test/mdiatestworkitem.H | 102 +++++++++++++++++++++++------- 6 files changed, 165 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/usr/diag/mdia/mdiasm.C b/src/usr/diag/mdia/mdiasm.C index 138887cea..e664b8b63 100644 --- a/src/usr/diag/mdia/mdiasm.C +++ b/src/usr/diag/mdia/mdiasm.C @@ -224,6 +224,7 @@ void StateMachine::setup(const WorkFlowAssocMap & i_list) p->restartCommand = false; p->memSize = 0; // TODO p->data = NULL; + p->chipUnit = it->first->getAttr(); iv_workFlowProperties.push_back(p); } @@ -331,10 +332,11 @@ bool StateMachine::scheduleWorkItem(WorkFlowProperties & i_wfp) iv_tp->start(); } - MDIA_FAST("sm: dispatching work item %d for: %p, priority: %d", - *i_wfp.workItem, getTarget(i_wfp), priority); + MDIA_FAST("sm: dispatching work item %d for: %p, priority: %d, " + "unit: %d", *i_wfp.workItem, getTarget(i_wfp), priority, + i_wfp.chipUnit); - iv_tp->insert(new WorkItem(*this, &i_wfp, priority)); + iv_tp->insert(new WorkItem(*this, &i_wfp, priority, i_wfp.chipUnit)); return true; } diff --git a/src/usr/diag/mdia/mdiasmimpl.H b/src/usr/diag/mdia/mdiasmimpl.H index 5ebd672c6..d91c14d58 100644 --- a/src/usr/diag/mdia/mdiasmimpl.H +++ b/src/usr/diag/mdia/mdiasmimpl.H @@ -81,6 +81,11 @@ struct WorkFlowProperties * @brief pointer to single work item scoped data */ void * data; + + /** + * @brief mba position on membuf (0/1) + */ + uint8_t chipUnit; }; /** diff --git a/src/usr/diag/mdia/mdiaworkitem.C b/src/usr/diag/mdia/mdiaworkitem.C index 2f6f8207e..410d322f1 100644 --- a/src/usr/diag/mdia/mdiaworkitem.C +++ b/src/usr/diag/mdia/mdiaworkitem.C @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/diag/mdia/mdiaworkitem.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// 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/diag/mdia/mdiaworkitem.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,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 mdiaworkitem.C * @brief threadpool workitem implementation @@ -55,17 +55,27 @@ int64_t WorkItem::compare(const WorkItem & i_r) const // if the state machine computed priority is the same, // give higher priority to mbas on different dmi busses - // TODO + if(iv_chipUnit < i_r.iv_chipUnit) + { + return -1; + } + + if(i_r.iv_chipUnit < iv_chipUnit) + { + return 1; + } return 0; } WorkItem::WorkItem(StateMachine & i_sm, WorkFlowProperties * i_wfp, - uint64_t i_priority) : + uint64_t i_priority, + uint8_t i_chipUnit) : iv_sm(i_sm), iv_wfp(i_wfp), - iv_priority(i_priority) + iv_priority(i_priority), + iv_chipUnit(i_chipUnit) { } diff --git a/src/usr/diag/mdia/mdiaworkitem.H b/src/usr/diag/mdia/mdiaworkitem.H index a2f86ae6e..04200e01b 100644 --- a/src/usr/diag/mdia/mdiaworkitem.H +++ b/src/usr/diag/mdia/mdiaworkitem.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/diag/mdia/mdiaworkitem.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// 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/diag/mdia/mdiaworkitem.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,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 */ #ifndef __MDIA_MDIAWORKITEM_H #define __MDIA_MDIAWORKITEM_H @@ -65,9 +65,10 @@ class WorkItem * @param[in] i_sm state machine to forward call to * @param[in] i_wfp state machine state snapshot * @param[in] i_priority work item priority + * @param[in] i_chipUnit mba position (0/1) */ WorkItem(StateMachine & i_sm, WorkFlowProperties * i_wfp, - uint64_t i_priority); + uint64_t i_priority, uint8_t i_chipUnit); private: @@ -86,6 +87,11 @@ class WorkItem */ uint64_t iv_priority; + /** + * @brief the mba number on the membuf (0/1) + */ + uint8_t iv_chipUnit; + /** * @brief copy disabled */ @@ -95,6 +101,11 @@ class WorkItem * @brief assignment disabled */ WorkItem & operator=(const WorkItem &); + + /** + * @brief provide internal access to unit test + */ + friend class ::MdiaWorkItemTest; }; /** diff --git a/src/usr/diag/mdia/test/mdiatestsm.H b/src/usr/diag/mdia/test/mdiatestsm.H index f7fe5bf1a..11e675029 100644 --- a/src/usr/diag/mdia/test/mdiatestsm.H +++ b/src/usr/diag/mdia/test/mdiatestsm.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -33,6 +33,7 @@ #include "../mdiasm.H" #include "../mdiasmimpl.H" #include +#include #include "../mdiatrace.H" #include "../mdiamonitor.H" #include "../mdiafwd.H" @@ -48,11 +49,14 @@ class MdiaSmTest : public CxxTest::TestSuite void getTargets(uint64_t i_count, TARGETING::TargetHandleList & o_list) { - TARGETING::TargetHandle_t first = 0; + TargetHandleList tmp; + TARGETING::getAllChiplets(tmp, TYPE_MBA); - while(i_count-- != 0) + TargetHandleList::iterator it = tmp.end(); + + while(i_count-- != 0 && it-- != tmp.begin()) { - o_list.push_back(first + i_count); + o_list.push_back(*it); } } diff --git a/src/usr/diag/mdia/test/mdiatestworkitem.H b/src/usr/diag/mdia/test/mdiatestworkitem.H index 111cd23cc..91b4deed6 100644 --- a/src/usr/diag/mdia/test/mdiatestworkitem.H +++ b/src/usr/diag/mdia/test/mdiatestworkitem.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/diag/mdia/test/mdiatestworkitem.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// 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/diag/mdia/test/mdiatestworkitem.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,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 */ #ifndef __TEST_MDIATESTWORKITEM_H #define __TEST_MDIATESTWORKITEM_H @@ -47,8 +47,8 @@ class MdiaWorkItemTest : public CxxTest::TestSuite StateMachine s; WorkFlowProperties * notUsed = 0; - WorkItem wi1(s, notUsed, 2222), - wi2(s, notUsed, 1111); + WorkItem wi1(s, notUsed, 2222, 0), + wi2(s, notUsed, 1111, 0); if(wi2 < wi1) { @@ -60,6 +60,60 @@ class MdiaWorkItemTest : public CxxTest::TestSuite TS_FAIL("wi1 !< wi2"); } + wi1.iv_priority = 1111; + wi2.iv_priority = 1111; + wi1.iv_chipUnit = 0; + wi2.iv_chipUnit = 0; + + if(wi2 < wi1) + { + TS_FAIL("wi2 < wi1"); + } + + if(wi1 < wi2) + { + TS_FAIL("wi1 < wi2"); + } + + wi1.iv_chipUnit = 1; + wi2.iv_chipUnit = 1; + + if(wi2 < wi1) + { + TS_FAIL("wi2 < wi1"); + } + + if(wi1 < wi2) + { + TS_FAIL("wi1 < wi2"); + } + + wi1.iv_chipUnit = 0; + + if(wi2 < wi1) + { + TS_FAIL("wi2 < wi1"); + } + + if(!(wi1 < wi2)) + { + TS_FAIL("wi1 !< wi2"); + } + + wi1.iv_chipUnit = 1; + wi2.iv_chipUnit = 0; + + if(!(wi2 < wi1)) + { + TS_FAIL("wi2 !< wi1"); + } + + if(wi1 < wi2) + { + TS_FAIL("wi1 < wi2"); + } + + TS_TRACE(EXIT_MRK "testWorkItem"); } }; -- cgit v1.2.1