From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 17:27:55 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2020 17:27:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDA4X-0002Qd-0K; Tue, 01 Sep 2020 17:27:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ed/3=CK=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kDA4W-0002QY-Ll
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2020 17:27:52 +0000
X-Inumbo-ID: 68486d61-4f3b-4086-90cd-17fd712d8cca
Received: from mail-qt1-x82a.google.com (unknown [2607:f8b0:4864:20::82a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 68486d61-4f3b-4086-90cd-17fd712d8cca;
 Tue, 01 Sep 2020 17:27:52 +0000 (UTC)
Received: by mail-qt1-x82a.google.com with SMTP id t20so1521233qtr.8
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2020 10:27:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=J5+qGfGw8C/pWn4yRZpa38090RT5zV5z1EUNCqknnc8=;
 b=djxJViR88ePIdk1xunQOObyyHOP6EIbZaVFSiTcJ3gRBpdgyjcO+rYFK+r51pO9M3N
 edUg4vIAUizdU15QEA8NTw3EcI/DoYh0YOIvttTsb5dBdLlInmbJF5LYLnUkw45KgQM/
 O6dsErtQBUc4tdgdhQd6MlFZYg4/EnQaGTU7cTy+RW5V/6awA00oMUukIwf8LCYxV/NI
 nRQi1yxpJ/tvKWZiFBFB/EpKq/1YoZPbgIHRl+GiZYopXfgCEJiy2+xjd43lmw++RHn+
 2Ln99jrfOqsI4y1FScm9yOkD5dMWTU04TYpU9YEgSl0WlUZmxdxOzpfq8b956nCcx70P
 nHRA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=J5+qGfGw8C/pWn4yRZpa38090RT5zV5z1EUNCqknnc8=;
 b=gbKlphXMhfqbUkhHhyr0EQF3FOYVfAGSHEjXAU/m/dkViajjj4uHYoqdDppsHH9dXH
 XHXz1ngVqAPT9U7x56/ROQpWViMi3a3zfML5Ccxmnv32HKbo/4TIgzp6vc0mArC4DjC5
 Dju5CakNUpLQlfQBA2j7hS/ChY2Ht5K8c3+PNOzndRHA6AaFi9Rw4l6IgcDOGwizQvgN
 VgjOptAqeoV5DRdeDeedAdTE+nrdfIDrp1nkWVmfVs8JU0CA00aedjtk4a2fkFeL2Ck9
 nYyR+3nZ5QVePg++pzVRYlUPtAuAS/YXwD5isvv7v7YUdkTiatCOxx/wxSmnTO0kvt9y
 27tg==
X-Gm-Message-State: AOAM532srwm3K/evjlMLSpY0kjbhjftCH2KO5t0apbLkj8ykTIDKB9SD
 3jOphBSMljrx5wHAWMqCoeJCbI8VZ0PTAQ==
X-Google-Smtp-Source: ABdhPJx1bidyVQIfcNAAR/g7jFTMJOzwp5cQu0xNaYU20SoyrvethqDtN9poCHrVjFbg0o1n4dva8w==
X-Received: by 2002:ac8:310c:: with SMTP id g12mr2892225qtb.281.1598981271299; 
 Tue, 01 Sep 2020 10:27:51 -0700 (PDT)
Received: from localhost.localdomain (ool-18bc75a6.dyn.optonline.net.
 [24.188.117.166])
 by smtp.gmail.com with ESMTPSA id 20sm2289684qtp.53.2020.09.01.10.27.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Sep 2020 10:27:50 -0700 (PDT)
From: Troy Crosley <troycrosley@gmail.com>
To: win-pv-devel@lists.xenproject.org
Cc: paul@xen.org, ben.chalmers@citrix.com, owen.smith@citrix.com,
 Troy Crosley <troycrosley@gmail.com>
Subject: [PATCH 0/3] Improve xeniface sleep
Date: Tue,  1 Sep 2020 13:27:36 -0400
Message-Id: <cover.1598888060.git.troycrosley@gmail.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

Several changes to improve xeniface/xenagent's behavior when
transitioning between power states.

Troy Crosley (3):
  Prevent a xenagent timeout on S3/S4 transition.
  No longer terminate xenagent for S3/S4 transition.
  Avoid unnecessary assertion.

 src/xenagent/service.cpp | 8 ++++----
 src/xeniface/fdo.c       | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.20.1



From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 17:28:04 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2020 17:28:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDA4i-0002RC-2F; Tue, 01 Sep 2020 17:28:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ed/3=CK=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kDA4h-0002R7-6e
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2020 17:28:03 +0000
X-Inumbo-ID: e3514634-7460-49ac-af80-915ff785c5c3
Received: from mail-qt1-x842.google.com (unknown [2607:f8b0:4864:20::842])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e3514634-7460-49ac-af80-915ff785c5c3;
 Tue, 01 Sep 2020 17:28:02 +0000 (UTC)
Received: by mail-qt1-x842.google.com with SMTP id z2so1508121qtv.12
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2020 10:28:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=QWRaZ4LTNbVvGKwXNolQoq+iBjg/TWeUHKTmQtSn6Fg=;
 b=Dwn+bKFpShm55GnHbH7puOPFO0GgAuWnq6rOpFboXAgmdXkpCqk/D75OiO0w8KRgbu
 wpvPo4O/rECwn/j/0R+rsQE7mpBL4aLMyfbkKx0sgdmgqZ+AZhs+AbCCLFbiZxp/F/I2
 oRyEobSdJesDRO8V4GT7wH2XyJDC9wuLYM2F1ocsm3KVV7yUgOcY4RxoRJ4Iqhz4qBd8
 VgNz+OfA3jp+Ied3vukF0xNNeed+jDGxTgha4mIs9P7CKsX0v2HIqS/oMQeUgEVLzUgy
 J4Wl/Gw88FXlBMs3yir5AUn1PQlPC9T5zRxahmqevqsQwLJtjleSEBTfo3jFhaX0+QAk
 z0YA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=QWRaZ4LTNbVvGKwXNolQoq+iBjg/TWeUHKTmQtSn6Fg=;
 b=l3CaX8Ublsz5/zJc7YezAj879DQ3QjCdJXhE+uiSQL1m7jSc05XFsIBgWo/LwmVbtO
 QKZnqM0HDNAXGFoRC/PP1JU2jTN67FFNsOK1Hj19YXPkCbyflxT00FqhGF9rWnvCddR9
 iBGtUixcCafcKVxbhNKY60lpfVpoIfmPcG2hc3HA3ySeV/fvpIg4nOKUqTdy2crN6N6R
 3OD2LiI3v6ZI/PSWTTVHdeLsgNIucj+Du33svhB3I1wYu+p9L1GXtXd25+2oisj44OOM
 i4IKqDy/n+uvf7n5vGFwE4NxMXE0UsNBJRz6BzM7gaZ9jWN7tPHqz9ryK9YW3CXRvnQc
 Akdw==
X-Gm-Message-State: AOAM530uhqPzDOWPdSIMmFXdstE9gik1qqWKx1/13akuVu9UopLRVQAX
 mnxdS7y/FxEjZ1dTZ2Xl4IQrvxOvRpiqGA==
X-Google-Smtp-Source: ABdhPJx21RPFv/bNhXP1Op44jaoYTy8vYjBY1ivHYdQqaJBXfGl+SVXY6Fk6oAmzrjes9x6z2+65kg==
X-Received: by 2002:ac8:17af:: with SMTP id o44mr2888940qtj.343.1598981281968; 
 Tue, 01 Sep 2020 10:28:01 -0700 (PDT)
Received: from localhost.localdomain (ool-18bc75a6.dyn.optonline.net.
 [24.188.117.166])
 by smtp.gmail.com with ESMTPSA id 20sm2289684qtp.53.2020.09.01.10.28.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Sep 2020 10:28:01 -0700 (PDT)
From: Troy Crosley <troycrosley@gmail.com>
To: win-pv-devel@lists.xenproject.org
Cc: paul@xen.org, ben.chalmers@citrix.com, owen.smith@citrix.com,
 Troy Crosley <troycrosley@gmail.com>
Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
Date: Tue,  1 Sep 2020 13:27:37 -0400
Message-Id: <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598888060.git.troycrosley@gmail.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

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>
---
 src/xenagent/service.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
index 4d62e09..e595093 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 (TryEnterCriticalSection(&m_crit) && m_device) {
         m_device->Log(message);
+        LeaveCriticalSection(&m_crit);
     }
 }
 
-- 
2.20.1



From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 17:28:09 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2020 17:28:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDA4n-0002Sd-3k; Tue, 01 Sep 2020 17:28:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ed/3=CK=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kDA4m-0002R7-5I
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2020 17:28:08 +0000
X-Inumbo-ID: 5d7317dd-4452-481e-a303-9cbe3d8a5494
Received: from mail-qv1-xf43.google.com (unknown [2607:f8b0:4864:20::f43])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5d7317dd-4452-481e-a303-9cbe3d8a5494;
 Tue, 01 Sep 2020 17:28:07 +0000 (UTC)
Received: by mail-qv1-xf43.google.com with SMTP id cy2so900138qvb.0
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2020 10:28:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=jU4ikX3O0OTdal2n07HMQd2gKJLsuzvF5D32fs4WUvg=;
 b=f3LHDcL8ZLOkXRSd7AtPrFgt2/qeYFCtjJDUEx03goabq7r0LPMIXWaU4sglv17yB1
 xQ+aYgmM/LMu7DVTLk1ZWGKL+9aeCB5yGhsIqZnsbym7ilnVkAuX008BvIpRqK7nj/g7
 e3NHaRigNFwsEdssWXF/l4okr4WF4KGtif7w6r5iSs/Q8jHHtu7cMlvNjT+K7g1Xhs46
 EOUI9l10zIonwV0T6SxwHYWBRosdq4xx2habyi3ZcpZBBUnAovFOvcgaX9UXpPLjPIOv
 JWqYWSS3dbyRtYl1mJXJpQfWcbjdE27JqOAROCt7umYrQNF0KMP8jI0T6K4AO1RKi+WI
 ycqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=jU4ikX3O0OTdal2n07HMQd2gKJLsuzvF5D32fs4WUvg=;
 b=OgmyNgkPJdquhR/+ndPsNdm9AR1SOvV792iTx2zRbywgnbqS2eXFGi/qZC7tvDgzR/
 daAf7cUfGqdxVy19cUOGbNmCCE52NHBYQCNRWZoOZDSsucTnJ9ibAaQUAy+HLVo2WR3Q
 1Pvc0cyVjvz+N3vVvwAA+nNbqm8BU/7m74Jwjn7vZ+0anRYPKm3tCcyYCrgO3G8Lq037
 yTRIAqw3vKeD1t82g0g8tfrl5cdprgxP/D2jvbEC+8JfSS/7DBAUa2KuzQZpeB82bMh3
 Orm2mQUvP1xAvaxIKmIJ4fw+nhRHcDZmsAGf3yJQub56IoJuGJGShGwq3RA8y6WYjRBq
 jz1Q==
X-Gm-Message-State: AOAM532xgbso9zwM7sDM9N4gB9Xk2drrn/DJTAeh8dxWZxfjfp7mLNYm
 VQ44W00aOMAbQAnOOc8WiqxLdsxkrx2yaQ==
X-Google-Smtp-Source: ABdhPJzwGgKb9YzA4V2P1ZU4yvPwFzb8ZbyAJQ20bPYjmWKkSvVepQ6oUBBz+UuF8EUNC1ORiDWgCA==
X-Received: by 2002:a0c:e383:: with SMTP id a3mr3057218qvl.125.1598981286563; 
 Tue, 01 Sep 2020 10:28:06 -0700 (PDT)
Received: from localhost.localdomain (ool-18bc75a6.dyn.optonline.net.
 [24.188.117.166])
 by smtp.gmail.com with ESMTPSA id 20sm2289684qtp.53.2020.09.01.10.28.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Sep 2020 10:28:06 -0700 (PDT)
From: Troy Crosley <troycrosley@gmail.com>
To: win-pv-devel@lists.xenproject.org
Cc: paul@xen.org, ben.chalmers@citrix.com, owen.smith@citrix.com,
 Troy Crosley <troycrosley@gmail.com>
Subject: [PATCH 2/3] No longer terminate xenagent for S3/S4 transition.
Date: Tue,  1 Sep 2020 13:27:38 -0400
Message-Id: <5e89754dd95d9f08f2dc0cc7ccf394af6da4a199.1598888060.git.troycrosley@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598888060.git.troycrosley@gmail.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

Signed-off-by: Troy Crosley <troycrosley@gmail.com>
---
 src/xenagent/service.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
index e595093..3630240 100644
--- a/src/xenagent/service.cpp
+++ b/src/xenagent/service.cpp
@@ -224,7 +224,7 @@ bool CXenIfaceCreator::CheckShutdown()
         if (!SetSystemPowerState(FALSE, FALSE)) {
             CXenAgent::Log("SetSystemPowerState failed %08x\n", GetLastError());
         }
-        return true;
+        return false;
     } else if (type == "s3") {
         m_device->StoreWrite("control/shutdown", "");
         m_agent.EventLog(EVENT_XENUSER_S3);
@@ -233,7 +233,7 @@ bool CXenIfaceCreator::CheckShutdown()
         if (!SetSuspendState(FALSE, TRUE, FALSE)) {
             CXenAgent::Log("SetSuspendState failed %08x\n", GetLastError());
         }
-        return true;
+        return false;
     }
 
     return false;
