From: Troy Crosley Date: Tue, 1 Sep 2020 17:27:37 +0000 (-0400) Subject: Prevent a xenagent timeout on S3/S4 transition. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2c2e29906539cb48cd25d85be476e78237f3b508;p=pvdrivers%2Fwin%2Fxeniface.git Prevent a xenagent timeout on S3/S4 transition. Prevent a xenagent timeout (and live kernel dump) on S3/S4 transition by changing CXenIfaceCreator::Log to use TryEnterCriticalSection. Otherwise, a timeout occurs when the service control handler fails to return due to attempting to enter a critical section object that the main service thread already owns while responding to the control/shutdown xenstore watch. Signed-off-by: Troy Crosley [Re-ordered if statement] Signed-off-by: Paul Durrant --- diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index 26c63a2..e5c817d 100644 --- a/src/xenagent/service.cpp +++ b/src/xenagent/service.cpp @@ -107,9 +107,9 @@ void CXenIfaceCreator::OnPowerEvent(DWORD evt, LPVOID data) void CXenIfaceCreator::Log(const char* message) { // if possible, send to xeniface to forward to logs - CCritSec crit(&m_crit); - if (m_device) { + if (m_device && TryEnterCriticalSection(&m_crit)) { m_device->Log(message); + LeaveCriticalSection(&m_crit); } }