]> xenbits.xensource.com Git - pvdrivers/win/xeniface.git/commitdiff
Prevent a xenagent timeout on S3/S4 transition.
authorTroy Crosley <troycrosley@gmail.com>
Tue, 1 Sep 2020 17:27:37 +0000 (13:27 -0400)
committerPaul Durrant <pdurrant@amazon.com>
Fri, 4 Sep 2020 08:05:38 +0000 (09:05 +0100)
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 <troycrosley@gmail.com>
[Re-ordered if statement]
Signed-off-by: Paul Durrant <paul@xen.org>
src/xenagent/service.cpp

index 26c63a2a52a0e76a16303a9b4b99656fadccfc36..e5c817d825b7e8ed32dc6ce205abc2cdc47a7021 100644 (file)
@@ -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);
     }
 }