-- 
2.20.1



From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 17:28:14 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2020 17:28:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDA4s-0002Ta-5H; Tue, 01 Sep 2020 17:28:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ed/3=CK=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kDA4r-0002R7-5Q
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2020 17:28:13 +0000
X-Inumbo-ID: e862f89e-d3e8-4706-a7bc-4d351c7b5fa3
Received: from mail-qk1-x744.google.com (unknown [2607:f8b0:4864:20::744])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e862f89e-d3e8-4706-a7bc-4d351c7b5fa3;
 Tue, 01 Sep 2020 17:28:09 +0000 (UTC)
Received: by mail-qk1-x744.google.com with SMTP id f2so1734188qkh.3
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2020 10:28:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=SYpdVzfhDIKLDiNJinMxp/8FMfmOcXV4K+agE8BsHwk=;
 b=YDU+BCazmEBqlwHEdWuDuDkFWYHkgALhi97Ky82MJH+GWkV+MFODGQqwVbK76Fx39A
 sVhgFCgVF/x/HLeD7MIu1fVBCBXk6JrAjjXEHpWkyTpb1CwBhZtDv4/Ne/rf6xZcsh+X
 CEoM17g/4R6vltOcYO8ngSjR/einlBeTeqkTOqLpa6odt36c8lsV1FzFidm+Hj6H5WY2
 O/Fb8hCmbVn72Bmsuz7NhDaHtJuMwb2xRXnkzdpDKRKIQshYuKebHUKCS9RR5ZcexGyC
 Yf99EV4cJDnx18/u/pRv/u6reqO7D42v8g6L4iCis6keYQ4iXlbAHc19wyoWpxOmg7MP
 zshg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=SYpdVzfhDIKLDiNJinMxp/8FMfmOcXV4K+agE8BsHwk=;
 b=DGIjyDKj3POj5KaCGjFGk8t9rS0gbfD9tRuuxGukDYRzdZX93phHgQAdWlmbjlWMB5
 s76Zo1WO1m2n6Ioy64lZUU1qW1OVjTiUkF9+ZQf+qcLhyWWHCmSc7KVQvziEvRoUG4FS
 bA4hD6s2cLOGis1hagxOzjO1OmVJq6ImeBhzjCDF3K1UMLDG0JnvPz1ynMdh4XbUCiIv
 jliRqMggds/vERXRFa2RmOvBsYbEKGjBr/AIHqT11A94kuOrgIoCF23jVRYWeJQulDwI
 otpg9991xfVovuWKsB3qmpVqv6Pev0Eyn9fxtSJMXZXBpZp2pvDxTUidzE3ugYQCphCi
 B8Ew==
X-Gm-Message-State: AOAM533MmPKsoMVd8Z/5LaDJLxGosyTnR3977XQn6NQoAMoQG/tG16Gt
 fXzrcZuNZYmzXvGtZk2CtiIBWamJVCfxqw==
X-Google-Smtp-Source: ABdhPJyB/SiH8jxwzsvshQtU0qCi+NmleqTivEcRuf0qIKjKNN9JTpX6Nh/wHpTYfz0qkzWWq+Qzhw==
X-Received: by 2002:a37:58c4:: with SMTP id m187mr2970667qkb.312.1598981288844; 
 Tue, 01 Sep 2020 10:28:08 -0700 (PDT)
Received: from localhost.localdomain (ool-18bc75a6.dyn.optonline.net.
 [24.188.117.166])
 by smtp.gmail.com with ESMTPSA id 20sm2289684qtp.53.2020.09.01.10.28.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Sep 2020 10:28:08 -0700 (PDT)
From: Troy Crosley <troycrosley@gmail.com>
To: win-pv-devel@lists.xenproject.org
Cc: paul@xen.org, ben.chalmers@citrix.com, owen.smith@citrix.com,
 Troy Crosley <troycrosley@gmail.com>
Subject: [PATCH 3/3] Avoid unnecessary assertion.
Date: Tue,  1 Sep 2020 13:27:39 -0400
Message-Id: <34f97492679c1f9d043b241ade59fe497fca2a8a.1598888060.git.troycrosley@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598888060.git.troycrosley@gmail.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

Add the missing brackets to an if statement so that FdoS4ToS3() is not
always called in __FdoSetSystemPowerUp().

Signed-off-by: Troy Crosley <troycrosley@gmail.com>
---
 src/xeniface/fdo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xeniface/fdo.c b/src/xeniface/fdo.c
index 1f859cd..6aabf96 100644
--- a/src/xeniface/fdo.c
+++ b/src/xeniface/fdo.c
@@ -1740,9 +1740,10 @@ __FdoSetSystemPowerUp(
         goto done;
 
     if (SystemState < PowerSystemHibernate &&
-        __FdoGetSystemPowerState(Fdo) >= PowerSystemHibernate)
+        __FdoGetSystemPowerState(Fdo) >= PowerSystemHibernate) {
         __FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
         FdoS4ToS3(Fdo);
+    }
 
     Info("%s -> %s\n",
          PowerSystemStateName(__FdoGetSystemPowerState(Fdo)),
-- 
2.20.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 03 14:54:12 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Sep 2020 14:54:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDqcr-000435-EQ; Thu, 03 Sep 2020 14:54:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DOrv=CM=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kDqcq-000430-24
 for win-pv-devel@lists.xenproject.org; Thu, 03 Sep 2020 14:54:08 +0000
X-Inumbo-ID: 687840a3-f99a-4014-bf66-2284dde3e7a5
Received: from mail-qv1-xf44.google.com (unknown [2607:f8b0:4864:20::f44])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 687840a3-f99a-4014-bf66-2284dde3e7a5;
 Thu, 03 Sep 2020 14:54:07 +0000 (UTC)
Received: by mail-qv1-xf44.google.com with SMTP id di5so1418617qvb.13
 for <win-pv-devel@lists.xenproject.org>; Thu, 03 Sep 2020 07:54:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=IiphdVLTBPw8UQRAODBJ6We9cG4/+5Wp1DYU/Jv2ZbY=;
 b=IOsxZqSDzC2+HMqJrlr8DNvSiy5ClzxwbCYxM3RAkt32xTwQSTcLZR6YsfdGy2K8Lc
 eskHmbbDPLBbqJ8/aW4rbp2nH+G8oYSaPia6MxfIK8jqfb+8aXhZ/UoGzAVMBESVOdu6
 /RdV1wAOomTUcfK+b8aDfKNpeL7d7dKNK2g7/YdREDOMabRB264vGPmh6iOe6KJ5CnOb
 69lfYGZOwC/nAF4UlcEizqKTHQmYR4PtZNauxl0lAn/q/unj52DWvTJHclrUcmSBTS77
 Be7LjymWOtivBdY3jwS8618a/9cd7xQXNc/xqXOa1aHZjEvz8OrT/HJ9f99Q+LdmvEs9
 iPZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=IiphdVLTBPw8UQRAODBJ6We9cG4/+5Wp1DYU/Jv2ZbY=;
 b=P0jANnHHFlgymv/5euxnWcWcp46Bjl1T0GB+wNazU8C8kXMkYGL38HDjlw4lNZbznb
 8Spt3p7cuT3QfvBSFumi2HcVDJC+Vs50NZTvVfO0aOJjoZoSFa02VewpHs+VwoRMAPHK
 6ODsG0DVzLK6SVUbNpSB8kxeCWXATPo8GxJlQJ46wTufxl++0CsG1a3ngkJTM/8P+S3a
 smjaPdQBJ1QlUXwdvnAQ5w/FO2zJ+5IllRjPn7QcUiPpwI+ctTDkr7YcQLc8kHMmPfgh
 4ri50bEkp9mAljGMJg24HMgYky4cyOO+YlscICa7iY6Ertk1S8UV+a3LJu5AAkGRA9sj
 GKMQ==
X-Gm-Message-State: AOAM531ihihr3F15asQFBGLTdZjcKEbQOJe0xcTSHeWtr/55LN00MXUS
 d+rmGIwp9pEMImhfnHmfGCvgmw5z/wgC7A==
X-Google-Smtp-Source: ABdhPJw2joOCTkh4UMQwWYEJx6ulvfeuR542JCUDVF07N4zbX21Ymv/Vbvpr+SXoxnk7x4sJiHGk/A==
X-Received: by 2002:a05:6214:289:: with SMTP id
 l9mr3333558qvv.137.1599144846588; 
 Thu, 03 Sep 2020 07:54:06 -0700 (PDT)
Received: from localhost.localdomain (ool-18bc75a6.dyn.optonline.net.
 [24.188.117.166])
 by smtp.gmail.com with ESMTPSA id j31sm2256260qtc.33.2020.09.03.07.54.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Sep 2020 07:54:05 -0700 (PDT)
From: Troy Crosley <troycrosley@gmail.com>
To: win-pv-devel@lists.xenproject.org
Cc: paul@xen.org, ben.chalmers@citrix.com, owen.smith@citrix.com,
 Troy Crosley <troycrosley@gmail.com>
Subject: [PATCH] Clear rather than remove control/feature-XXX keys.
Date: Thu,  3 Sep 2020 10:53:58 -0400
Message-Id: <4a93f4861d4139c6d91ca0921298f69e4428984f.1599144402.git.troycrosley@gmail.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

These keys should stick around when disabled since they're present at
boot. This also fixes an issue where the keys are unable to be written
on wake from S3 or S4.

Signed-off-by: Troy Crosley <troycrosley@gmail.com>
---
 src/xenagent/service.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
index 3630240..e71059c 100644
--- a/src/xenagent/service.cpp
+++ b/src/xenagent/service.cpp
@@ -331,10 +331,10 @@ void CXenIfaceCreator::StopShutdownWatch()
     if (!m_ctxt_shutdown)
         return;
 
-    m_device->StoreRemove("control/feature-poweroff");
-    m_device->StoreRemove("control/feature-reboot");
-    m_device->StoreRemove("control/feature-s3");
-    m_device->StoreRemove("control/feature-s4");
+    m_device->StoreWrite("control/feature-poweroff", "");
+    m_device->StoreWrite("control/feature-reboot", "");
+    m_device->StoreWrite("control/feature-s3", "");
+    m_device->StoreWrite("control/feature-s4", "");
 
     m_device->StoreRemoveWatch(m_ctxt_shutdown);
     m_ctxt_shutdown = NULL;
-- 
2.20.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 03 15:06:52 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Sep 2020 15:06:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDqp9-0005AA-CZ; Thu, 03 Sep 2020 15:06:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iU/P=CM=citrix.com=owen.smith@srs-us1.protection.inumbo.net>)
 id 1kDqp7-0005A4-Ob
 for win-pv-devel@lists.xenproject.org; Thu, 03 Sep 2020 15:06:49 +0000
