diff options
author | Andrew Jeffery <andrewrj@au1.ibm.com> | 2018-10-04 15:03:12 +0930 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-10-09 10:07:42 -0500 |
commit | d6741cb3db68795586a21fc812806836135341ec (patch) | |
tree | 192f8ffbda04b3f9295132738f515bf81126a763 /src | |
parent | 3b5764defdff5c0f4ca7628804983d7a2c86900e (diff) | |
download | talos-hostboot-d6741cb3db68795586a21fc812806836135341ec.tar.gz talos-hostboot-d6741cb3db68795586a21fc812806836135341ec.zip |
ipmi: Terminate SEL task via shutdown event
The IpmiSEL task will become part of the extended image once the IPMI
module is split in two. Once split, if we need to handle an early shutdown
we cannot be referencing code from HBI in HBB. To that end, ensure we
don't instantiate an IpmiSEL via Singleton in an attempt to shutdown its
event loop when it hasn't been loaded, let alone started. Instead, have
IpmiSEL register itself in the shutdown handler, and shut down the SEL
task before IpmiRP.
Change-Id: I358f6cb1f5528a4ad72c93477ad883cad19e2bf6
Signed-off-by: Andrew Jeffery <andrewrj@au1.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67076
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: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/initservice/initserviceif.H | 8 | ||||
-rw-r--r-- | src/include/usr/ipmi/ipmiif.H | 3 | ||||
-rw-r--r-- | src/usr/ipmi/ipmirp.C | 28 | ||||
-rw-r--r-- | src/usr/ipmi/ipmisel.C | 16 |
4 files changed, 15 insertions, 40 deletions
diff --git a/src/include/usr/initservice/initserviceif.H b/src/include/usr/initservice/initserviceif.H index 3e6d0bd4a..87ca8cdb0 100644 --- a/src/include/usr/initservice/initserviceif.H +++ b/src/include/usr/initservice/initserviceif.H @@ -61,16 +61,16 @@ namespace INITSERVICE NOTIFY_FIRST = 0, HIGHEST_PRIORITY = NOTIFY_FIRST, NO_PRIORITY = 16, - MBOX_PRIORITY = 17, - INTR_PRIORITY = 18, - PRESHUTDOWN_INIT_PRIORITY = 19, + IPMI_SEL_PRIORITY = 17, + MBOX_PRIORITY = 18, + INTR_PRIORITY = 19, + PRESHUTDOWN_INIT_PRIORITY = 20, LOWEST_PRIORITY = 127, CONSOLE_PRIORITY = LOWEST_PRIORITY, LAST_PRE_MEM_FLUSH_PRIORITY = LOWEST_PRIORITY, HIGHEST_POST_MEM_FLUSH_PRIORITY = 128, // 1st post mem flush callback PNOR_RP_PRIORITY = HIGHEST_POST_MEM_FLUSH_PRIORITY, POST_MEM_FLUSH_NOTIFY_LAST = 255 - }; /** diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H index f33c0b278..1a2296b04 100644 --- a/src/include/usr/ipmi/ipmiif.H +++ b/src/include/usr/ipmi/ipmiif.H @@ -51,8 +51,6 @@ namespace IPMI MSG_STATE_SHUTDOWN, - MSG_STATE_SHUTDOWN_SEL, - MSG_STATE_GRACEFUL_SHUTDOWN, // initiate a reboot request @@ -74,7 +72,6 @@ namespace IPMI inline bool validShutdownRebootMsgType(const msg_type i_msgType) { return ( (i_msgType == MSG_STATE_SHUTDOWN) - || (i_msgType == MSG_STATE_SHUTDOWN_SEL) || (i_msgType == MSG_STATE_GRACEFUL_SHUTDOWN) || (i_msgType == MSG_STATE_INITIATE_POWER_CYCLE)); } diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C index 3dec6f271..c183d01e1 100644 --- a/src/usr/ipmi/ipmirp.C +++ b/src/usr/ipmi/ipmirp.C @@ -666,36 +666,10 @@ void IpmiRP::execute(void) // we wait for the reply from the BMC. case IPMI::MSG_STATE_SHUTDOWN: { - // Poke the IPMI sel task to flush out any messages. - // This must be done before we shut down the device driver. - IPMI_TRAC(INFO_MRK "Sending shutdown to sel task"); - Singleton<IpmiSEL>::instance(); - msg_t *rmsg = msg_allocate(); - rmsg->type = IPMISEL::MSG_STATE_SHUTDOWN_SEL; - msg_q_t mq = Singleton<IpmiSEL>::instance().msgQueue(); - - //Send the msg to the sel thread - int rc = msg_sendrecv_noblk(mq,rmsg,iv_msgQ); - if(rc) - { - IPMI_TRAC(ERR_MRK "Failed (rc=%d) to send ipmiSEL flush " - "message. We may have lost a sel.",rc); - } - - iv_shutdown_msg = msg; // Reply to this message - break; - } - - case IPMI::MSG_STATE_SHUTDOWN_SEL: - { - // The sel thread has responsed to us, so it must be flushed. - // We can now shutdown - IPMI_TRAC(INFO_MRK "MSG_SHUTDOWN_FROM_SEL: " - "ipmi begin shutdown"); l_shutdown_pending = true; // Stop incoming new messages + iv_shutdown_msg = msg; // Reply to this message break; } - case IPMI::MSG_STATE_GRACEFUL_SHUTDOWN: { IPMI_TRAC(INFO_MRK "MSG_STATE_GRACEFUL_SHUTDOWN: send power" diff --git a/src/usr/ipmi/ipmisel.C b/src/usr/ipmi/ipmisel.C index c749c4250..6b7618fd9 100644 --- a/src/usr/ipmi/ipmisel.C +++ b/src/usr/ipmi/ipmisel.C @@ -548,7 +548,12 @@ void IpmiSEL::execute(void) //Mark as an independent daemon so if it crashes we terminate. task_detach(); - while(true) + INITSERVICE::registerShutdownEvent(IPMI_COMP_ID, iv_msgQ, + IPMISEL::MSG_STATE_SHUTDOWN_SEL, + INITSERVICE::IPMI_SEL_PRIORITY); + bool l_terminate = false; + + while(!l_terminate) { msg_t* msg = msg_wait(iv_msgQ); @@ -571,20 +576,19 @@ void IpmiSEL::execute(void) case IPMISEL::MSG_STATE_SHUTDOWN: IPMI_TRAC(INFO_MRK "ipmisel shutdown event"); + l_terminate = true; //Respond that we are done shutting down. msg_respond(iv_msgQ, msg); break; case IPMISEL::MSG_STATE_SHUTDOWN_SEL: - IPMI_TRAC(INFO_MRK "ipmisel " - "shutdown message from ipmirp"); - msg->type = IPMI::MSG_STATE_SHUTDOWN_SEL; - //Respond that we are done shutting down. + IPMI_TRAC(INFO_MRK "ipmisel shutdown message from initservice"); + l_terminate = true; msg_respond(iv_msgQ, msg); break; } - } // while(1) + } IPMI_TRAC(EXIT_MRK "message loop"); return; } // execute |