summaryrefslogtreecommitdiffstats
path: root/src/usr/ipmi
diff options
context:
space:
mode:
authorBen Rafanello <brafanel@us.ibm.com>2015-10-15 17:02:00 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-10-19 17:14:34 -0500
commitd4245526721344197a416c3e92072ea7628b22ac (patch)
tree3ccd6929be509124077b6d5e4777fc5302a5a3d2 /src/usr/ipmi
parent29bd2509664ce1040eb98797857d1dc76a0fa42f (diff)
downloadblackbird-hostboot-d4245526721344197a416c3e92072ea7628b22ac.tar.gz
blackbird-hostboot-d4245526721344197a416c3e92072ea7628b22ac.zip
Race condition in IPMI-SEL thread start
This fixes a defect where we shutdown Hostboot before the SEL that caused the shutdown is sent to the BMC. The SEL processing of error logs is done in the background by a thread that is only started when the first error log is committed. Due to lack of proper synchronization, the shutdown could previously occur before the SEL thread had fully started and registered itself in the shutdown processing to ensure its queue was flushed. Modified the IPMI-SEL thread start up to synchronize with a barrier after it has completed its init actions (such as registering for shutdown). This ensures that the thread triggering the start up does not continue, and trigger shutdown, until the initialization is complete. Change-Id: Ie25a5c6e81580375fd18dfe4431660ca14f78273 CQ:SW322712 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21270 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
-rw-r--r--src/usr/ipmi/ipmisel.C10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/usr/ipmi/ipmisel.C b/src/usr/ipmi/ipmisel.C
index 6c4401694..7bb1136d0 100644
--- a/src/usr/ipmi/ipmisel.C
+++ b/src/usr/ipmi/ipmisel.C
@@ -420,7 +420,9 @@ IpmiSEL::IpmiSEL(void)
:iv_msgQ(msg_q_create())
{
IPMI_TRAC(ENTER_MRK "IpmiSEL ctor");
- task_create(&IpmiSEL::start,NULL);
+ barrier_init(&iv_sync_start, 2);
+ task_create(&IpmiSEL::start, this);
+ barrier_wait(&iv_sync_start);
}
/**
@@ -431,9 +433,9 @@ IpmiSEL::~IpmiSEL(void)
msg_q_destroy(iv_msgQ);
}
-void* IpmiSEL::start(void* unused)
+void* IpmiSEL::start(void* instance)
{
- Singleton<IpmiSEL>::instance().execute();
+ static_cast<IpmiSEL*>(instance)->execute();
return NULL;
}
@@ -456,6 +458,8 @@ void IpmiSEL::execute(void)
INITSERVICE::registerShutdownEvent(iv_msgQ, IPMISEL::MSG_STATE_SHUTDOWN,
INITSERVICE::MBOX_PRIORITY);
+ barrier_wait(&iv_sync_start);
+
while(true)
{
msg_t* msg = msg_wait(iv_msgQ);
OpenPOWER on IntegriCloud