X-Inumbo-ID: 9b473969-b0a4-4841-a6af-44dba503e1d3
Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9b473969-b0a4-4841-a6af-44dba503e1d3;
 Thu, 03 Sep 2020 15:06:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
 d=citrix.com; s=securemail; t=1599145608;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=yNav1j+Mb9a/LWxzqeA0Nbelb0eDnK69YDshttVlsxs=;
 b=V9zbI1HBrPA3J5XaFb2SLM0AplMgnztuldB2DsZV94TbaN6FFls7Y5lI
 Y7ZYSSKiFN45P4kRDSh8frMLTT0VqC49cDuSevDl7P0CB2oVc8LalKo10
 sd/u4tfQ9cHJ84R+SVKU089y5Cgg8kiQkN0q4bsKRLaVxoLirxMTNibHv M=;
Authentication-Results: esa3.hc3370-68.iphmx.com;
 dkim=pass (signature verified)
 header.i=@citrix.onmicrosoft.com
IronPort-SDR: eB9QKKsSPqdfHwWB3TCG06J4QXsRuUcdkQWj99uNsuno6EnpWeDmSAuraVFsOOotziD6zas0bz
 /0ASkOtSXdz1HFC0pnWcALWXlpftGi0LfBfEaDURmGRxfnyNzSOACXOa0MI6g7aYWRMh7GjKeB
 /u2BVFwg+5pqSerYAaaA9eCvztaw0WYDjwrG5iN7PiEy/FS0SsbVTkItx+SYpeIRXR7ElMmqLJ
 YhG3aATzbNcCM3SYqLwV1fHhToWeRFL51HRwyBQmUziOL2v4e/wlIgnUw7H/Gubm4EN/xAcwwA
 68g=
X-SBRS: 2.7
X-MesageID: 25917679
X-Ironport-Server: esa3.hc3370-68.iphmx.com
X-Remote-IP: 162.221.158.21
X-Policy: $RELAYED
X-IronPort-AV: E=Sophos;i="5.76,387,1592884800"; d="scan'208";a="25917679"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=oOKKV7MD/D+fqKImyey+PwAkE8RLBdzt4IyC93mc6ctqKMLy3SD7yXo9SDPL8LcXr9P9T8VCvBRc+XoRbj/Klu8VoyoEQRusg74IEjM7Fr7eG4YvDD2pX8zQhrsLM2KpNKPgGOLSAGG6f0P3gvMZIsn52jHgA1HLAuBRFnB8EvlDs9QX5QaexMb5abwbx1hLqjJK6vbS1aqdgZzpiRBJnUnu37PPrK1VXsUPQ1HQRa2NDYAXiBvpNlVzh70oKCIEHsL+r6xo98lDGz+t3x/9J2FKNqaA7JW/Nni7AOsKqztoOAQko+NZcZRDzRRw6+eLdFE1m285LJYUMA06E8YobA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=tBurwFKnC4uLjkzHX+MZwHI9wvf76wx6w+YjfJvnHkA=;
 b=fADyixZJpW5jUvTPK3Q4WYDK2ArpDvCYiRooYvKlF4QD1LabOAT30yncQUvqKf9kleJ6LCBjwcLLDPQ1hLm255NHXT+NOtvjQiknlKdYZdjZCI+EcgLlxM+jIxPBC5j1zjJ/kWId9OVmNzMBuL8IqxrFMBEl+nDseo0dCIoBerqJ72xIcXwngkpwsOljlbGU0HVXj+whzPhJj69YCHUOXlCAYMFqSJIwE4jbv0WTraSbpo3RHCLJoTBUYCLjjZUKUuseGuc8MlMzSq8qjouOHeH/CBzKv8GESFwmd7R6Udc2VOFTvismrxY8Td68aQW6aP3PY0DgNlmoXXXlkdta8A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com;
 dkim=pass header.d=citrix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=tBurwFKnC4uLjkzHX+MZwHI9wvf76wx6w+YjfJvnHkA=;
 b=jPq+ivKDKKXKEUofPMzlo9/Yd8yFutAvhbTC0e6Jjg7lv6HmZeW0xlUiVlPUeeLV4waRQiwNnxqc91rblTp/tdMirsLK6IRutfSAs3fsNAAFBRsaeUXdbhbED1pMTP9Sg7F33qfxc20WsYrH8/ceBKccHJG4saf8DH4LwwO5bH4=
From: Owen Smith <owen.smith@citrix.com>
To: Troy Crosley <troycrosley@gmail.com>, "win-pv-devel@lists.xenproject.org"
 <win-pv-devel@lists.xenproject.org>
CC: "paul@xen.org" <paul@xen.org>, Ben Chalmers <ben.chalmers@citrix.com>
Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
Thread-Topic: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
Thread-Index: AQHWgIVBmjpBp1FmtU6cD8M4/D8T/6lXBh+A
Date: Thu, 3 Sep 2020 15:06:44 +0000
Message-ID: <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
 <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
In-Reply-To: <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 4412cea5-ecdf-4956-b096-08d8501af8c9
x-ms-traffictypediagnostic: BYAPR03MB3991:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BYAPR03MB3991680A470926834BE1FF54FE2C0@BYAPR03MB3991.namprd03.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:3276;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: sR3J6yaVt0qNidZSdUp4YkOc5OIeTCI+NHSzRf/8zr3f92Js4+yqGjtYENRxAZB9HgTpiYsOWefNr1Axtu8E7bGRO+iHezCmk3tkaWTcCvHqxpuvyYMMWKVWRFn5DIKXedQhgGpv7b2CiEV1s47k3ucGvs+/C6KcuZfpuMLBlj5mXSFt84ZUtw92mmy9eDdOeH2Z9LhDr+UXI4kS7RUAas/jSrwF1Pw+aGydPCIL/qaluqmlTd6Upemy2BcvJ7epi1C549uQp+oDMxvdUJ+lkv/9/bA/KpDVHoQq3a45Qsc+v85SaX+fYM9f24KMI8GfdyE2GXDYWsDv3V+gGyAAUg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BYAPR03MB4551.namprd03.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(66446008)(4326008)(64756008)(186003)(55016002)(6506007)(83380400001)(66556008)(8676002)(71200400001)(66946007)(33656002)(9686003)(107886003)(66476007)(53546011)(478600001)(8936002)(76116006)(2906002)(316002)(44832011)(86362001)(52536014)(5660300002)(54906003)(110136005)(7696005)(26005);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: cHWAyAGBg/I1+Rojpzqrc4ySif6QXsivfQRkURzo4SSd1Og9jic7JezFpEyp2HUnyYHAuf6Css8kOY77X6j09PK9o/KY7X5N1yT3cNNuBs3h3wMY0yV/m6tdqFcYh9lbWglBdRY36g/IqfuAZkikKGWirVPdWOD1qLfvvqtsb7BAglQru831h6/padS46er6RwDKKBG4usS81DXvXSCP+cxMErzsDrzVADbV3tOg/JVkgqj0le3MmsovKaBdWy3Uqh1X7zieJ2yjhob/6QRL1LHpMh5mb2PfNoDROxdu5rfyyL67UedEMFliCsCxXvDYPRLJb2iXH1rY5/HbYHWOY1FnXgflJUQWrPCZ8xkSnDCVTsgWPLWqKmD2Zu0XjfADWcXe2oaXvE9zr5LdCsfvrofVrY5EygZTYJMU7CIoY4bTd8EJnJOTSGFpgBziRpkp7i+jhmx6WAAADsi0GrC4jOTktarUxf/+DeTgDKyDFUscGCgvViB1Hod5221q3gwKRPZbtfFByISFsE5sycoUCrR0OnGb0PKqFWdaKQGzdusY29Mej8KKKdqnsXP4++6GOmw2KhBfyY8U2hzM6dx9rt+9OtWVzBJx9YNc9lmQa/0BTIW45+93A9r6dBsh3LrcFNTboolx+t35Uy2vsOQ+dA==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB4551.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4412cea5-ecdf-4956-b096-08d8501af8c9
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2020 15:06:44.3246 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335836de-42ef-43a2-b145-348c2ee9ca5b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 8dlL1tYW9dC59ArKsaSepbIIn2eiSiWK5NpoDiCcxaEqg0SwNNuSxlREgDMnIHvAfbdvi6RryexPnTemeV/Ufg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3991
X-OriginatorOrg: citrix.com
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>



