From a8e490184f0f436d8fa1e175c7f9d7368923340b Mon Sep 17 00:00:00 2001 From: Bill Hoffa Date: Thu, 27 Mar 2014 10:16:15 -0500 Subject: Only accept Istep Messages to Master Node after system SMP established Change-Id: I993a9684b4ee93541b75b4bfc22f22ddad5bedb5 RTC:93394 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/10012 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/include/usr/initservice/initsvcreasoncodes.H | 1 + src/include/usr/initservice/istepdispatcherif.H | 11 ++++ .../establish_system_smp/establish_system_smp.C | 30 ++++++++++- .../initservice/istepdispatcher/istepdispatcher.C | 60 +++++++++++++++++----- .../initservice/istepdispatcher/istepdispatcher.H | 6 +++ 5 files changed, 94 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 23430d927..e30c8fd2b 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -67,6 +67,7 @@ enum InitServiceReasonCode //termination_rc SHUTDOWN_REQUESTED_BY_FSP = INITSVC_COMP_ID | 0x0b, ISTEP_INVALID_ON_MPIPL = INITSVC_COMP_ID | 0x0c, + ISTEP_NON_MASTER_NODE_MSG = INITSVC_COMP_ID | 0x0d, }; enum InitServiceUserDetailDataSubSection diff --git a/src/include/usr/initservice/istepdispatcherif.H b/src/include/usr/initservice/istepdispatcherif.H index 5572ca8f7..e8ba59596 100644 --- a/src/include/usr/initservice/istepdispatcherif.H +++ b/src/include/usr/initservice/istepdispatcherif.H @@ -66,6 +66,17 @@ errlHndl_t sendIstepCompleteMsg ( void ); */ bool isShutdownRequested ( void ); +/** + * @brief This function is to be used by external code to tell + * this instance of istepdispatcher whether it should + * accept istep messages or not + * + * @param[in] i_accept - true if istep messages are to be accepted, false if not + * + * @return Nothing + */ +void setAcceptIstepMessages ( bool i_accept ); + } #endif diff --git a/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C b/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C index e22e76a96..912ababed 100644 --- a/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C +++ b/src/usr/hwpf/hwp/establish_system_smp/establish_system_smp.C @@ -71,6 +71,7 @@ // #include "host_coalesce_host/host_coalesce_host.H" #include "p8_block_wakeup_intr/p8_block_wakeup_intr.H" #include "p8_cpu_special_wakeup.H" +#include namespace ESTABLISH_SYSTEM_SMP { @@ -212,12 +213,11 @@ errlHndl_t call_host_coalesce_host( ) const INTR::PIR_t masterCpu = task_getcpuid(); uint64_t this_node = masterCpu.nodeId; - //loop though all possible drawers whether they exist or not // An invalid or non-existant logical node number in that drawer // indicates that the drawer does not exist. - TARGETING::ATTR_HB_EXISTING_IMAGE_type mask = 0x0; + TARGETING::ATTR_HB_EXISTING_IMAGE_type master_node_mask = 0x0; for(uint16_t drawer = 0; drawer < NUMBER_OF_POSSIBLE_NODES; ++drawer) { @@ -235,6 +235,12 @@ errlHndl_t call_host_coalesce_host( ) mask,hb_existing_image); if( 0 != ((mask >> node) & hb_existing_image ) ) { + //The first nonzero bit in hb_existing_image represents the + // master node, set mask for later comparison + if (master_node_mask == 0) + { + master_node_mask = mask; + } TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "send coalese host message to drawer %d", drawer ); @@ -259,6 +265,26 @@ errlHndl_t call_host_coalesce_host( ) //the other nodes if(l_errl == NULL) { + // reset mask to msb + mask = 0x1 << (NUMBER_OF_POSSIBLE_NODES -1); + //create mask to apply to hb_existing_image for this particular node + mask = mask >> this_node; + + if (master_node_mask & (hb_existing_image & mask)) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Master Node detected, continue allowing " + "istep messages to this node."); + INITSERVICE::setAcceptIstepMessages(true); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "This node is not the master node, no longer " + "respond to istep messages."); + INITSERVICE::setAcceptIstepMessages(false); + } + //wait for all hb images to respond //want to spawn a timer thread tid_t l_progTid = task_create( diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index 7c9966351..b60d66458 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -101,7 +101,8 @@ IStepDispatcher::IStepDispatcher() : iv_shutdown(false), iv_futureShutdown(false), iv_istepToCompleteBeforeShutdown(0), - iv_substepToCompleteBeforeShutdown(0) + iv_substepToCompleteBeforeShutdown(0), + iv_acceptIstepMessages(true) { mutex_init(&iv_bkPtMutex); @@ -826,14 +827,7 @@ void IStepDispatcher::msgHndlr() break; case ISTEP_MSG_TYPE: TRACFCOMP(g_trac_initsvc, INFO_MRK"msgHndlr: ISTEP_MSG_TYPE"); - if (iv_istepMode) - { - handleIStepRequestMsg(pMsg); - } - else - { - TRACFCOMP(g_trac_initsvc, ERR_MRK"msgHndlr: Ignoring IStep msg in non-IStep mode!"); - } + handleIStepRequestMsg(pMsg); break; case COALESCE_HOST: TRACFCOMP(g_trac_initsvc, INFO_MRK"msgHndlr: COALESCE_HOST"); @@ -1210,8 +1204,6 @@ bool IStepDispatcher::isShutdownRequested() return isShutdownRequested; } - - // ---------------------------------------------------------------------------- // IStepDispatcher::isFutureShutdownRequested() // ---------------------------------------------------------------------------- @@ -1257,6 +1249,23 @@ bool IStepDispatcher::isFutureShutdownRequested() return isFutureShutdownRequested; } +// ---------------------------------------------------------------------------- +// IStepDispatcher::acceptIstepMessages() +// ---------------------------------------------------------------------------- +void IStepDispatcher::setAcceptIstepMessages(bool i_accept) +{ + TRACDCOMP(g_trac_initsvc, + ENTER_MRK"IStepDispatcher::setAcceptIstepMessages"); + + mutex_lock(&iv_mutex); + iv_acceptIstepMessages = i_accept; + mutex_unlock(&iv_mutex); + + TRACDCOMP(g_trac_initsvc, + EXIT_MRK"IStepDispatcher::setAcceptIstepMessages"); + return; +} + // ---------------------------------------------------------------------------- // IStepDispatcher::handleIStepRequestMsg() // ---------------------------------------------------------------------------- @@ -1264,6 +1273,7 @@ void IStepDispatcher::handleIStepRequestMsg(msg_t * & io_pMsg) { errlHndl_t err = NULL; bool l_doReconfig = false; + bool l_acceptMessages = false; // find the step/substep. The step is in the top 32bits, the substep is in // the bottom 32bits and is a byte @@ -1281,9 +1291,31 @@ void IStepDispatcher::handleIStepRequestMsg(msg_t * & io_pMsg) iv_curSubStep = substep; iv_pIstepMsg = io_pMsg; io_pMsg = NULL; + l_acceptMessages = iv_acceptIstepMessages; mutex_unlock(&iv_mutex); - err = doIstep (istep, substep, l_doReconfig); + if (l_acceptMessages) + { + err = doIstep (istep, substep, l_doReconfig); + } + else + { + /*@ + * @errortype + * @reasoncode ISTEP_NON_MASTER_NODE_MSG + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid ISTEP_INITSVC_MOD_ID + * @userdata1 Istep Requested + * @userdata2 Substep Requested + * @devdesc Istep messaged received by non-master node. + */ + err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + ISTEP_INITSVC_MOD_ID, + ISTEP_NON_MASTER_NODE_MSG, + iv_curIStep, + iv_curSubStep); + } // If there was no IStep error, but something happened that requires a // reconfigure @@ -1690,6 +1722,10 @@ bool isShutdownRequested() return IStepDispatcher::getTheInstance().isShutdownRequested(); } +void setAcceptIstepMessages(bool i_accept) +{ + return IStepDispatcher::getTheInstance().setAcceptIstepMessages(i_accept); +} // ---------------------------------------------------------------------------- // IStepDispatcher::getIstepInfo() // ---------------------------------------------------------------------------- diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H index be0a3ff36..5996cbdc6 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.H +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H @@ -176,6 +176,8 @@ public: */ bool isFutureShutdownRequested(); + void setAcceptIstepMessages(bool accept); + protected: /** @@ -390,6 +392,10 @@ private: uint8_t iv_istepToCompleteBeforeShutdown; uint8_t iv_substepToCompleteBeforeShutdown; + // Instance variable stating whether this istepdispatcher instance should + // accept istep messages or not + bool iv_acceptIstepMessages; + // Message Queue for receiving message from SP or SPless user console msg_q_t iv_msgQ; }; -- cgit v1.2.1