Skip to content

Commit

Permalink
Allow stopIPL to be called before istepdispatcher is loaded
Browse files Browse the repository at this point in the history
Hostboot was crashing because a graceful shutdown was requested
before libistepdisp.so loaded.

Change-Id: Id9206961bcbb72094ff359f26db720b92480f5fb
CQ: SW445973
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68110
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>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Nov 2, 2018
1 parent 25102e0 commit 1e21ee6
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 43 deletions.
20 changes: 19 additions & 1 deletion src/include/usr/initservice/initserviceif.H
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ inline bool spBaseServicesEnabled()
*
* If true then we are running in wrap config
*
* @return bool - true if wrap config, else false
* @return bool - true if wrap config, else false
*/
inline bool isSMPWrapConfig()
{
Expand Down Expand Up @@ -216,6 +216,24 @@ void ShadowIstepData( uint8_t i_step,
void GetIstepData( uint8_t & o_step,
uint8_t & o_subStep );

/**
* @brief This function is to be used by external code to tell
* istepdispatcher to stop executing isteps
*
* Note:
* Located here so external code can call before
* istepdispatcher code is loaded
*
* @return Nothing
*/
void stopIpl( void );

/**
* @brief Return if istepdispatcher needs to stop executing isteps
* @return true if IPL stopped
*/
bool isIplStopped();

}


Expand Down
7 changes: 0 additions & 7 deletions src/include/usr/initservice/istepdispatcherif.H
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ errlHndl_t sendAttnMonitorChipIdMsg(
*/
bool isShutdownRequested ( void );

/**
* @brief This function is to be used by external code to tell
* this instance of istepdispatcher to stop executing steps
*
* @return Nothing
*/
void stopIpl( void );

#ifdef CONFIG_BMC_IPMI
/**
Expand Down
24 changes: 24 additions & 0 deletions src/usr/initservice/baseinitsvc/initservice.C
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ InitService& InitService::getTheInstance( )

InitService::InitService( ) :
iv_shutdownInProgress(false),
iv_stopIPL(false),
iv_worst_status(false),
iv_iStep( 0 ),
iv_iSubStep( 0 )
Expand Down Expand Up @@ -718,6 +719,29 @@ bool InitService::_setShutdownStatus(
return first;
}

// External call to stop the IPL
void stopIpl()
{
// Set the flag to disable istep dispatcher
Singleton<InitService>::instance().stopIpl();
}

void InitService::stopIpl()
{
iv_stopIPL = true;
}

// External call to grab the stopIpl status
bool isIplStopped()
{
return Singleton<InitService>::instance().isIplStopped();
}

bool InitService::isIplStopped()
{
return iv_stopIPL;
}

void doShutdown(uint64_t i_status,
bool i_inBackground,
uint64_t i_payload_base,
Expand Down
19 changes: 19 additions & 0 deletions src/usr/initservice/baseinitsvc/initservice.H
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,23 @@ public:
uint64_t i_masterHBInstance = THIS_NODE_NO_PAYLOAD,
uint32_t i_error_info = 0);

/**
* @brief Set flag to stop the execution of IPL isteps
*
* @note: See the API documentation @
* src/include/usr/initservice/initserviceif.H
*/
void stopIpl();

/**
* @brief Check if the execution of isteps should stop
* @return true = IPL's istep execution is stopped
*
* @note: See the API documentation @
* src/include/usr/initservice/initserviceif.H
*/
bool isIplStopped();

protected:

/**
Expand Down Expand Up @@ -323,6 +340,7 @@ private:
uint64_t i_masterHBInstance = 0xffffffffffffffffull,
uint32_t i_error_info = 0);


/**
* Check and load module associated with this task or function
* if necessary.
Expand Down Expand Up @@ -367,6 +385,7 @@ private:

mutex_t iv_registryMutex;
bool iv_shutdownInProgress;
bool iv_stopIPL; // flag states if istep execution is stopped

// Worst shutdown status accumulated during shutdown processing
uint64_t iv_worst_status;
Expand Down
30 changes: 6 additions & 24 deletions src/usr/initservice/istepdispatcher/istepdispatcher.C
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ IStepDispatcher::IStepDispatcher() :
iv_substepToCompleteBeforeShutdown(0),
iv_acceptIstepMessages(true),
iv_newGardRecord(false),
iv_stopIpl(false),
iv_p9_phbPerstLibLoaded(false)

{
Expand Down Expand Up @@ -497,7 +496,7 @@ errlHndl_t IStepDispatcher::executeAllISteps()
substep = 0;
while (substep < g_isteps[istep].numitems)
{
if( iv_stopIpl == true )
if( INITSERVICE::isIplStopped() == true )
{
#ifdef CONFIG_BMC_IPMI
// if we came in here and we are connected to a BMC, then
Expand Down Expand Up @@ -761,7 +760,7 @@ errlHndl_t IStepDispatcher::executeAllISteps()
ERRORLOG::ErrlManager::callFlushErrorLogs();

// Quiesce new isteps, including external requests
(void)setStopIpl();
INITSERVICE::stopIpl();

#ifdef CONFIG_HANG_ON_MFG_SRC_TERM
// Stop the IPL
Expand Down Expand Up @@ -1787,7 +1786,7 @@ void IStepDispatcher::handleShutdownMsg(msg_t * & io_pMsg)
void IStepDispatcher::requestReboot()
{
// Always stop dispatching isteps before calling for the reboot
(void)setStopIpl();
INITSERVICE::stopIpl();

// Send a reboot message to the BMC
(void)IPMI::initiateReboot();
Expand All @@ -1796,7 +1795,7 @@ void IStepDispatcher::requestReboot()
void IStepDispatcher::requestPowerOff()
{
// Always stop dispatching isteps before calling for the power off
(void)setStopIpl();
INITSERVICE::stopIpl();

// Send a power off message to the BMC
(void)IPMI::initiatePowerOff();
Expand Down Expand Up @@ -1855,20 +1854,7 @@ void IStepDispatcher::shutdownDuringIpl()
}

}
// -----------------------------------------------------------------------------
// IStepDispatcher::setStopIpl()
// -----------------------------------------------------------------------------
void IStepDispatcher::setStopIpl()
{
TRACDCOMP(g_trac_initsvc, ENTER_MRK"IStepDispatcher::setStopIpl");

mutex_lock(&iv_mutex);
iv_stopIpl = true;
mutex_unlock(&iv_mutex);

TRACDCOMP(g_trac_initsvc, EXIT_MRK"IStepDispatcher::setStopIpl");
return;
}

// ----------------------------------------------------------------------------
// IStepDispatcher::iStepBreakPoint()
Expand Down Expand Up @@ -2035,7 +2021,7 @@ void IStepDispatcher::handleIStepRequestMsg(msg_t * & io_pMsg)
mutex_unlock(&iv_mutex);

// If istep dispatching has ceased, prevent new isteps from executing
if(iv_stopIpl == true)
if(INITSERVICE::isIplStopped() == true)
{
/*@
* @errortype
Expand Down Expand Up @@ -2718,11 +2704,7 @@ void requestPowerOff()
IStepDispatcher::getTheInstance().requestPowerOff();
}
#endif
void stopIpl()
{
// Disable the istep dispatcher
return IStepDispatcher::getTheInstance().setStopIpl();
}


// ----------------------------------------------------------------------------
// IStepDispatcher::getIstepInfo()
Expand Down
10 changes: 0 additions & 10 deletions src/usr/initservice/istepdispatcher/istepdispatcher.H
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ public:
*/
void setNewGardRecord();

/**
* @brief This function will set a boolean true which tells the istep
* dispacher to stop executing steps
*/
void setStopIpl();

/**
* @brief This function will stop the istep dispacher from continuing to
* execute steps
Expand Down Expand Up @@ -492,10 +486,6 @@ private:
// Instance variable to state if a new gard record was committed
bool iv_newGardRecord;

// Instance variable to state if a power off is in progress and
// the istep dispatcher should stop executing steps
bool iv_stopIpl;

// Instance variable to state if the PHB Perst libraries are loaded
bool iv_p9_phbPerstLibLoaded;

Expand Down
2 changes: 1 addition & 1 deletion src/usr/ipmiext/ipmichassiscontrol.C
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <errl/errlentry.H>
#include <ipmi/ipmichassiscontrol.H>
#include <ipmi/ipmiif.H>
#include <initservice/istepdispatcherif.H>
#include <initservice/initserviceif.H>

/******************************************************************************/
// Globals/Constants
Expand Down

0 comments on commit 1e21ee6

Please sign in to comment.