> -----Original Message-----
> From: Troy Crosley <troycrosley@gmail.com>
> Sent: 01 September 2020 18:28
> To: win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
>=20
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments
> unless you have verified the sender and know the content is safe.
>=20
> 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 ret=
urn due
> to attempting to enter a critical section object that the main service th=
read
> already owns while responding to the control/shutdown xenstore watch.
>=20
> Signed-off-by: Troy Crosley <troycrosley@gmail.com>
> ---
>  src/xenagent/service.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index
> 4d62e09..e595093 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 (TryEnterCriticalSection(&m_crit) && m_device) {

If the TryEnterCriticalSection succeeds, but m_device is null, doesn't this=
 leave the critical section held?

>          m_device->Log(message);
> +        LeaveCriticalSection(&m_crit);
>      }
>  }
>=20
> --
> 2.20.1
>=20



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 03 15:08:59 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Sep 2020 15:08:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDqrD-0005Ep-JE; Thu, 03 Sep 2020 15:08:59 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iU/P=CM=citrix.com=owen.smith@srs-us1.protection.inumbo.net>)
 id 1kDqrC-0005Eg-GG
 for win-pv-devel@lists.xenproject.org; Thu, 03 Sep 2020 15:08:58 +0000
X-Inumbo-ID: 8045efae-b297-4282-a2a3-16b199dc64ea
Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8045efae-b297-4282-a2a3-16b199dc64ea;
 Thu, 03 Sep 2020 15:08:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
 d=citrix.com; s=securemail; t=1599145737;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=NxljYgtfNP+9CWu7iTNKNwllxxtGK8irymbarYszJjE=;
 b=BRc+zLCY4VI+gcKggyem8b397TrJ+vlK7GcY4mkXFK9DHTdqZGXOMDJz
 3nu5ilhnI/er/s7X05Dd3VH183AYI1P/oZ53URdo5RvchYe4GLMt0xl5r
 zWqfh7Yh6RQrehBB5fLUFFzEbhpS8otzFohyekqMnmx2HfGRCtvUVPmiz Q=;
Authentication-Results: esa6.hc3370-68.iphmx.com;
 dkim=pass (signature verified)
 header.i=@citrix.onmicrosoft.com
IronPort-SDR: sR2nnSOBp9muM+c2Fc0DNJMH/Vhe6R7yEm62i32U6mKRMK4+yQrdkGbiA5v7CjuXUo5g6wxDeB
 G1p+UgSIJdFWmEQjutVFjgPxHTPIZSEK2UloYKylQYdTJu+WHQxwZsJw0aqGzmdghhs3al4kL9
 1vQtbZQMF86C4WE+L3BWVJvpt5NvLtO+DMTCx8jP+i4Kk6Ft/Es7rxk3Ta3VYBLWTKCLsVm6my
 KY6VfYk2y6ZDsBfA6LgJnf2TuD88lRvzU/oqUzdWzXPLCr4ChKmfizBGXh/hJlpBLglcvDBDut
 m1Q=
X-SBRS: 2.7
X-MesageID: 26232034
X-Ironport-Server: esa6.hc3370-68.iphmx.com
X-Remote-IP: 162.221.158.21
X-Policy: $RELAYED
X-IronPort-AV: E=Sophos;i="5.76,387,1592884800"; d="scan'208";a="26232034"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=UEyx406ktnNn3iTAv9GCh1hLGJIzMocV7lgMUmVG795/uyaL6dhvxHvreWUo/eMnD1Q45G4j0cNa2c10V2IAyVUUt+TE4k//i0Q+e0F+WHv81w3sAFiZDYjLYw2E68j2Eujnce/6JIbhwV5WNZMURu3Zx/bQQDwQOhB+/lDC7lRharHfeENzL71GThHcQETO6kUnwB+nYMFF7stT/riG/J8wtx203lPrSDaiCxvl7iKe+hsY9pQ3tX/hP1q9R/a/NUL75JrC5x5mmOODFZkBTnHeVHxzjQeipvegHFjnetcryVF1gn6Jd1VoX8Y8iym5RtBeX4YMEHwijB3r6vz58Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=hPMBBl8W9QJ66AojJsbo7vc6hAqFUh+C2Em4eiGjWIE=;
 b=WIaHC1+DoxKOd7SnxmCRbqnMaeqRyEyfmahT7QqKZSpRXBCPH/JhSM68ja+FF5yologa4yoc9RDyM0bmRg5cDztfh3h3LGePdQ3V1kn9KgbfBqgpfTc5flm3whKQcS3CQkCl7Fjadvm+47zTGhpdLwylyz2XGng8VkRsETEXHm/AcDZaKdEOUxOkkqZ9M5H7Ss1T66tqz+k5dkWFL2BX2GZt0pxQwZprkOTl6+Jac/+3bl9Tq9YwVB3c0RmjSZhTQbx49ZPM1i328OstkkXlDRsvMvo4eCwLNgunN+Okqkx5sZHmd8oU2/0JW69PPfGpDgModVoBNYAyYw6KRbMNdw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com;
 dkim=pass header.d=citrix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=hPMBBl8W9QJ66AojJsbo7vc6hAqFUh+C2Em4eiGjWIE=;
 b=DSnuBu4tX0tkk2au6j9Rlbkykyrdny9MSmNNFajg9sSfzEb4o4LLQ2B6UGqU44xEpTDVr3/TXLyE7WSa2N75KrlNNQpU3VGxKk1WkBEvibARCYoMVypYRy7BtEV97F4HTUwCS3dnxNCluBSwAHKpI9rcB5yq7zo62ezLBAe3yJo=
From: Owen Smith <owen.smith@citrix.com>
To: Troy Crosley <troycrosley@gmail.com>, "win-pv-devel@lists.xenproject.org"
 <win-pv-devel@lists.xenproject.org>
CC: "paul@xen.org" <paul@xen.org>, Ben Chalmers <ben.chalmers@citrix.com>
Subject: RE: [PATCH 2/3] No longer terminate xenagent for S3/S4 transition.
Thread-Topic: [PATCH 2/3] No longer terminate xenagent for S3/S4 transition.
Thread-Index: AQHWgIVEzeww9dQ4bEy4K/T1q20Yz6lXBwOg
Date: Thu, 3 Sep 2020 15:08:49 +0000
Message-ID: <BYAPR03MB45513B6569CBD9788CF15920FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
 <5e89754dd95d9f08f2dc0cc7ccf394af6da4a199.1598888060.git.troycrosley@gmail.com>
In-Reply-To: <5e89754dd95d9f08f2dc0cc7ccf394af6da4a199.1598888060.git.troycrosley@gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 3e2b3668-dea6-4fde-6796-08d8501b438f
x-ms-traffictypediagnostic: BYAPR03MB3991:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BYAPR03MB399146804D696271E76ACB46FE2C0@BYAPR03MB3991.namprd03.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:2043;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 02e79pcQq3GNrFm+60fUKq4f9EC1LoMgp2/UhxA3Fchq5yshRUcLFXhAHx9MdyOgiujEcd6GNv4aJYXHc9cSZusXhifCFx7iMEIuLln3qzHu5R3U+iQlAXuzKUBkpgCj1dquE57PEASXTd201xkwBrVqhzC25/msud1ScQ6lClKZYyPet3Q9LOmbxUv/AcCF2lUdOY9wbK2vzgvXTBIby2m6JFmtell65wz+OoBUdOP5/2IhPAcvbD4RwugaLifyX8qdsFZDYwvV/S+gqe03Dz9WfVfWErfcvwp4ZebkRqOovFWXti4SOrpeACfJk4SFJjqxGAgFe9zujD9EK5rIEw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BYAPR03MB4551.namprd03.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(66446008)(4326008)(64756008)(186003)(55016002)(6506007)(83380400001)(66556008)(8676002)(71200400001)(66946007)(33656002)(9686003)(107886003)(66476007)(53546011)(478600001)(8936002)(76116006)(2906002)(316002)(44832011)(86362001)(52536014)(5660300002)(54906003)(110136005)(7696005)(26005);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: oDh1VSxJ25orme9u6RAN0bwez9MKVo+OsqGDebQDTGhIU17ISywyO7gAU4vXig+wKVHH60upL38YqBfEpotwTCSaSAryP56+T8NCUZsqrY6TqXWMS/pB1K/YfhAoQ1vhQvhtriNS2rYLIc6/61E4pYXqvfDDqPMOw5rY0DmRHXPLc7KZCw8JzN2e7LuFWFMNv8rmfVWcunyO+MVi9r13NwbY1RxkrGsR5RyPjTj94Pk3GC8orFaQXoFWPN4+5XhBdnhNNjB8+oJj7Jtzo7b2OLg0LsGtcIu2VoBdlRyxe3nhc+qCXPzEOCWs0Es/7/Y6hSU8BhXVZCUuupzRjNMzaPOknk9T4K4FlwButUkmkyGMXP+oRQVtp0MyySCnbwbMnAV24f3ODOkKbnhFibqmV4kCNCTRuOugYPZRHTjd8fGp+5fOT0hQFCgctA5A59AN/c6noolHR1u5I8J/KF+H8A50Z2BlXDkuChlnZa3QDA3HsFTgVYRCDlI1HcPUS5DchzkTgrXhKDsSeY7O9evMDbPJ0O0SutvCLXK81D6nsjC4DySFPPhDEgMck8SaXjjYzY9ni/kHashhIxTkSbFUjbyjkl5WPT/lRpB+h3t3uPiIxK2nKHvjATsYhghQVA45bRtEb0Wdg+/h9nyClTF4eA==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB4551.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 3e2b3668-dea6-4fde-6796-08d8501b438f
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2020 15:08:49.9096 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335836de-42ef-43a2-b145-348c2ee9ca5b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: DRhOKD6LBsJNUY9tId5698UiJqpkX2XD7rzDcnuI4DJIp2W+5g0Pftyf7QxNUkOEdi8DqPySdfFlu2RQICj2rA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3991
X-OriginatorOrg: citrix.com
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

Looks good,
Reviewed-by: Owen Smith <owen.smith@citrix.com>

> -----Original Message-----
> From: Troy Crosley <troycrosley@gmail.com>
> Sent: 01 September 2020 18:28
> To: win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> Subject: [PATCH 2/3] No longer terminate xenagent for S3/S4 transition.
>=20
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments
> unless you have verified the sender and know the content is safe.
>=20
> Signed-off-by: Troy Crosley <troycrosley@gmail.com>
> ---
>  src/xenagent/service.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index
> e595093..3630240 100644
> --- a/src/xenagent/service.cpp
> +++ b/src/xenagent/service.cpp
> @@ -224,7 +224,7 @@ bool CXenIfaceCreator::CheckShutdown()
>          if (!SetSystemPowerState(FALSE, FALSE)) {
>              CXenAgent::Log("SetSystemPowerState failed %08x\n", GetLastE=
rror());
>          }
> -        return true;
> +        return false;
>      } else if (type =3D=3D "s3") {
>          m_device->StoreWrite("control/shutdown", "");
>          m_agent.EventLog(EVENT_XENUSER_S3);
> @@ -233,7 +233,7 @@ bool CXenIfaceCreator::CheckShutdown()
>          if (!SetSuspendState(FALSE, TRUE, FALSE)) {
>              CXenAgent::Log("SetSuspendState failed %08x\n", GetLastError=
());
>          }
> -        return true;
> +        return false;
>      }
>=20
>      return false;
> --
> 2.20.1
>=20



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 03 15:15:10 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Sep 2020 15:15:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDqxC-000619-2k; Thu, 03 Sep 2020 15:15:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=iU/P=CM=citrix.com=owen.smith@srs-us1.protection.inumbo.net>)
 id 1kDqxA-000614-Q3
 for win-pv-devel@lists.xenproject.org; Thu, 03 Sep 2020 15:15:08 +0000
