diff options
| author | Andrew Jeffery <andrewrj@au1.ibm.com> | 2018-10-05 12:59:29 +0930 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-10-10 13:38:21 -0500 |
| commit | 1b481183921d9877a5693219249bb9c4cd8ccf69 (patch) | |
| tree | 85b5197eeece8bbb7b75a55c476f76bdf63e8e17 /src/usr/ipmi | |
| parent | e9ade5b4dbf715290726d24631e445ffd929c749 (diff) | |
| download | talos-hostboot-1b481183921d9877a5693219249bb9c4cd8ccf69.tar.gz talos-hostboot-1b481183921d9877a5693219249bb9c4cd8ccf69.zip | |
ipmi: IpmiDD and IpmiRP must never free resources
An IPMI-based PNOR implementation will be introduced in the future. If
it is in use (and it likely will be), then IpmiDD and IpmiRP must be
functional right up until the shutdown() syscall is invoked. This is
necessary because hostboot assumes parts of the PNOR can be paged in at
any time (though not necessarily dirtied and flushed), and IPMI is now
required to fulfil the requests.
Remove the unnecessary shutdown-related code from both classes.
Change-Id: I82276e5e12c8b917d655000a456b72a2ccacdb5f
Signed-off-by: Andrew Jeffery <andrewrj@au1.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67077
Tested-by: Jenkins Server <pfd-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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
| -rw-r--r-- | src/usr/ipmi/ipmidd.C | 22 | ||||
| -rw-r--r-- | src/usr/ipmi/ipmidd.H | 10 | ||||
| -rw-r--r-- | src/usr/ipmi/ipmirp.C | 61 | ||||
| -rw-r--r-- | src/usr/ipmi/ipmirp.H | 7 |
4 files changed, 10 insertions, 90 deletions
diff --git a/src/usr/ipmi/ipmidd.C b/src/usr/ipmi/ipmidd.C index da3130cbf..3462c1a8a 100644 --- a/src/usr/ipmi/ipmidd.C +++ b/src/usr/ipmi/ipmidd.C @@ -222,12 +222,6 @@ void IpmiDD::pollCtrl(void) msg_send(iv_eventQ, msg); iv_eagains = false; } - // Check on shutdown if idle - else if (iv_shutdown_now) - { - mutex_unlock(&iv_mutex); - break; // exit loop and terminate task - } } // If we see the B2H_ATN, there's a response waiting else if (ctrl & CTRL_B2H_ATN) @@ -426,25 +420,9 @@ errlHndl_t IpmiDD::receive(IPMI::BTMessage* o_msg) } /** - * @brief shutdown the device driver - */ -void IpmiDD::handleShutdown(void) -{ - IPMI_TRAC(ENTER_MRK "handle Shutdown" ); - mutex_lock(&iv_mutex); - iv_shutdown_now = true; // signal poll controller to terminate - - // TODO: RTC 116600 mask interrupts - - mutex_unlock(&iv_mutex); - IPMI_TRAC(EXIT_MRK "handle Shutdown" ); -} - -/** * @brief Constructor */ IpmiDD::IpmiDD(void): - iv_shutdown_now(false), iv_eagains(false), iv_eventQ(msg_q_create()) { diff --git a/src/usr/ipmi/ipmidd.H b/src/usr/ipmi/ipmidd.H index ef6ed814f..a9b8ada8c 100644 --- a/src/usr/ipmi/ipmidd.H +++ b/src/usr/ipmi/ipmidd.H @@ -107,11 +107,6 @@ class IpmiDD errlHndl_t reset(void); /** - * @brief shutdown the device driver - */ - void handleShutdown(void); - - /** * @brief Get the queue on which IpmiDD publishes hardware events * * The events on the queue are consumed by IpmiRP. This "publish" approach @@ -156,11 +151,6 @@ class IpmiDD mutex_t iv_mutex; /** - * @brief Shut down resources - */ - bool iv_shutdown_now; - - /** * @brief True if we told the RP to try a write again */ bool iv_eagains; diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C index c183d01e1..8afff0136 100644 --- a/src/usr/ipmi/ipmirp.C +++ b/src/usr/ipmi/ipmirp.C @@ -78,7 +78,6 @@ IpmiRP::IpmiRP(void): iv_recv_buffer_size(IPMI::g_recv_buffer_size), iv_retries(IPMI::g_retries), iv_shutdown_msg(NULL), - iv_shutdown_now(false), iv_graceful_shutdown_pending(false), iv_chassis_power_mod(IPMI::CHASSIS_POWER_OFF) { @@ -180,17 +179,11 @@ void IpmiRP::timeoutThread(void) while (true) { mutex_lock(&iv_mutex); - while ((iv_timeoutq.size() == 0) && !iv_shutdown_now) + while ((iv_timeoutq.size() == 0)) { sync_cond_wait(&iv_cv, &iv_mutex); } - // shutting down... - if (iv_shutdown_now) - { - break; // return and terminate thread - } - msg_t*& msq_msg = iv_timeoutq.front(); IPMI::Message* msg = static_cast<IPMI::Message*>(msq_msg->extra_data); @@ -554,7 +547,8 @@ void IpmiRP::attach(void) msg_q_t mq = Singleton<IpmiDD>::instance().eventQueue(); - while (!iv_shutdown_now) + /* FIXME: Never shut down */ + while (1) { /* Forward it into the internal message queue */ msg_send(iv_msgQ, msg_wait(mq)); @@ -741,24 +735,15 @@ void IpmiRP::execute(void) } // Once quiesced, reply to shutdown msg and exit. - // For IPMI based systems if we received the soft power off (graceful - // shutdown) request then we have more processing to do, so respond - // to the first shutdown message and instead of exiting we go back - // and wait for the post memory flush shutdown message then send a - // power off command to the BMC + // Shutdown simply puts us in a state we deny all further requests bar + // those from PnorIpmiDD. Access to the PNOR must be provided right up + // until we call the shutdown syscall, so there's no point at which we + // can deallocate the resources consumed by IpmiRP, IpmiDD or + // PnorIpmiDD. if (l_shutdown_pending && iv_respondq.empty() && iv_sendq.empty()) { - if(iv_graceful_shutdown_pending) - { - - IPMI_TRAC(INFO_MRK "reply to the MSG_STATE_SHUTDOWN message"); - msg_respond(iv_msgQ, iv_shutdown_msg); - } - else - { - shutdownNow(); - break; // exit loop and terminate task - } + IPMI_TRAC(INFO_MRK "reply to the MSG_STATE_SHUTDOWN message"); + msg_respond(iv_msgQ, iv_shutdown_msg); } } @@ -946,32 +931,6 @@ void IpmiRP::queueForResponse(IPMI::Message& i_msg) return; } -/// -/// @brief handle shutdown. -/// Queued messages to send have been sent and all responses complete. -/// Now that we are quiesced, deallocate resources and respond to the -/// shutdown message -/// -void IpmiRP::shutdownNow(void) -{ - IPMI_TRAC(INFO_MRK "IpmiRP::shutdownNow() "); - - mutex_lock(&iv_mutex); - iv_shutdown_now = true; // Shutdown underway - - // Wake up Time out thread to terminate. - sync_cond_signal(&iv_cv); - mutex_unlock(&iv_mutex); - - // TODO: RTC 116600 unRegisterMsgQ for interrupts - - // Shut down device driver - Singleton<IpmiDD>::instance().handleShutdown(); - - // reply back to shutdown requester that we are shutdown - msg_respond(iv_msgQ, iv_shutdown_msg); -} - namespace IPMI { /// diff --git a/src/usr/ipmi/ipmirp.H b/src/usr/ipmi/ipmirp.H index 4bf277bff..0f9b02302 100644 --- a/src/usr/ipmi/ipmirp.H +++ b/src/usr/ipmi/ipmirp.H @@ -226,12 +226,6 @@ class IpmiRP */ void lastChanceEventHandler(void); - /** - * @brief Clean up resources and reply to shutdown msg - * @param[in] void - */ - void shutdownNow(void); - msg_q_t iv_msgQ; //!< ipmi mesage queue IPMI::send_q_t iv_sendq; //!< msg to send queue IPMI::timeout_q_t iv_timeoutq; //!< msgs waiting for a timeout @@ -261,7 +255,6 @@ class IpmiRP // Shutdown msg_t * iv_shutdown_msg; //!< shutdown msg to respond to - bool iv_shutdown_now; //!< shutdown now //!< handle ipmi chassis power off request bool iv_graceful_shutdown_pending; |