X-Inumbo-ID: 158b632a-ba3a-4968-9e77-efe78bad5d14
Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 158b632a-ba3a-4968-9e77-efe78bad5d14;
 Thu, 03 Sep 2020 15:15:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
 d=citrix.com; s=securemail; t=1599146109;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=JMaZZwHZS3wKu524y2Y3uvYSzbdRO5LVazwwMrHmVEQ=;
 b=TVzGNbnMsPXUYSNznDI4AlIXNNE1tN56ovKLaS1fXkxNvFxgl4qAb5XY
 beksUfdOxyFw3fApktCkcRFoxOldpXjcn1yj3JONQ5Bp25T3+6eCrXSW7
 gnCoJ+15+d9q3tuXJCAZqvyWTuYa3jMCjI63EIS05SeA/3GAM6Z0ges1C w=;
Authentication-Results: esa2.hc3370-68.iphmx.com;
 dkim=pass (signature verified)
 header.i=@citrix.onmicrosoft.com
IronPort-SDR: F+RIbNIMll3d++cns4E8GJmmz97z378++daiDHPzmpZZw5ic0eavMw1KvAuyuZdBdxKX35iCCu
 GZms6yOR2F9lvpyqn6XdOYYly04L4OvJhH/HuiQG5EefEI2LN1gV+a8O+pQfngracE3wAbWLzr
 T9r/CIfvabeZqoHDDxb8AIX09WAI3QdzwiirAFewhI1v2h/W45M/dRf/32ocQJ8hpyeryTHjby
 7tbDKU4rKAWLuo0SYPApnCpddK8JZnwXwaz22pTL2zSPHxvDyk2tFoRv9Mjylk8Ewx0aq0QfSK
 858=
X-SBRS: 2.7
X-MesageID: 25944421
X-Ironport-Server: esa2.hc3370-68.iphmx.com
X-Remote-IP: 162.221.158.21
X-Policy: $RELAYED
X-IronPort-AV: E=Sophos;i="5.76,387,1592884800"; d="scan'208";a="25944421"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=lvkxfD/Hd+FcZ+y2lthBMByGt8JEigA2lKXoqZ9cAW1xlShOzbqOo8SHzTLo/r8Qn5hUL5rM7VP/xTRh6aR5t+/2cynvOh/AfxCUylJ9E342JEwrGjTN5HGp7oVO7lxgx5LlGRgTznrqvSfYFFCyhBsEKiKmgB9Unxf2RefvVJjAC0wfJ1bNLeNEo0jEfDEG/93ZTm5GySqP4yjIR5zg2u5c9RhxZRXjK0XdTrivWElePJ+3FUTb2gWvybPb7zJr8rW/N9sPPBdZQAbrR3spnxX8BrxuG2MVpgz7SHsp/qZLWHlmJEjxUL+MyHuJvnyyDnNpiKVBDHhwg+fRnayXpg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Up0wSDAHkhRmqFcGyDSp+qhX280uJumqrBc3TotBXR4=;
 b=RJex+B3obYX8oP5FPtYaxD5uMya2iDjZe0tsk7jLDF5x1qq52JkxSNG4RxhpeCy4KQV64AtpCL55dbEWDsFi8p8h2ZUVuA+dv8bEg9Yj1ohJ6oJvbvzXlFNaaXSHLmycAmbHQci4ePa2+Db+4RO2qyPoqbpLBd8HXyYEJsWkvq0YriGYk0qXb0iV45FPu4p1yzWezy9dRxmbK0B9+EZppqoTDTjQiMC8bXRMgE7s6oY6ir3osmqAgex7Ju4WqyQdOyG8FgvyJgjnCSYEuK/V4TyfRA0Ia0nxhv2tJ08kmR3rqFfIo7auawAnR/9NHLmKPSnuBKPxGH6FppOmddzdgw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com;
 dkim=pass header.d=citrix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Up0wSDAHkhRmqFcGyDSp+qhX280uJumqrBc3TotBXR4=;
 b=r1Mc1odquPGah6J77W9ZwSP9xFDUNOtP9LWLiLBHNRHVfhhg/B89NbpE6jUo01a0JKMySyOnTW6tcr9rUWB3LG0hK0226VuwkfuucUMgqCNzsxaOQXl0MSiPGduZN/yVv3LClURUnzrM5bNkUM/VLg54WgXu/Kf/vtk4YA5GJAs=
From: Owen Smith <owen.smith@citrix.com>
To: Troy Crosley <troycrosley@gmail.com>, "win-pv-devel@lists.xenproject.org"
 <win-pv-devel@lists.xenproject.org>
CC: "paul@xen.org" <paul@xen.org>, Ben Chalmers <ben.chalmers@citrix.com>
Subject: RE: [PATCH 3/3] Avoid unnecessary assertion.
Thread-Topic: [PATCH 3/3] Avoid unnecessary assertion.
Thread-Index: AQHWgIVFKID2vfzs2kKMiYayk5TdLqlXCC5A
Date: Thu, 3 Sep 2020 15:15:04 +0000
Message-ID: <BYAPR03MB4551EC65A11DEBC9EA9C7732FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
 <34f97492679c1f9d043b241ade59fe497fca2a8a.1598888060.git.troycrosley@gmail.com>
In-Reply-To: <34f97492679c1f9d043b241ade59fe497fca2a8a.1598888060.git.troycrosley@gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 6879c2a3-b940-4947-aa7c-08d8501c22be
x-ms-traffictypediagnostic: BYAPR03MB4296:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BYAPR03MB4296471B6B2F04A11B64FF1BFE2C0@BYAPR03MB4296.namprd03.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:454;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: l2hNqQR09cvWIvy4TcJwbhAdSUGvqlMRVwtgb/BZUvJVphHlEIAC+maqebSP04KtxN/t9EG6+Aze+le0DO+0Fes4uITxT7oDtXmXoVI7JxkxbRiUT7w05d+dYqbYwNu/pig4Vf8ZyBTKRnLjAsirKtwqdy50B4hZII1oJ8yQpmg/9yNGxX0YG9XugBr02uw6/t0lfU0dk+VOy31Z/7UPlY6e7i5yZF+BnfYDfcCPhCseo3w2+6TsB7bl0IpSt0NwA5gax801oPvhe4zUEkwOopO4mOn8x0+Fh4Sje1ms3D7RYPWN9EE1oEkPkLR5CQoiVuY2BqOtUZRVbgQ1OszJhA==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BYAPR03MB4551.namprd03.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(136003)(39860400002)(396003)(346002)(376002)(366004)(66946007)(76116006)(33656002)(66446008)(66556008)(64756008)(107886003)(83380400001)(52536014)(66476007)(26005)(71200400001)(86362001)(5660300002)(186003)(55016002)(6506007)(54906003)(8676002)(8936002)(53546011)(478600001)(44832011)(110136005)(9686003)(7696005)(4326008)(2906002)(316002);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: ASD/lXq7dg6Pvf5/K1/39J6BQxiQIryK1yvq8YLSUCKJ0DbrUC+6k+Or2OHe9qU00ntL3gQzNnOeG6RB9KGrS2u4dETsvLrKQg8gq8RCXetZFhtypNIsj0LPuGeH3zUMNjY40i91g3/e3OihK3FJmflVAQp9xDQYR1cav4OA+PQYMFapTAGEvQYyvaaUn7e0I1e9CEBSWSvf6ABcOCNyNgyaADL/2aSXNrHQlr8diJN8PsUXzw053uOmQOWH7po3RkNGUUTZ6Ct4YYcvUz4NEqvqgwQL4uXlCflbDxWC/qohsEeDv//Wbjqj+PzZMLEWL12Bq5pdXqhSasUQLL8NkBvWQZ/+CjdvJVRI2jPTQMOOTVYNRHC+m/kOVZiOLXJFx0xOXEZKh8G0rmvtuCarUmzPHU0cROMQHXSMg/lTvMtoLUxBhzw0bzF25S2gBXuWp4EKgInsA9lxZPTkrjMLoAPumDeXrjnJNzP6mJdeD3OQNJ4OMvO846u/mQxysmaAYVGXBGVKu8nmgew6bUvuFYq7z4rz0GysF8Jjk6Jwg6pGx6T4Ag9N69hH7Ws2AYkJc+0rGHh/sCJRSkUPbKSzvWD8dbko+OhAiXOiEU7fmqFs9hGD0Vsav+ebxdgGVpTbKCSZDM18HnJ+yYvGTQfcYw==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB4551.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 6879c2a3-b940-4947-aa7c-08d8501c22be
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2020 15:15:04.4292 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335836de-42ef-43a2-b145-348c2ee9ca5b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 9egy6WZ7XXsMX886NLo15XPW5CjVS+z/eIgv/A7zvisFh9fSdfmcJh/2d1GBzeEOPAlEP6ImcUTTz8HUPlsovw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4296
X-OriginatorOrg: citrix.com
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

Looks good,

Reviewed-by: Owen Smith <owen.smith@citrix.com>

> -----Original Message-----
> From: Troy Crosley <troycrosley@gmail.com>
> Sent: 01 September 2020 18:28
> To: win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> Subject: [PATCH 3/3] Avoid unnecessary assertion.
>=20
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments
> unless you have verified the sender and know the content is safe.
>=20
> Add the missing brackets to an if statement so that FdoS4ToS3() is not al=
ways
> called in __FdoSetSystemPowerUp().
>=20
> Signed-off-by: Troy Crosley <troycrosley@gmail.com>
> ---
>  src/xeniface/fdo.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>=20
> diff --git a/src/xeniface/fdo.c b/src/xeniface/fdo.c index 1f859cd..6aabf=
96
> 100644
> --- a/src/xeniface/fdo.c
> +++ b/src/xeniface/fdo.c
> @@ -1740,9 +1740,10 @@ __FdoSetSystemPowerUp(
>          goto done;
>=20
>      if (SystemState < PowerSystemHibernate &&
> -        __FdoGetSystemPowerState(Fdo) >=3D PowerSystemHibernate)
> +        __FdoGetSystemPowerState(Fdo) >=3D PowerSystemHibernate) {
>          __FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
>          FdoS4ToS3(Fdo);
> +    }
>=20
>      Info("%s -> %s\n",
>           PowerSystemStateName(__FdoGetSystemPowerState(Fdo)),
> --
> 2.20.1
>=20



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 03 17:04:14 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Sep 2020 17:04:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kDseg-0000od-Ui; Thu, 03 Sep 2020 17:04:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=mEhm=CM=gmail.com=xadimgnik@srs-us1.protection.inumbo.net>)
 id 1kDsef-0000oY-M8
 for win-pv-devel@lists.xenproject.org; Thu, 03 Sep 2020 17:04:09 +0000
X-Inumbo-ID: 2662b49c-0049-4cd8-b83d-ed0005093a1f
Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2662b49c-0049-4cd8-b83d-ed0005093a1f;
 Thu, 03 Sep 2020 17:04:07 +0000 (UTC)
Received: by mail-wm1-x342.google.com with SMTP id e11so5778805wme.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 03 Sep 2020 10:04:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id
 :mime-version:content-transfer-encoding:thread-index
 :content-language;
 bh=RtuEem2NPE8hNgePZXD6fqjW7nONChe8DL2PHqYLQmk=;
 b=uEnFgGbmuzDUCxoRX4u4UIJ1KlZvAGxH81gbjxnPIGi5v06zwbGHKSpqsc5P2Mgbnl
 HltkfMxR0AOdQYdtEZ5v0cajVDOcf04jPfKf2bowovrRz45c0cr/k+Wgcu8/As/Marhi
 x6danVwNN9b04SiwPrd0Lasi+JATf4X5Vhtqk/sCUASjjur+BZGvwMXM02sr+bx3Dgxc
 EnNGt9V+RI4xgkDiKENuflHq2zPOTrQAHAbdCgVeiBXyYK6ozKnOF0j/FrbvTW7wK4OH
 g7EM3NgQ374p8H0DwCGWVW9uUKzewA+gqAOpiGgh7xwew0i+yi+0YwWO3pvA+DhTBF1X
 DQIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to
 :subject:date:message-id:mime-version:content-transfer-encoding
 :thread-index:content-language;
 bh=RtuEem2NPE8hNgePZXD6fqjW7nONChe8DL2PHqYLQmk=;
 b=JVAqOVkDJVy8ynPi62GwtrtC98pSenjYHSkHvX8ZYoWXrO2LJxV7NyI59tIgoVzg3M
 8kfaefxzizFxOXO3sOsdNMBt/VPL1AuCGcLRKmYQ0zMopN+dfmTyBctpH0ZPRuNsHAN4
 /Fw+eWBRcwChJpprfuApbl0PxIdBNrGxv7IknTWWazr/00G5WKpPlEb9+94+wcJFMX6r
 jK4rzL3S74M0oHsCt2OTvihFTFBgk/NLUdD2G0PYMZgkfhC3SH89MYXDNqYiIBa1JvtN
 6TrH6knR+/xptT0jHNgw3bkUN/PEp87312MjiVaiOes0bvQCM8ETX0j7/RJRRDOg05Zf
 aoFA==
X-Gm-Message-State: AOAM5309FDU+tm4Zb/J4rWQeTC4VjJH8g2BFj+l3Ud3NGd14T2R0+h+y
 Lq8ewfnPferC/GzevcTvMR4=
X-Google-Smtp-Source: ABdhPJyTCjwvByzyo4+QFXAM1OaIQweHp2mkuwfqtD33+oOnNPJ41+5n2t9SWQSsepYzGhoWSGgHRA==
X-Received: by 2002:a7b:c24a:: with SMTP id b10mr3292260wmj.149.1599152646986; 
 Thu, 03 Sep 2020 10:04:06 -0700 (PDT)
Received: from CBGR90WXYV0 ([2a00:23c5:5785:9a01:4c49:1021:43cd:65b7])
 by smtp.gmail.com with ESMTPSA id m8sm5345689wro.75.2020.09.03.10.04.05
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 03 Sep 2020 10:04:06 -0700 (PDT)
From: Paul Durrant <xadimgnik@gmail.com>
X-Google-Original-From: "Paul Durrant" <paul@xen.org>
To: "'Troy Crosley'" <troycrosley@gmail.com>,
 <win-pv-devel@lists.xenproject.org>
Cc: <ben.chalmers@citrix.com>,
	<owen.smith@citrix.com>
References: <4a93f4861d4139c6d91ca0921298f69e4428984f.1599144402.git.troycrosley@gmail.com>
In-Reply-To: <4a93f4861d4139c6d91ca0921298f69e4428984f.1599144402.git.troycrosley@gmail.com>
Subject: RE: [PATCH] Clear rather than remove control/feature-XXX keys.
Date: Thu, 3 Sep 2020 18:04:05 +0100
Message-ID: <000801d68214$3b9a8ef0$b2cfacd0$@xen.org>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQJL7HEn+yr6i0noU4pl5xP2T0UjB6hsTz+g
Content-Language: en-gb
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Reply-To: paul@xen.org
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

> -----Original Message-----
> From: Troy Crosley <troycrosley@gmail.com>
> Sent: 03 September 2020 15:54
> To: win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; ben.chalmers@citrix.com; owen.smith@citrix.com; Troy Crosley <troycrosley@gmail.com>
> Subject: [PATCH] Clear rather than remove control/feature-XXX keys.
> 
> These keys should stick around when disabled since they're present at
> boot. This also fixes an issue where the keys are unable to be written
> on wake from S3 or S4.

Good catch... the remove is a XenServer-ism that should indeed go away.

Reviewed-by: Paul Durrant <paul@xen.org>

> 
> Signed-off-by: Troy Crosley <troycrosley@gmail.com>
> ---
>  src/xenagent/service.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
> index 3630240..e71059c 100644
> --- a/src/xenagent/service.cpp
> +++ b/src/xenagent/service.cpp
> @@ -331,10 +331,10 @@ void CXenIfaceCreator::StopShutdownWatch()
>      if (!m_ctxt_shutdown)
>          return;
> 
> -    m_device->StoreRemove("control/feature-poweroff");
> -    m_device->StoreRemove("control/feature-reboot");
> -    m_device->StoreRemove("control/feature-s3");
> -    m_device->StoreRemove("control/feature-s4");
> +    m_device->StoreWrite("control/feature-poweroff", "");
> +    m_device->StoreWrite("control/feature-reboot", "");
> +    m_device->StoreWrite("control/feature-s3", "");
> +    m_device->StoreWrite("control/feature-s4", "");
> 
>      m_device->StoreRemoveWatch(m_ctxt_shutdown);
>      m_ctxt_shutdown = NULL;
> --
> 2.20.1




From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 08:03:21 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 08:03:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kE6go-0002Lh-Ok; Fri, 04 Sep 2020 08:03:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=6qam=CN=gmail.com=xadimgnik@srs-us1.protection.inumbo.net>)
 id 1kE6gn-0002Lb-MJ
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 08:03:17 +0000
X-Inumbo-ID: 2bd6d1c5-1686-4855-851c-10ac8ef3b4ff
Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2bd6d1c5-1686-4855-851c-10ac8ef3b4ff;
 Fri, 04 Sep 2020 08:03:16 +0000 (UTC)
Received: by mail-wm1-x344.google.com with SMTP id u18so5184751wmc.3
 for <win-pv-devel@lists.xenproject.org>; Fri, 04 Sep 2020 01:03:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id
 :mime-version:content-transfer-encoding:thread-index
 :content-language;
 bh=Mb48JiCqCYSrYJiT1ubOkbKbCDXpnGk30k5Y67Ic+Dk=;
 b=dnd+YGlwIG6H7AflAUZOarkGXZMCaEv0Yc4wSEW3ls6tVi1R9xHXAuLw+3ZvmjtrAv
 sVFvvRySHZ3JuhSZ3vqkafAo1On6N+EIpkFBq1+I0tblq1CF50BUzEklj76Zdin/ELBf
 lqKI/Px4ZLV/C3rGasZGGntJbvhDCRzczV0mU8KousZLeNr9qXX7+7GOadjaCydmxjua
 2yVshjehnbu5K8rlzW+lkx317sQZPkdrPVwS7OLdLl24U04QOi0e33vyyniEKoeoUhuI
 xPlSumasJ/2ZwDaglkJoMGiiXWMCWOArr25Auyvvua0MK7Er3rbES+QeUbEd75MJJ/9q
 ++jw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to
 :subject:date:message-id:mime-version:content-transfer-encoding
 :thread-index:content-language;
 bh=Mb48JiCqCYSrYJiT1ubOkbKbCDXpnGk30k5Y67Ic+Dk=;
 b=pIxare+ZVveArjuvU5NAHF0H/qskU72YyeRdICcPPbg4y6sXPFXe14bjE2grt/vYL0
 VkQijHqHzCI8Jd6uwYFv0aFMb6d2i6E6Gjzw5lGZuQPHMpoMR/qtUA22Xx6Jy2LzZ6cv
 5HgJaec9+RRsiXEwsqlwe5PFDy6dYNfDpqkHWOmrBXCURJk+Rj6A2sEcDeTYxbdvqbpR
 lcaXy8j70oVgjxQhzAxlTO8L3e0Wn8aPLtCI582kfKpAZIBzFwJ/eGsRKL8k7HacQZoQ
 gd425JBt+LSANvvCDUP63/1gNpGvoGevk/gZI+t9BQedR5WTD4GzXpuOjW2/Kh0ERVHd
 Q9Lw==
X-Gm-Message-State: AOAM532pudX7SB+zs0N8p73diY3pJjJqPV9r6c1XeH93MKF2/dJJMZmJ
 mPQB1neYN1GNFQWcc+CNAFk=
X-Google-Smtp-Source: ABdhPJwc3pw5Cx76COGuWDat1PaLePiIJvnanfsdYgQ3RI1WPYQ+arjn16nmILH7DqTDTcQEVyCuQQ==
X-Received: by 2002:a1c:ba0b:: with SMTP id k11mr5881261wmf.20.1599206595945; 
 Fri, 04 Sep 2020 01:03:15 -0700 (PDT)
Received: from CBGR90WXYV0 ([2a00:23c5:5785:9a01:4c49:1021:43cd:65b7])
 by smtp.gmail.com with ESMTPSA id w21sm9809149wmk.34.2020.09.04.01.03.15
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 04 Sep 2020 01:03:15 -0700 (PDT)
From: Paul Durrant <xadimgnik@gmail.com>
X-Google-Original-From: "Paul Durrant" <paul@xen.org>
To: "'Owen Smith'" <owen.smith@citrix.com>,
 "'Troy Crosley'" <troycrosley@gmail.com>,
 <win-pv-devel@lists.xenproject.org>
Cc: "'Ben Chalmers'" <ben.chalmers@citrix.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
 <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
 <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
In-Reply-To: <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
Date: Fri, 4 Sep 2020 09:03:16 +0100
Message-ID: <001601d68291$d8bcd0d0$8a367270$@xen.org>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQL9i42HMb/8RNQi8QIkX4vj/V099wGpSFA0Asxd9tem5l0XoA==
Content-Language: en-gb
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Reply-To: paul@xen.org
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

> -----Original Message-----
> From: Owen Smith <owen.smith@citrix.com>
> Sent: 03 September 2020 16:07
> To: Troy Crosley <troycrosley@gmail.com>; win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>
> Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> 
> 
> 
> > -----Original Message-----
> > From: Troy Crosley <troycrosley@gmail.com>
> > Sent: 01 September 2020 18:28
> > To: win-pv-devel@lists.xenproject.org
> > Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> > <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> > Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> >
> > [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments
> > unless you have verified the sender and know the content is safe.
> >
> > 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>
> > ---
> >  src/xenagent/service.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index
> > 4d62e09..e595093 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 (TryEnterCriticalSection(&m_crit) && m_device) {
> 
> If the TryEnterCriticalSection succeeds, but m_device is null, doesn't this leave the critical section
> held?

It does appear that way. I think it is sufficient to re-order the if clause such that m_device is evaluated first. I'll fix on
commit.

  Paul


> 
> >          m_device->Log(message);
> > +        LeaveCriticalSection(&m_crit);
> >      }
> >  }
> >
> > --
> > 2.20.1
> >




From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 08:13:05 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 08:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kE6qG-0003JZ-HI; Fri, 04 Sep 2020 08:13:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=6qam=CN=gmail.com=xadimgnik@srs-us1.protection.inumbo.net>)
 id 1kE6qF-0003JU-0q
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 08:13:03 +0000
X-Inumbo-ID: b370b3a2-f220-4750-8b3f-e470e83e0369
Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b370b3a2-f220-4750-8b3f-e470e83e0369;
 Fri, 04 Sep 2020 08:13:02 +0000 (UTC)
Received: by mail-wm1-x341.google.com with SMTP id s13so5202006wmh.4
 for <win-pv-devel@lists.xenproject.org>; Fri, 04 Sep 2020 01:13:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id
 :mime-version:content-transfer-encoding:thread-index
 :content-language;
 bh=v70e+ME8A23+hryl/PjxIRO3e/fH+kDeC6JGjC7sJLw=;
 b=Bd7+0AYRZLNQul6MTtLZ3qM9qGyqotK3wNwTv69gj0jn0bYKcrEOmoDOTfgOUtT/iA
 Z1Dfy9wHMe8HQXm39Uy3DdKD/h6AWr2C81IyYHkxhGy0L+OBm1948/Ce6bfxogyVVuaE
 6DxHFIN++kzXE/Pep5DO4W/E/aeNZ7EaZvBJ1osUbklIoOREMvRAq49ordN/ruZyxQhD
 8vvX1vXdH9ww+CCDIP0PjAcVEkgVdM1CNrtrPr+b6v2GyCilfo1nXmCrtfPYLs5V1qVq
 mqUeYN2M4BKMna9SlhF12Z0/e22TpWpywNHqWdcc5UDgWvhFVv1yYSfkvs0i3tr7LZZF
 T3IA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to
 :subject:date:message-id:mime-version:content-transfer-encoding
 :thread-index:content-language;
 bh=v70e+ME8A23+hryl/PjxIRO3e/fH+kDeC6JGjC7sJLw=;
 b=aK54alqe3HJVWiqHNsb1ZFcLnEWc3lxSzeqx3KvrF6BKnyjFrHIoHqeqmHq5UnL0C+
 J7lIyl7CGkGSItfVo50yxQScTH4m8maQSHq1l31ga/Sm0NNshhGX8UuzNsBQSeTSpI2C
 RfuCVDMFVk5JqWhVn0YLpHoCr5d/bc3cb0PhQVpPOb58eamYh8Zn2/st3PELrsjtWqqm
 7XoD/WIg/9Y18KSkoNWcJosSzg6V3uaGJsT2omXNxw++cIwQ6PQd51pPV1/PhZ5U7P8j
 GGSBItvUznsGs2TAEaWVQ6Uf/JVTfK/SdLm1yY25aRS2HSLssC3U1QxTQKdLQjZOZX4x
 8zIg==
X-Gm-Message-State: AOAM533BMOVNkK8enzPEnq7bpsdtSF+gCg346XQp9z+9sJ9gX/jt45dr
 BMJLTHMBsv9bXYdVialSBlE=
X-Google-Smtp-Source: ABdhPJwgoRunERKL6ElQdbHpYlpKH4B8DfXeIkxMltm9sKNB1uGMNjgNceCM7SZcIwqbPLZk2s3zRg==
X-Received: by 2002:a05:600c:2054:: with SMTP id
 p20mr6192621wmg.173.1599207181177; 
 Fri, 04 Sep 2020 01:13:01 -0700 (PDT)
Received: from CBGR90WXYV0 ([2a00:23c5:5785:9a01:4c49:1021:43cd:65b7])
 by smtp.gmail.com with ESMTPSA id 91sm10904901wrq.9.2020.09.04.01.13.00
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 04 Sep 2020 01:13:00 -0700 (PDT)
From: Paul Durrant <xadimgnik@gmail.com>
X-Google-Original-From: "Paul Durrant" <paul@xen.org>
To: "'Owen Smith'" <owen.smith@citrix.com>,
 "'Troy Crosley'" <troycrosley@gmail.com>,
 <win-pv-devel@lists.xenproject.org>
Cc: "'Ben Chalmers'" <ben.chalmers@citrix.com>
References: <cover.1598888060.git.troycrosley@gmail.com>
 <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
 <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
In-Reply-To: <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
Date: Fri, 4 Sep 2020 09:13:01 +0100
Message-ID: <001701d68293$35a8b2e0$a0fa18a0$@xen.org>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQL9i42HMb/8RNQi8QIkX4vj/V099wGpSFA0Asxd9tcB7Zp5UQ==
Content-Language: en-gb
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Reply-To: paul@xen.org
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

> -----Original Message-----
> From: Owen Smith <owen.smith@citrix.com>
> Sent: 03 September 2020 16:07
> To: Troy Crosley <troycrosley@gmail.com>;
win-pv-devel@lists.xenproject.org
> Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>
> Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> 
> 
> 
> > -----Original Message-----
> > From: Troy Crosley <troycrosley@gmail.com>
> > Sent: 01 September 2020 18:28
> > To: win-pv-devel@lists.xenproject.org
> > Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> > <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> > Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> >
> > [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open
attachments
> > unless you have verified the sender and know the content is safe.
> >
> > 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>
> > ---
> >  src/xenagent/service.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index
> > 4d62e09..e595093 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 (TryEnterCriticalSection(&m_crit) && m_device) {
> 
> If the TryEnterCriticalSection succeeds, but m_device is null, doesn't
this leave the critical section
> held?

It does appear that way. I think it is sufficient to re-order the if
clause such that m_device is evaluated first. I'll fix on commit.

  Paul


> 
> >          m_device->Log(message);
> > +        LeaveCriticalSection(&m_crit);
> >      }
> >  }
> >
> > --
> > 2.20.1
> >




From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 08:30:22 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 08:30:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kE76z-0005TI-Qm; Fri, 04 Sep 2020 08:30:21 +0000
Received: from winpvdrvbuild.xenproject.org ([162.242.160.44])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <paul.durrant@xenproject.org>) id 1kE76y-0005TC-G0
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 08:30:20 +0000
Date: Fri, 4 Sep 2020 08:30:23 +0000 (UTC)
From: paul.durrant@xenproject.org
To: win-pv-devel@lists.xenproject.org
Message-ID: <12838710.1.1599208225131.JavaMail.WINPVDRVBUILD$@winpvdrvbuild>
Subject: XENVBD-master - Build #148 - Successful
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_0_19673360.1599208224272"
X-Jenkins-Job: XENVBD-master
X-Jenkins-Result: SUCCESS
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

------=_Part_0_19673360.1599208224272
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

The build system has completed build #148.

Check console output at https://winpvdrvbuild.xenproject.org:8080/job/XENVBD-master/148/console to view the results.
------=_Part_0_19673360.1599208224272--


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 09:08:09 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 09:08:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kE7hX-0001An-BU; Fri, 04 Sep 2020 09:08:07 +0000
Received: from winpvdrvbuild.xenproject.org ([162.242.160.44])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <paul.durrant@xenproject.org>) id 1kE7hV-0001Ai-NK
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 09:08:05 +0000
Date: Fri, 4 Sep 2020 09:08:09 +0000 (UTC)
From: paul.durrant@xenproject.org
To: win-pv-devel@lists.xenproject.org
Message-ID: <10514641.3.1599210490164.JavaMail.WINPVDRVBUILD$@winpvdrvbuild>
Subject: XENIFACE-master - Build #99 - Successful
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_2_32647271.1599210489929"
X-Jenkins-Job: XENIFACE-master
X-Jenkins-Result: SUCCESS
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

------=_Part_2_32647271.1599210489929
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

The build system has completed build #99.

Check console output at https://winpvdrvbuild.xenproject.org:8080/job/XENIFACE-master/99/console to view the results.
------=_Part_2_32647271.1599210489929--


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 11:22:51 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 11:22:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kE9nt-00081Z-4Y; Fri, 04 Sep 2020 11:22:49 +0000
Received: from winpvdrvbuild.xenproject.org ([162.242.160.44])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <paul.durrant@xenproject.org>) id 1kE9ns-00081T-DN
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 11:22:48 +0000
Date: Fri, 4 Sep 2020 11:22:52 +0000 (UTC)
From: paul.durrant@xenproject.org
To: win-pv-devel@lists.xenproject.org
Message-ID: <18870197.5.1599218572934.JavaMail.WINPVDRVBUILD$@winpvdrvbuild>
Subject: XENIFACE-master - Build #100 - Successful
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_4_23687859.1599218572762"
X-Jenkins-Job: XENIFACE-master
X-Jenkins-Result: SUCCESS
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

------=_Part_4_23687859.1599218572762
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

The build system has completed build #100.

Check console output at https://winpvdrvbuild.xenproject.org:8080/job/XENIFACE-master/100/console to view the results.
------=_Part_4_23687859.1599218572762--


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 04 11:51:28 2020
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Sep 2020 11:51:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1kEAFb-0002XW-94; Fri, 04 Sep 2020 11:51:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=nuvW=CN=gmail.com=troycrosley@srs-us1.protection.inumbo.net>)
 id 1kEAFa-0002XQ-8v
 for win-pv-devel@lists.xenproject.org; Fri, 04 Sep 2020 11:51:26 +0000
X-Inumbo-ID: 43637f88-054c-4247-9f43-e2ee24dba2b1
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 43637f88-054c-4247-9f43-e2ee24dba2b1;
 Fri, 04 Sep 2020 11:51:25 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id b12so5771446edz.11
 for <win-pv-devel@lists.xenproject.org>; Fri, 04 Sep 2020 04:51:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=5IOJD8l4qFjxT2oCE8R+FgrAGhHHz6pu3hEHLuLdqIs=;
 b=V63dp0053/Ypa0UAkeFplSZdK0ePJvNXmXF7S9MctwnBy8PO2lCbIJzJoA/tb3x7pD
 LuJFaPIX+Co5Wlk8VgCN2Tz+C3Rx2p4DUB77BpCZ+u8DdtjVUuNHHtD9bvf2xUg42rEu
 KKa95Yz3QA3ay4SUlzkGo32VOPDDrZ5VgPPJ4H6PNs65MdJaxg0+gj93nU9htpGUSWO3
 /fA4zi45ypVBgwCXlq4kImyDzPZ8EdeggR13FLfRKKwyVoY5MdNGO+TO4x7Z9tnwHsJ0
 QuOT+8FxVHbQhesYqQJ+sqbW7IAYXjlUk3DCrTxLTWNaKniZ3p5UYdcmwD3jJRazs5Mp
 /dxw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=5IOJD8l4qFjxT2oCE8R+FgrAGhHHz6pu3hEHLuLdqIs=;
 b=Q4zHrMP8Nn8NR+oYzghdOkAQs39LUwELzc4mhr7A+YbeD5Vif3oIz+uFI+rpUXl17h
 gMdgLqLWIzGps4tLsBxvNEnKDvSt4OglGlbBTlyNek5Oka4yCe8uzwyz0F8+H6pNdoH8
 pUfZlIZxt2BH/qvJcHuRP6PPxCQldtapBm21Qjc+gPFbIPuLMUk8mOyrrjZ4y/zllSAZ
 sq/sedH5c4QWcbc0NwpsHs8nJ9qfSfB5bOLWjV6i5T46K/5aOkkcNQbtVciEhUYbzaQf
 i3KAt8xnGBmrzkFgdZbTLPoEDn7328lVUoBGZJpnBOG3xCwXDgHVv6LyGqZJ7CYeOMUq
 PtmA==
X-Gm-Message-State: AOAM531Av8Ukk4Dom0VpdcUKdOvlwmA2A8FUXzoJkOISc08G9M4yimrB
 dwlLK4LrFybwM47iQuykht0FPExzyBUHPYSzJ1o=
X-Google-Smtp-Source: ABdhPJxncNoKB+xJYfCdTMQCOAH3GqTWT2UogInbGPOYBP1jMcg7IMFQUZgL5cPpdPJRkYsjX6m9n4pcs9omBOv1FCU=
X-Received: by 2002:aa7:dd16:: with SMTP id i22mr8173022edv.335.1599220284266; 
 Fri, 04 Sep 2020 04:51:24 -0700 (PDT)
MIME-Version: 1.0
References: <cover.1598888060.git.troycrosley@gmail.com>
 <3bcbbdbebfe860a72576a4d87443f942b8a593d5.1598888060.git.troycrosley@gmail.com>
 <BYAPR03MB4551627AE933D25A28E41852FE2C0@BYAPR03MB4551.namprd03.prod.outlook.com>
 <001701d68293$35a8b2e0$a0fa18a0$@xen.org>
In-Reply-To: <001701d68293$35a8b2e0$a0fa18a0$@xen.org>
From: Troy Crosley <troycrosley@gmail.com>
Date: Fri, 4 Sep 2020 07:51:15 -0400
Message-ID: <CAOBjErJECC8=B-WfMRE2i=grZ+=zBH9EusbGVKgtTwjLbXLBEA@mail.gmail.com>
Subject: Re: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
To: paul@xen.org
Cc: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org, 
 Ben Chalmers <ben.chalmers@citrix.com>
Content-Type: multipart/alternative; boundary="000000000000f61d7205ae7b7c31"
X-BeenThere: win-pv-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Developer list for the Windows PV Drivers subproject
 <win-pv-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:win-pv-devel@lists.xenproject.org>
List-Help: <mailto:win-pv-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/win-pv-devel>, 
 <mailto:win-pv-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: win-pv-devel-bounces@lists.xenproject.org
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>

--000000000000f61d7205ae7b7c31
Content-Type: text/plain; charset="UTF-8"

Yes, good catch.

On Fri, Sep 4, 2020 at 4:13 AM Paul Durrant <xadimgnik@gmail.com> wrote:

> > -----Original Message-----
> > From: Owen Smith <owen.smith@citrix.com>
> > Sent: 03 September 2020 16:07
> > To: Troy Crosley <troycrosley@gmail.com>;
> win-pv-devel@lists.xenproject.org
> > Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>
> > Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> >
> >
> >
> > > -----Original Message-----
> > > From: Troy Crosley <troycrosley@gmail.com>
> > > Sent: 01 September 2020 18:28
> > > To: win-pv-devel@lists.xenproject.org
> > > Cc: paul@xen.org; Ben Chalmers <ben.chalmers@citrix.com>; Owen Smith
> > > <owen.smith@citrix.com>; Troy Crosley <troycrosley@gmail.com>
> > > Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transition.
> > >
> > > [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open
> attachments
> > > unless you have verified the sender and know the content is safe.
> > >
> > > 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>
> > > ---
> > >  src/xenagent/service.cpp | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index
> > > 4d62e09..e595093 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 (TryEnterCriticalSection(&m_crit) && m_device) {
> >
> > If the TryEnterCriticalSection succeeds, but m_device is null, doesn't
> this leave the critical section
> > held?
>
> It does appear that way. I think it is sufficient to re-order the if
> clause such that m_device is evaluated first. I'll fix on commit.
>
>   Paul
>
>
> >
> > >          m_device->Log(message);
> > > +        LeaveCriticalSection(&m_crit);
> > >      }
> > >  }
> > >
> > > --
> > > 2.20.1
> > >
>
>
>

--000000000000f61d7205ae7b7c31
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes, good catch.</div><br><div class=3D"gmail_quote"><div =
dir=3D"ltr" class=3D"gmail_attr">On Fri, Sep 4, 2020 at 4:13 AM Paul Durran=
t &lt;<a href=3D"mailto:xadimgnik@gmail.com">xadimgnik@gmail.com</a>&gt; wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt; -----O=
riginal Message-----<br>
&gt; From: Owen Smith &lt;<a href=3D"mailto:owen.smith@citrix.com" target=
=3D"_blank">owen.smith@citrix.com</a>&gt;<br>
&gt; Sent: 03 September 2020 16:07<br>
&gt; To: Troy Crosley &lt;<a href=3D"mailto:troycrosley@gmail.com" target=
=3D"_blank">troycrosley@gmail.com</a>&gt;;<br>
<a href=3D"mailto:win-pv-devel@lists.xenproject.org" target=3D"_blank">win-=
pv-devel@lists.xenproject.org</a><br>
&gt; Cc: <a href=3D"mailto:paul@xen.org" target=3D"_blank">paul@xen.org</a>=
; Ben Chalmers &lt;<a href=3D"mailto:ben.chalmers@citrix.com" target=3D"_bl=
ank">ben.chalmers@citrix.com</a>&gt;<br>
&gt; Subject: RE: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transitio=
n.<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; &gt; -----Original Message-----<br>
&gt; &gt; From: Troy Crosley &lt;<a href=3D"mailto:troycrosley@gmail.com" t=
arget=3D"_blank">troycrosley@gmail.com</a>&gt;<br>
&gt; &gt; Sent: 01 September 2020 18:28<br>
&gt; &gt; To: <a href=3D"mailto:win-pv-devel@lists.xenproject.org" target=
=3D"_blank">win-pv-devel@lists.xenproject.org</a><br>
&gt; &gt; Cc: <a href=3D"mailto:paul@xen.org" target=3D"_blank">paul@xen.or=
g</a>; Ben Chalmers &lt;<a href=3D"mailto:ben.chalmers@citrix.com" target=
=3D"_blank">ben.chalmers@citrix.com</a>&gt;; Owen Smith<br>
&gt; &gt; &lt;<a href=3D"mailto:owen.smith@citrix.com" target=3D"_blank">ow=
en.smith@citrix.com</a>&gt;; Troy Crosley &lt;<a href=3D"mailto:troycrosley=
@gmail.com" target=3D"_blank">troycrosley@gmail.com</a>&gt;<br>
&gt; &gt; Subject: [PATCH 1/3] Prevent a xenagent timeout on S3/S4 transiti=
on.<br>
&gt; &gt;<br>
&gt; &gt; [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open<br>
attachments<br>
&gt; &gt; unless you have verified the sender and know the content is safe.=
<br>
&gt; &gt;<br>
&gt; &gt; Prevent a xenagent timeout (and live kernel dump) on S3/S4 transi=
tion<br>
by<br>
&gt; &gt; changing CXenIfaceCreator::Log to use TryEnterCriticalSection.<br=
>
&gt; &gt; Otherwise, a timeout occurs when the service control handler fail=
s to<br>
return due<br>
&gt; &gt; to attempting to enter a critical section object that the main se=
rvice<br>
thread<br>
&gt; &gt; already owns while responding to the control/shutdown xenstore wa=
tch.<br>
&gt; &gt;<br>
&gt; &gt; Signed-off-by: Troy Crosley &lt;<a href=3D"mailto:troycrosley@gma=
il.com" target=3D"_blank">troycrosley@gmail.com</a>&gt;<br>
&gt; &gt; ---<br>
&gt; &gt;=C2=A0 src/xenagent/service.cpp | 4 ++--<br>
&gt; &gt;=C2=A0 1 file changed, 2 insertions(+), 2 deletions(-)<br>
&gt; &gt;<br>
&gt; &gt; diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp =
index<br>
&gt; &gt; 4d62e09..e595093 100644<br>
&gt; &gt; --- a/src/xenagent/service.cpp<br>
&gt; &gt; +++ b/src/xenagent/service.cpp<br>
&gt; &gt; @@ -107,9 +107,9 @@ void CXenIfaceCreator::OnPowerEvent(DWORD evt=
,<br>
&gt; &gt; LPVOID data)=C2=A0 void CXenIfaceCreator::Log(const char* message=
)=C2=A0 {<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 // if possible, send to xeniface to forward t=
o logs<br>
&gt; &gt; -=C2=A0 =C2=A0 CCritSec crit(&amp;m_crit);<br>
&gt; &gt; -=C2=A0 =C2=A0 if (m_device) {<br>
&gt; &gt; +=C2=A0 =C2=A0 if (TryEnterCriticalSection(&amp;m_crit) &amp;&amp=
; m_device) {<br>
&gt; <br>
&gt; If the TryEnterCriticalSection succeeds, but m_device is null, doesn&#=
39;t<br>
this leave the critical section<br>
&gt; held?<br>
<br>
It does appear that way. I think it is sufficient to re-order the if<br>
clause such that m_device is evaluated first. I&#39;ll fix on commit.<br>
<br>
=C2=A0 Paul<br>
<br>
<br>
&gt; <br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 m_device-&gt;Log(message);<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 LeaveCriticalSection(&amp;m_crit);<b=
r>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 }<br>
&gt; &gt;=C2=A0 }<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; 2.20.1<br>
&gt; &gt;<br>
<br>
<br>
</blockquote></div>

--000000000000f61d7205ae7b7c31--


