From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 12:44:43 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2026 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1404742.1638424 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x1Nr0-0006do-BB; Tue, 01 Sep 2026 12:44:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1404742.1638424; Tue, 01 Sep 2026 12:44:42 +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 1x1Nr0-0006dh-8N; Tue, 01 Sep 2026 12:44:42 +0000
Received: by outflank-mailman (input) for mailman id 1404742;
 Tue, 01 Sep 2026 12:44:40 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x1Nqy-0006dV-K5
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 12:44:40 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x1Nqx-00H3vL-1c
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 14:44:39 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a96c8aa-bab6-0a2a0a5309dd-0a2a450ce4a6-24
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:44:38 +0200
Received: from [52.101.193.23]
 (helo=CH1PR05CU001.outbound.protection.outlook.com)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a96c8b5-f479-0a2a450c0019-3465c117be92-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:44:38 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by SA1PR03MB7099.namprd03.prod.outlook.com (2603:10b6:806:330::16)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.8; Tue, 1 Sep 2026
 12:44:33 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%3]) with mapi id 15.21.0360.008; Tue, 1 Sep 2026
 12:44:33 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=Fn+Li2iz/IQXsKMPxqE2Ip68vEGROUfCXxrJCTzt8gNuzsmYbunW7ohNhFMLzCMkbJzbJbIYXD7iExmAMC+yB/CV83IdYTKjpNox+xRfRye4NbyYfUVsNT8sFDE5iOh/TgFI1UcUZFmC5riEa4GcuyXfq9+J8Rr11bbP/tGAc3nRlkzKbdL+pszOqG/La9jqwPSyGS7M29e6uijnNvP8FdEuKAPmpToIe2aaix7uExUrDjxB9Lfzp0mblc4eENOXiiofZUxUMA3jz3drecjuJuidR12erSjeWe2k5ck2WfwyFuQtFh0Vz3x4idpkISqAE8TdJ7pM17NGXdP+Bpy1Dg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=A2IQFdZvJjO3VBmJlF0CtLdgQVCgfOwFV/dhMEzFAvY=;
 b=Kd4/Kewn9ABN5DvG7NJIQ/pNqFtv/djvyCv3x5zgoZsXLecYYg8mB/HVAmiSfmSz/m1JICCuUPILhSgs3OeEy+niDwfcEvk2rda85I+Hj4ESf2E1rUUuBl3kNWcP4CcqxI0MKQ68oDG6LCkND477Jf3Grp2rwZ7Kvz9LJmuk85u9nT2F8N+vMmeZBD3R1T5LLydeVTSo5fD4pT3GyYAVh/MHwLguHlPODGYE0528fA4fZdPM/tQ2Q8K1R3NOFwwzcx2QEUCUTUnFa7Ld1rVVBqvBinHXTYfy1BAncYyCkwh3K4l7T9udzXp4INdwiS+Bl76Jv5pIY4dUoEee/1SvJQ==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=A2IQFdZvJjO3VBmJlF0CtLdgQVCgfOwFV/dhMEzFAvY=;
 b=w6r6wZFljcle8yBak6lGPEkm7Kxr9JSMOwHGuutnsMnhdrjDof7WZR3zJsWcG8Yii3tnhcKUjeDtZ/8Fuq5/yCgQ/+4XnudyAS2boljp0mbS1pDij4sH+g9HQTs2R9M/47i3+mbo/KYf/O/uIcq5j4cD/eZgoEMJPYIXF/3FiKk=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH] Force close the frontend if responses have been faked
Thread-Topic: [PATCH] Force close the frontend if responses have been faked
Thread-Index: AQHdNTyfZIXDK1WOkEu7D5/Lvf8MOLa5tLrg
Date: Tue, 1 Sep 2026 12:44:33 +0000
Message-ID:
 <SA6PR03MB776032541821FD9768EA4A8AFEA82@SA6PR03MB7760.namprd03.prod.outlook.com>
References:
 <1787736170.8631fc262581453bbf619ec5b2062170.1a03d612005000c4f3@vates.tech>
 <1787736220.8631fc262581453bbf619ec5b2062170.1a03d61e299000c4f3@vates.tech>
In-Reply-To:
 <1787736220.8631fc262581453bbf619ec5b2062170.1a03d61e299000c4f3@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|SA1PR03MB7099:EE_
x-ms-office365-filtering-correlation-id: cf5830ae-3af5-4de9-9165-08df0826c622
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|23010399003|1800799024|376014|366016|56012099006|11063799006|10067099003|22082099003|4143699003|18002099003|38070700021;
x-microsoft-antispam-message-info:
 /1Ze2+ZIYBoBIf6pQUPM7EssqoaH2AJmF2L8yr1jhNJYRcAAeSYwsJIGRzrZUns0PsplC5+rGOTO0bN5K1trjqe8Q+zv3u5E5voTbY4ob66UaX4OlMv1O2blTm5H63aNbsrmfi59ZB0BOY75W4L0iPV/Od6AJ45Lu5Iaa09/SMahsuAhwg4QSJmRaiU8cZEnooStRaMwVUfF2EXgP0Au+qN89j+ajqtK4pSfmOIEwfhgtAvYevX3Io7cQ1BiZ4/t39Y/4EibekfzC75cgVydhvOgRMEK2s9QiZP+oudDJQiC48ALUCsfuhGF6uTyFpXA9DyOXSwNSLo+uGw49bMgJHTkTbwoVjLIpTj8O2cSE6plegprAGGv8r30YoBSaqJ/0NLPLRFrg/EFQbHio2jfNtkyQVVXng26dh+tfF92frR7logQ+06ZZgawsmc/kcxEyUpPeTvtFTjw0Yav0Nw+IPP9JVXy61dNeRj6bNNiKpXhh+JMqyJc13g66Fl6XtgdtAW2Zb0L7qhPmv3fwo2X2PY/2ECXVkqBf6pGekL6x/I/6ut9OO8pe80RJaoRCoPlYNifWJ5OJ12SHoGKOqBXnDqQ18zDonE1ddlne3ST5yOszpJ7c8YFOgD1RM66YIFhPsxyMZTlO0i56vU0k7TVTLv6neI3KMcPO5+LmMMtekk=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(1800799024)(376014)(366016)(56012099006)(11063799006)(10067099003)(22082099003)(4143699003)(18002099003)(38070700021);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?8K5FKknfqP5I/Qt7XM8c+vvTnQQmdclt2YV0Sv0x3Bl7Gz8l1nre6h3lKPl9?=
 =?us-ascii?Q?qJFRW05jnQrIppWCgcN1IqDJaUX3hZJd7evNBG9bYu5VPL01DK9GCts8UQZ/?=
 =?us-ascii?Q?uW5ASwi2jCxaR5BaPCq7deSLEy2mp2q7/3UKv2I/gGQuhG4VhohFh6bAhCZw?=
 =?us-ascii?Q?u75p2etOBMyqZzq8azWHZKG6EfMlCnSgBWs3mTIP35A47AExXvS11jvUEQHG?=
 =?us-ascii?Q?r5rZXkzzEKV057qLohd/qZhcwNVIcAjhKXx8jYqBYxQGhK62Kykl5Z9sQge5?=
 =?us-ascii?Q?IzDwcPyughbKbwZxLTozlwgCXPr6Qz7YDopT0D3eIup72qCA0C9J/ouakYtN?=
 =?us-ascii?Q?1g+9QsEmk7pTTxfW/BmYROFNnoXMkGUhUg1yN9iMJCWpaYvP0hswlhG6xhwl?=
 =?us-ascii?Q?g6np8ytBE2oCbqvHKq6PrfQcC5FwbqRfQeYlM3NOZPtHoFz0J4NQI0490FX5?=
 =?us-ascii?Q?2lpdJKwIy89wwuK1tn2MdvFpxtQunKvC5i9lKWRGUtJ+0x2yuq/N5ZsJP7C4?=
 =?us-ascii?Q?Azj6pzZRz8EoSf5kG9hwCt1jRxAB16OlktDTME3AyugURme4Ag3LaYum1vGX?=
 =?us-ascii?Q?qjiJTs1nXaQ0chacmLqRyfZqim8+uCkYqNk0+n4eCJifesuw66Hmwf9DlfjT?=
 =?us-ascii?Q?BRSTUPVAjmyutTTSJ9o1tobRXIifMS1xNxl/0ZS7AeNOHNN344kKaMr3IUpX?=
 =?us-ascii?Q?oY1Tfi/Rf9OEYp+B/O9agtsori5TfhMgaqJg7czTuJwIxRK0DPsp2TlGpGw2?=
 =?us-ascii?Q?f/yYF3Qc40v4S4R2ayKYQ20CiuDgPk4R813voqE0YBXAC3Ch7W0N4JG5DlcU?=
 =?us-ascii?Q?D8YN5AF0FER+5Ds1THUW6yQVOa93nh1GB91vHzSgFkmG2U6XZ6xhXPVIBKhN?=
 =?us-ascii?Q?jeHVsOHjotDCG8w1oeFCCeWBHIOzqjffVA9j6C76rdqsDlkImFpXwOvb1Ugt?=
 =?us-ascii?Q?MdcxRS6MABbEEzD9jUVArjM7VlTthvew0a4ZJEV7HWmfPpZFzVK/hpFHxcRE?=
 =?us-ascii?Q?u7UKJHgQ42+UEuYe5OEqqRtsLnmBv3KTEsklK/426n6VK0+BUiYyCY8QMHm7?=
 =?us-ascii?Q?9mJxjrBNS7m6e//IVNY75iX3H14RBrN4LyjfOkfynPFod6IA6QstZ0BAZjD2?=
 =?us-ascii?Q?6kW6JyH12PkR6H+OKQ1hgkml5QF/NDGIq3lwsvWKyTOMcNYw+l4UDRYtVely?=
 =?us-ascii?Q?4OKSRiX656CmjxzCwChTCgRPKS8sgw3DssuSAUdF9FHNYvg2K2/CIHVBnKWU?=
 =?us-ascii?Q?cHZmnaCgxcYnhvMLTkPCMDX7d4YcXrXNRLJT4atfJIOjmQHdX/xnxraSlXxr?=
 =?us-ascii?Q?mHywC/XxhINXunHV8O1bS+te1G4W0u60UU6okxwvrwN6r+55s9x+ZhT10Dwx?=
 =?us-ascii?Q?sq2UC+s2J+rS0a7SwlPg/xZ4B6Fi5MH695+cFQDN7F+tEZm1Rpbyi9HIX+0k?=
 =?us-ascii?Q?3HhFkaibFHyGP6hle+iy2CCaSvHVdWa1o/rnSjOLVQPjRiAGLiZLoEgagU/7?=
 =?us-ascii?Q?xhSFF1qPkp3exww5vs71Nxc/5r03GFkf9/yLr6zcz/CYcft941Z5/QW1LUru?=
 =?us-ascii?Q?smU8rn4Wcv/IsuT/dLHFjI+irdadioclD+Dx3riCzOW8EMNSBlT1p2l68E0e?=
 =?us-ascii?Q?2W9aBAb5qOBk4WgvfJgxQTZ2mX0hhaIPTb572iXWucLUGj+DH58Yi3Xdr2Y7?=
 =?us-ascii?Q?npiDrlAJHCJMg5gt2zafKIBflTE2YisI58OuNBKGQYlLAxld?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: cf5830ae-3af5-4de9-9165-08df0826c622
X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Sep 2026 12:44:33.5686
 (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: APHM5Jhjbr3jIbNMNzFiRJjls1lg4/IDM/Bnthr0Kx3xAftJNpCK/mAi3ZAGJfVjb4apck4IndZTGyF63e38lw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR03MB7099
X-purgate-ID: tlsNG-d25034/1788266678-034D7A5B-D4C9BCC0/0/0
X-purgate-type: clean
X-purgate-size: 5814

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

________________________________________
From: win-pv-devel <win-pv-devel-bounces@lists.xenproject.org> on behalf of=
 Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: 26 August 2026 10:23 AM
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh
Subject: [PATCH] Force close the frontend if responses have been faked

If the ring disable process ended up faking responses, the shared ring
is no longer reusable and must be disconnected first. Otherwise, if the
ring is reenabled, the backend and frontend will desync.

Add a Poisoned flag to rings to indicate that they have been made
unusable. Introduce a transient Poisoned state to the frontend state
machine. If any ring has been poisoned, close the frontend before
reenabling it.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvif/frontend.c    | 34 +++++++++++++++++++++++++++++++++-
 src/xenvif/frontend.h    |  1 +
 src/xenvif/transmitter.c | 24 ++++++++++++++++++++++++
 src/xenvif/transmitter.h |  5 +++++
 4 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 086d0df..b772349 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -129,6 +129,7 @@ FrontendStateName(
     _STATE_NAME(CLOSED);
     _STATE_NAME(PREPARED);
     _STATE_NAME(CONNECTED);
+    _STATE_NAME(POISONED);
     _STATE_NAME(ENABLED);
     default:
         break;
@@ -2687,6 +2688,15 @@ FrontendDisable(
     Trace("<=3D=3D=3D=3D\n");
 }

+_IRQL_requires_(DISPATCH_LEVEL)
+static FORCEINLINE BOOLEAN
+FrontendIsPoisoned(
+    IN  PXENVIF_FRONTEND    Frontend
+    )
+{
+    return TransmitterIsPoisoned(__FrontendGetTransmitter(Frontend));
+}
+
 _IRQL_requires_max_(DISPATCH_LEVEL)
 NTSTATUS
 FrontendSetState(
@@ -2809,6 +2819,24 @@ FrontendSetState(
             }
             break;

+        case FRONTEND_POISONED:
+            switch (State) {
+            case FRONTEND_CONNECTED:
+            case FRONTEND_PREPARED:
+            case FRONTEND_CLOSED:
+            case FRONTEND_UNKNOWN:
+                FrontendClose(Frontend);
+                Frontend->State =3D FRONTEND_CLOSED;
+
+                FrontendDisconnect(Frontend);
+                break;
+
+            default:
+                ASSERT(FALSE);
+                break;
+            }
+            break;
+
         case FRONTEND_ENABLED:
             switch (State) {
             case FRONTEND_CONNECTED:
@@ -2816,7 +2844,11 @@ FrontendSetState(
             case FRONTEND_CLOSED:
             case FRONTEND_UNKNOWN:
                 FrontendDisable(Frontend);
-                Frontend->State =3D FRONTEND_CONNECTED;
+                if (FrontendIsPoisoned(Frontend)) {
+                    Frontend->State =3D FRONTEND_POISONED;
+                } else {
+                    Frontend->State =3D FRONTEND_CONNECTED;
+                }
                 break;

             default:
diff --git a/src/xenvif/frontend.h b/src/xenvif/frontend.h
index e062ed0..c1b7334 100644
--- a/src/xenvif/frontend.h
+++ b/src/xenvif/frontend.h
@@ -53,6 +53,7 @@ typedef enum _XENVIF_FRONTEND_STATE {
     FRONTEND_CLOSED,
     FRONTEND_PREPARED,
     FRONTEND_CONNECTED,
+    FRONTEND_POISONED,
     FRONTEND_ENABLED
 } XENVIF_FRONTEND_STATE, *PXENVIF_FRONTEND_STATE;

diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index b78a090..8c4ee41 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -187,6 +187,7 @@ typedef struct _XENVIF_TRANSMITTER_RING {
     BOOLEAN                         Connected;
     BOOLEAN                         Enabled;
     BOOLEAN                         Stopped;
+    BOOLEAN                         Poisoned;
     PVOID                           Lock;
 #if DBG
     PKTHREAD                        LockThread;
@@ -2440,6 +2441,8 @@ __TransmitterRingFakeResponses(
         PXENVIF_TRANSMITTER Transmitter;
         PXENVIF_FRONTEND    Frontend;

+        Ring->Poisoned =3D TRUE;
+
         Transmitter =3D Ring->Transmitter;
         Frontend =3D Transmitter->Frontend;

@@ -3920,6 +3923,7 @@ __TransmitterRingEnable(

     __TransmitterRingAcquireLock(Ring);

+    BUG_ON(Ring->Poisoned);
     ASSERT(!Ring->Enabled);
     Ring->Enabled =3D TRUE;

@@ -4076,6 +4080,7 @@ __TransmitterRingDisconnect(
     Ring->ResponsesProcessed =3D 0;
     Ring->RequestsPushed =3D 0;
     Ring->RequestsPosted =3D 0;
+    Ring->Poisoned =3D FALSE;

     XENBUS_DEBUG(Deregister,
                  &Transmitter->DebugInterface,
@@ -4980,6 +4985,25 @@ TransmitterDisconnect(
     Trace("<=3D=3D=3D=3D\n");
 }

+BOOLEAN
+TransmitterIsPoisoned(
+    IN  PXENVIF_TRANSMITTER Transmitter
+    )
+{
+    ULONG                   NumQueues;
+    ULONG                   Index;
+
+    NumQueues =3D FrontendGetNumQueues(Transmitter->Frontend);
+    for (Index =3D 0; Index < NumQueues; Index++) {
+        PXENVIF_TRANSMITTER_RING    Ring =3D Transmitter->Ring[Index];
+
+        if (Ring->Poisoned)
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 _IRQL_requires_(PASSIVE_LEVEL)
 VOID
 TransmitterTeardown(
diff --git a/src/xenvif/transmitter.h b/src/xenvif/transmitter.h
index 5e789f1..5e8defc 100644
--- a/src/xenvif/transmitter.h
+++ b/src/xenvif/transmitter.h
@@ -81,6 +81,11 @@ TransmitterDisconnect(
     IN  PXENVIF_TRANSMITTER Transmitter
     );

+extern BOOLEAN
+TransmitterIsPoisoned(
+    IN  PXENVIF_TRANSMITTER Transmitter
+    );
+
 _IRQL_requires_(PASSIVE_LEVEL)
 extern VOID
 TransmitterTeardown(
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 12:44:50 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2026 12:44:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1404743.1638429 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x1Nr8-0006fc-EE; Tue, 01 Sep 2026 12:44:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1404743.1638429; Tue, 01 Sep 2026 12:44:50 +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 1x1Nr8-0006fV-AN; Tue, 01 Sep 2026 12:44:50 +0000
Received: by outflank-mailman (input) for mailman id 1404743;
 Tue, 01 Sep 2026 12:44:49 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x1Nr7-0006fH-3o
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 12:44:49 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x1Nr6-00BqV6-11
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 14:44:48 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a96c8b0-2eae-0a2a0a5409dd-0a2a450a9dec-16
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:44:47 +0200
Received: from [40.107.200.49]
 (helo=CH5PR02CU005.outbound.protection.outlook.com)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a96c8be-f2d2-0a2a450a0019-286bc8315ee5-4
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:44:47 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by PH7PR03MB7003.namprd03.prod.outlook.com (2603:10b6:510:12e::6)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Tue, 1 Sep
 2026 12:44:43 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%3]) with mapi id 15.21.0360.008; Tue, 1 Sep 2026
 12:44:43 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=QABsjM9yyyy4paUVY57adPN9L/hJzPDxHtH6MiUsjxqU8oaqsxByu4T1jxY5oFcCKlppGeK2690zv60Gx5Y2EpwctYa/olHGmLpkBE/q4k+d78clv/hhO/VDgvCvdVVYFzi6xThJUglq3Zab2RXY2AtvSgJ9BKh7AV2R9bl/Jv4k4aAaTT2V9w/at7tO+cgVe3Abbu4XXFMN8lSupjoa3Kg9TgfGmC+kSEBx2iQa6DWdtuR5IS6Byc/ylUkA1UbYX/OJ5R0hM7A6sGYnDO4Q5rzpOMNxonoCGCM0KiWu/Cp0au4qZew185CI0f0BVUgQJ+RHmYLD8ZUdnDObuKL+OQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=3TrHYACy1Mjib8GNjJ0i3S6XBPJo/zB421yZaxqxqws=;
 b=gFrIeom2tdlDygkAEcpwSbvzqhxr9QaJBLcAM880S+XBmItj70+vyxCFcnvO2dovjRDSRcq+HBKG515Vzp95VVDC20o3HX1wDKGiE/E49lmi1FqthdhzVZn0k/ruMfNIqsgfUZtndZjnHIpm/G+LHy9y97jBDtoVbE78a4Wvdwe0MMhnyM1dwFapyA5vjk59a82GcUmV7G5DeSK2EbVfGoIzDVu22nnwh+8+Ecsg+h/O6HGqAelFn+67bTC6PM9lc8wA1vTnV//nWi+6V/p8lmJeQB8i9QlK4Y8QwqKEtO1wNf9rxFeecZ7BIJ0K3j4UP7/yYN3W+eWYS+tbT8nXcA==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=3TrHYACy1Mjib8GNjJ0i3S6XBPJo/zB421yZaxqxqws=;
 b=Da7vFyg9wpOW5fWlI9LEUgcTD4rzrfK4vnwb+PzyATfAR8SrpCMf4FvPo+ZIfyjnzrt48KLPg9B4xaZDJIsDNy1TduWdw6Ph39hpBowrqt59GlkosUyiV5Hv31XiKBeRdq8KJ6jYGHsiXxIMmvrjMvEH3aBkyR2CPxjB2CtIN1s=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH] Force close the frontend if responses have been faked
Thread-Topic: [PATCH] Force close the frontend if responses have been faked
Thread-Index: AQHdNTye9K7OZeWZx0KORZnT/f7esba5tNOC
Date: Tue, 1 Sep 2026 12:44:43 +0000
Message-ID:
 <SA6PR03MB77602EF316BDC180951CE858FEA82@SA6PR03MB7760.namprd03.prod.outlook.com>
References:
 <1787736170.8631fc262581453bbf619ec5b2062170.1a03d612005000c4f3@vates.tech>
 <1787736211.8631fc262581453bbf619ec5b2062170.1a03d61c14b000c4f3@vates.tech>
In-Reply-To:
 <1787736211.8631fc262581453bbf619ec5b2062170.1a03d61c14b000c4f3@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|PH7PR03MB7003:EE_
x-ms-office365-filtering-correlation-id: 0fceb749-bc5c-4cd4-0b3a-08df0826cbd7
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|376014|23010399003|1800799024|366016|38070700021|10067099003|4143699003|11063799006|18002099003|22082099003|56012099006;
x-microsoft-antispam-message-info:
 sg+cW8IQpumjJwV/1eGa6jTG4LYA5RuXINBZKwAevElJU3/tYPPRUUyyyLSLlVC8OPu3hUfobCoOmGbjIR0OKLp0yAvWuk0qQUdNYxroxxk/WQrZjIj3PEaLRDLvhM/gQd0T1Yf3ylUjj4dw82kgiscP7Tb/Z0tIJT9D2Qli6PC/8W1/mkzo06OuTIOPz+jiRY+Kb0S3CjDVX+K5SKXe8rqban7hiT486tieQs9Z0h/X+GoWOVKgbme5I2aJ4dIfK35idBpuapYnlr/oUu9ioxzf85AwP6Yiz03JiVqiTGKhe4xnYiLdxz+SyIMmso8Tk+PxZnxqF1QM/zIWaUeguwOkTUp+kzLKzWHmvA38l2SDhi9DZRVdI8oYFCnuGS9UfWmnsfwr1x5/GxgAp8d3a0cxGUtujLrb1z5NvhaYVIMkldualqImWKuMKTgWbPdlHjbRcNDE7OJX/hEPechxUd2YjELUVrihvLOWTyxRd7wo4yc5CaIYISZkRPS4HbLVfcNN1EgOjcN7Wc+kkcF3Ys7sM/iiDKhVyrfQUee388ohgmVqVzzrWt8c48+ZZS0A2QT78w6aT/IGaXVEcFp2KdxtiRjGvu99z0cML8thY36JN4NshKBX5rjtFMay7C12V483L211o8KeaNJdlrpggjFHGgtEoeCb6TA8fzfWvyQ=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(23010399003)(1800799024)(366016)(38070700021)(10067099003)(4143699003)(11063799006)(18002099003)(22082099003)(56012099006);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?a23mwmEa8vGEVk5s15kfEvs7ZRqJhDIlTKGamelfqpvLsQGu7J1dUl7kO4z5?=
 =?us-ascii?Q?oWhoVjPthF284k2aEpIPd89ltEwswjL5b9VB5iYB/HMnr2WluESyNedXxOdw?=
 =?us-ascii?Q?FJB6yL4TQu7h+yfN72xx+sSZEVKvjx5bzW3BOgk/XB7iz3TcrAtphhC3o1Cb?=
 =?us-ascii?Q?91dWm8xVCzrIWZuwS6zSsiE2KM2A2g0pM6Wh1/F2ODB3F0EOzv/7QdAjXO5V?=
 =?us-ascii?Q?hFhMqcAQ5b9P7n+KwyKL13yte3SEtu8pdk0O75trSQ8W+zno/SmLL1pxXP1N?=
 =?us-ascii?Q?Bz46lvDNucB89cyZ11H74/BsYPjhXnx67H13D6uQAGyGWQyD9toOH6tN2VCU?=
 =?us-ascii?Q?/8MAJCOLJQI34a8n4wEl70HnxgKyED4kcJUR2p2iuFM7PgMABxqcz0/MJFtp?=
 =?us-ascii?Q?fw6VtW4Jd8Z932mb/xLeJBi/4ZpjCwkeBfLIXYp+jWqyYLsAioyApMhCI4DK?=
 =?us-ascii?Q?+NOzM3qIvqvWKnu8IUsOMhoHQtH+36B/xYFJZfPMV9a9dYNqr0yXSn2jr+Iq?=
 =?us-ascii?Q?tWoFL/alPyzKKaYMOeg6mdu+iv0erkyKgR2a4RKcmKkMVaFA4/GCieU8eq89?=
 =?us-ascii?Q?AlDyoOJ+vAneFXN5NHWsVrj2jkdJti9rNWKCqndjBKhiI4Awl2t5NSps7XuJ?=
 =?us-ascii?Q?XVRqf38em9pIGhMi4Cq3JBvsLF82OJKltDnPOY8i2ZRmZT4PZYsfceZV2qx2?=
 =?us-ascii?Q?dVEKPHV+VXa13fh562qbgXdmWgn5+Dp/3aDB5p0gHyswQFFp5v5lQl415PXk?=
 =?us-ascii?Q?Pnu5Y+LpEwZVBC4Et7QCX1P55EhnRkUh1Uv1jfln8ZYcqpUdCdG4u/DP/njM?=
 =?us-ascii?Q?6bZl4KlD9X7zSV7JEfzURDST/M+DIcD3Fztl5hPnwVDZS21HCRBgTuWZrUgJ?=
 =?us-ascii?Q?bLrw6PvjCDA7+dqNCNi7+JGqn0uWSatOvRUHvdCpKOELQkYb1zY8X2uQOQGM?=
 =?us-ascii?Q?wSlFL/3wkdHkijWOo6t6iaoZKZw6wCVy2ruVQHX/zVuR9ObU0BpEHcqYEubM?=
 =?us-ascii?Q?Zjw3zDDr7I4CrzmnslTo7qRsgs1/9+ND/hr/wmLETzEhh3S1YbP7/y3Py5BV?=
 =?us-ascii?Q?yudIdtPRpofX1fZKuQJ3ewXpemVMEw5D9S7vTMBwqKEd7sCVRni/ZuHLYtBB?=
 =?us-ascii?Q?pwS6Yc+Q0vgBj6uMw3lvYPPjzIhIK1fhBayhVaUqRYHXgSTIxQFlILL/9t7I?=
 =?us-ascii?Q?iiSHFbUE7RW/WMwjADbzIxwLgYoGF61QMPR9b5UjdFZcUywOzX9FzbPJkswt?=
 =?us-ascii?Q?/6+eO5MsdeY2ARP+jPOMI4QaCZfGsbkeg4WYXft2yABiva5JrIj9uPD2loor?=
 =?us-ascii?Q?KI5Y4t8oEddN4cf7JYii/COGOrOViV9v7wN3sAxZQqbluzYCv7NgCW3J+K+s?=
 =?us-ascii?Q?hP8adoKIMiP9v5T7zTw/gA4AR3jDrUvmchfCYDpgPRjAN6jVc1+r4pSl4UEc?=
 =?us-ascii?Q?IkBr7SDyXFLUB3hdgDPzgVI+IRdQJbzvT7afZVsWyKY188FI9y2F/6D1eJG3?=
 =?us-ascii?Q?OD06wP+E3RrJWW/X/FWwj0juetbPBT4D8miknjpW5ajyPplmqmMtgNmVLqBp?=
 =?us-ascii?Q?JNEZcbbrh+rMdPK+9d9H5NXYaZKUO/T7Kuxt/n1ApyO+OFUXbsoipr6o0dS8?=
 =?us-ascii?Q?UTxDpNd84aqc1HK6Xzw3a8mf5ssRfqiJmqSc9QsUEpwmf067LXXMGlxEH0Qp?=
 =?us-ascii?Q?RPlBVhnnXtEseAb483Gb7ZYr67gd1kWoWh6mO66YS5+mA+Kb?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 0fceb749-bc5c-4cd4-0b3a-08df0826cbd7
X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Sep 2026 12:44:43.1355
 (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: Om9wO+88bd1hvN95IY2u/apAYBQh0T4LEw1m0kjJXwljt6DBZ+PK3GVM135jkaH5dO+s98jLtlOJubhTPKflaQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR03MB7003
X-purgate-ID: tlsNG-4011c0/1788266687-59FDECFC-7DFA940E/0/0
X-purgate-type: clean
X-purgate-size: 6389

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

________________________________________
From: win-pv-devel <win-pv-devel-bounces@lists.xenproject.org> on behalf of=
 Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: 26 August 2026 10:23 AM
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh
Subject: [PATCH] Force close the frontend if responses have been faked

If the ring disable process ended up faking responses, the shared ring
is no longer reusable and must be disconnected first. Otherwise, if the
ring is reenabled, the backend and frontend will desync.

Add a Poisoned flag to rings to indicate that they have been made
unusable. Introduce a transient Poisoned state to the frontend state
machine. If any ring has been poisoned, close the frontend before
reenabling it.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenvbd/frontend.c | 30 +++++++++++++++++++++++++++++-
 src/xenvbd/frontend.h |  3 ++-
 src/xenvbd/ring.c     | 25 +++++++++++++++++++++++++
 src/xenvbd/ring.h     |  5 +++++
 4 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
index d8e3287..3b078da 100644
--- a/src/xenvbd/frontend.c
+++ b/src/xenvbd/frontend.c
@@ -108,6 +108,7 @@ __XenvbdStateName(
     case XENVBD_CLOSED:             return "CLOSED";
     case XENVBD_PREPARED:           return "PREPARED";
     case XENVBD_CONNECTED:          return "CONNECTED";
+    case XENVBD_POISONED:           return "POISONED";
     case XENVBD_ENABLED:            return "ENABLED";
     default:                        return "UNKNOWN";
     }
@@ -1349,6 +1350,14 @@ FrontendDisable(
     RingDisable(Frontend->Ring);
     GranterDisable(Frontend->Granter);
 }
+__drv_requiresIRQL(DISPATCH_LEVEL)
+static FORCEINLINE BOOLEAN
+FrontendIsPoisoned(
+    __in  PXENVBD_FRONTEND          Frontend
+    )
+{
+    return RingIsPoisoned(Frontend->Ring);
+}

 //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
 // Init/Term
@@ -1488,6 +1497,21 @@ __FrontendSetState(
             }
             break;

+        case XENVBD_POISONED:
+            switch (State) {
+            case XENVBD_CLOSING:
+            case XENVBD_CLOSED:
+            case XENVBD_PREPARED:
+            case XENVBD_CONNECTED:
+                Status =3D FrontendClose(Frontend);
+                Frontend->State =3D XENVBD_CLOSING;
+                break;
+            default:
+                Failed =3D TRUE;
+                break;
+            }
+            break;
+
         case XENVBD_ENABLED:
             switch (State) {
             case XENVBD_CLOSING:
@@ -1495,7 +1519,11 @@ __FrontendSetState(
             case XENVBD_PREPARED:
             case XENVBD_CONNECTED:
                 FrontendDisable(Frontend);
-                Frontend->State =3D XENVBD_CONNECTED;
+                if (FrontendIsPoisoned(Frontend)) {
+                    Frontend->State =3D XENVBD_POISONED;
+                } else {
+                    Frontend->State =3D XENVBD_CONNECTED;
+                }
                 break;
             default:
                 Failed =3D TRUE;
diff --git a/src/xenvbd/frontend.h b/src/xenvbd/frontend.h
index 6c7665d..18cc4fb 100644
--- a/src/xenvbd/frontend.h
+++ b/src/xenvbd/frontend.h
@@ -47,7 +47,8 @@ typedef enum _XENVBD_STATE {
     XENVBD_CLOSED,      // -> { PREPARED }
     XENVBD_PREPARED,    // -> { CLOSING, CONNECTED }
     XENVBD_CONNECTED,   // -> { ENABLED, CLOSING }
-    XENVBD_ENABLED      // -> { CLOSING }
+    XENVBD_POISONED,    // -> { CLOSING }
+    XENVBD_ENABLED      // -> { CONNECTED, POISONED }
 } XENVBD_STATE, *PXENVBD_STATE;

 typedef struct _XENVBD_CAPS {
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index d7daaab..0b56831 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -75,6 +75,7 @@ typedef struct _XENVBD_BLKIF_RING {
     BOOLEAN                         Connected;
     BOOLEAN                         Enabled;
     BOOLEAN                         Stopped;
+    BOOLEAN                         Poisoned;
     PVOID                           Lock;
 #if DBG
     PKTHREAD                        LockThread;
@@ -2172,6 +2173,7 @@ BlkifRingEnable(
     Trace("=3D=3D=3D=3D> %u\n", BlkifRing->Index);

     __BlkifRingAcquireLock(BlkifRing);
+    BUG_ON(BlkifRing->Poisoned);
     ASSERT(!BlkifRing->Enabled);
     BlkifRing->Enabled =3D TRUE;
     __BlkifRingReleaseLock(BlkifRing);
@@ -2249,6 +2251,8 @@ BlkifRingDisable(
         Request =3D CONTAINING_RECORD(ListEntry, XENVBD_REQUEST, ListEntry=
);
         BlkifRing->ResponsesProcessed++;
         __BlkifRingCompleteResponse(BlkifRing, Request, BLKIF_RSP_ERROR);
+
+        BlkifRing->Poisoned =3D TRUE;
     }

     while (!IsListEmpty(&BlkifRing->PreparedQueue)) {
@@ -2315,6 +2319,7 @@ BlkifRingDisconnect(
     BlkifRing->ResponsesProcessed =3D 0;

     BlkifRing->Connected =3D FALSE;
+    BlkifRing->Poisoned =3D FALSE;

     Trace("<=3D=3D=3D=3D %u\n", BlkifRing->Index);
 }
@@ -2770,6 +2775,26 @@ RingDisconnect(
     XENBUS_DEBUG(Release, &Ring->DebugInterface);
 }

+BOOLEAN
+RingIsPoisoned(
+    IN  PXENVBD_RING    Ring
+    )
+{
+    ULONG               NumQueues;
+    ULONG               Index;
+
+    NumQueues =3D FrontendGetNumQueues(Ring->Frontend);
+    for (Index =3D 0; Index < NumQueues; Index++) {
+        PXENVBD_BLKIF_RING  BlkifRing =3D Ring->Ring[Index];
+
+        if (BlkifRing->Poisoned) {
+            return TRUE;
+        }
+    }
+
+    return FALSE;
+}
+
 static FORCEINLINE PXENVBD_BLKIF_RING
 __RingGetBlkifRing(
     IN  PXENVBD_RING    Ring,
diff --git a/src/xenvbd/ring.h b/src/xenvbd/ring.h
index c459838..5644c7c 100644
--- a/src/xenvbd/ring.h
+++ b/src/xenvbd/ring.h
@@ -75,6 +75,11 @@ RingDisconnect(
     IN  PXENVBD_RING    Ring
     );

+extern BOOLEAN
+RingIsPoisoned(
+    IN  PXENVBD_RING    Ring
+    );
+
 extern BOOLEAN
 RingQueueRequest(
     IN  PXENVBD_RING    Ring,
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 01 12:54:02 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Sep 2026 12:54:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1404750.1638434 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x1O02-00085i-3Z; Tue, 01 Sep 2026 12:54:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1404750.1638434; Tue, 01 Sep 2026 12:54:02 +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 1x1O02-00085b-03; Tue, 01 Sep 2026 12:54:02 +0000
Received: by outflank-mailman (input) for mailman id 1404750;
 Tue, 01 Sep 2026 12:54:01 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a05d087bae000c4f3@swg.vates.tech>)
 id 1x1O00-00085S-U9
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 12:54:01 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x1Nzu-003sNR-Rf
 for win-pv-devel@lists.xenproject.org; Tue, 01 Sep 2026 14:53:54 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a05d087bae000c4f3@swg.vates.tech>)
 id 6a96cad7-2eae-0a2a0a5409dd-0a2a45049c56-28
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:53:54 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a05d087bae000c4f3@swg.vates.tech>)
 id 6a96cae2-b57f-0a2a45040019-b9ff1c229219-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 01 Sep 2026 14:53:54 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a05d087bae000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 01 Sep 2026 12:53:52 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 815F383E93;
 Tue,  1 Sep 2026 14:53:51 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=HjOJ0eCUnZA9kKuE0LH18jLv9A2N8fNlUGMPk835G/o=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id;
 b=Vg30MEmT226dHDsTahMQXenDYc1rtTOmHl0U1Mcgmjq1eSxZRF8UpDrSOJh4Elaa21V3YKmz1
 hvDhKbbsTJiQmnAje75PnpChxN62j4xI0og1Elo/dL819Y+X0qqS6xbKAdlnLoSbvHTxHhXW8n+
 ovO4CU6cwxpywhb6C9EUI27lJayobatJaSRNpDBH0qqpQ9ZLwarox5yOuGqaxw0YWB51N92tjlC
 hsv2t+tbjy1E1+zQHWPm1OfAVqZ7OvN4fYSRjKv4CHn8gqacMzo0QV8z5nVoDDSvOY0qAon0vIb
 nbv5u9CjF6Zb4jNYxn0IMLY7dU3AyCAp7+E1VjMTSxnQ==
X-Zone-Loop: f28785ac60cddbc980880dbdbaaf752259a9b2de86ce
x-campaign-type: default
x-transaction-id: acfab590-71c2-4aae-88ac-cec9deaeb1e1
x-swg-uid: 01-3d2c271d-5ef1-4b2f-b24f-79195751653e
X-Mailer: Sweego
Message-ID:
 <1788267232.8631fc262581453bbf619ec5b2062170.1a05d087bae000c4f3@vates.tech>
x-swg-bid: 1788267232.8631fc262581453bbf619ec5b2062170.1a05d087bae000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Tue, 1 Sep 2026 14:53:51 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] registry: Fix wrong truncation of Unicode.Length
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
References: <1787691669.8631fc262581453bbf619ec5b2062170.1a03aba1759000c4f3@vates.tech>
 <1787691737.8631fc262581453bbf619ec5b2062170.1a03abb2335000c4f3@vates.tech>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <1787691737.8631fc262581453bbf619ec5b2062170.1a03abb2335000c4f3@vates.tech>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.32ed.c48a21051a43bfbf.1a05d08795b.87b281c2e676eecf=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1788267231580
X-purgate-ID: tlsNG-ebf023/1788267234-C2CCFB50-662F68DF/0/0
X-purgate-type: clean
X-purgate-size: 3439

---=Part.32ed.c48a21051a43bfbf.1a05d08795b.87b281c2e676eecf=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 25/08/2026 23:02, Tu Dinh wrote:
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>
>=20
> Ported from XenBus=2E
>=20
> Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

Hello,

Looks like this patch has not been applied to xenvkbd=2E

> ---
>   src/xenvkbd/registry=2Ec | 27 ++++++++++++++++++++-------
>   1 file changed, 20 insertions(+), 7 deletions(-)
>=20
> diff --git a/src/xenvkbd/registry=2Ec b/src/xenvkbd/registry=2Ec
> index 8f84818=2E=2Ee498497 100644
> --- a/src/xenvkbd/registry=2Ec
> +++ b/src/xenvkbd/registry=2Ec
> @@ -1305,30 +1305,37 @@ RegistryAnsiToSz(
>       NTSTATUS                        status;
>  =20
>       Length =3D Ansi->Length + 1;
> +
> +    status =3D STATUS_BUFFER_OVERFLOW;
> +    if (Length * sizeof(WCHAR) > MAXUSHORT)
> +        goto fail1;
> +
>       Partial =3D __RegistryAllocate(FIELD_OFFSET(KEY_VALUE_PARTIAL_INFO=
RMATION, Data) +
>                                    Length * sizeof (WCHAR));
>  =20
>       status =3D STATUS_NO_MEMORY;
>       if (Partial =3D=3D NULL)
> -        goto fail1;
> +        goto fail2;
>  =20
>       Partial->TitleIndex =3D 0;
>       Partial->Type =3D REG_SZ;
>       Partial->DataLength =3D Length * sizeof (WCHAR);
>  =20
> -    Unicode=2EMaximumLength =3D (UCHAR)Partial->DataLength;
> +    Unicode=2EMaximumLength =3D (USHORT)Partial->DataLength;
>       Unicode=2EBuffer =3D (PWCHAR)Partial->Data;
>       Unicode=2ELength =3D 0;
>  =20
>       status =3D RtlAnsiStringToUnicodeString(&Unicode, Ansi, FALSE);
>       if (!NT_SUCCESS(status))
> -        goto fail2;
> +        goto fail3;
>  =20
>       return Partial;
>  =20
> -fail2:
> +fail3:
>       __RegistryFree(Partial);
>  =20
> +fail2:
> +
>   fail1:
>       return NULL;
>   }
> @@ -1348,12 +1355,16 @@ RegistryAnsiToMultiSz(
>       for (Index =3D 0; Ansi[Index]=2EBuffer !=3D NULL; Index++)
>           Length +=3D Ansi[Index]=2ELength + 1;
>  =20
> +    status =3D STATUS_BUFFER_OVERFLOW;
> +    if (Length * sizeof(WCHAR) > MAXUSHORT)
> +        goto fail1;
> +
>       Partial =3D __RegistryAllocate(FIELD_OFFSET(KEY_VALUE_PARTIAL_INFO=
RMATION, Data) +
>                                  Length * sizeof (WCHAR));
>  =20
>       status =3D STATUS_NO_MEMORY;
>       if (Partial =3D=3D NULL)
> -        goto fail1;
> +        goto fail2;
>  =20
>       Partial->TitleIndex =3D 0;
>       Partial->Type =3D REG_MULTI_SZ;
> @@ -1366,7 +1377,7 @@ RegistryAnsiToMultiSz(
>       for (Index =3D 0; Ansi[Index]=2EBuffer !=3D NULL; Index++) {
>           status =3D RtlAnsiStringToUnicodeString(&Unicode, &Ansi[Index]=
, FALSE);
>           if (!NT_SUCCESS(status))
> -            goto fail2;
> +            goto fail3;
>  =20
>           Length =3D Unicode=2ELength / sizeof (WCHAR);
>  =20
> @@ -1379,9 +1390,11 @@ RegistryAnsiToMultiSz(
>  =20
>       return Partial;
>  =20
> -fail2:
> +fail3:
>       __RegistryFree(Partial);
>  =20
> +fail2:
> +
>   fail1:
>       return NULL;
>   }



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.32ed.c48a21051a43bfbf.1a05d08795b.87b281c2e676eecf=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 08 06:55:43 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 08 Sep 2026 06:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1411136.1641872 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x3pk6-0001P0-C4; Tue, 08 Sep 2026 06:55:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1411136.1641872; Tue, 08 Sep 2026 06:55:42 +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 1x3pk6-0001Os-9B; Tue, 08 Sep 2026 06:55:42 +0000
Received: by outflank-mailman (input) for mailman id 1411136;
 Tue, 08 Sep 2026 06:55:41 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x3pk5-0001Om-Oi
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 06:55:41 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x3pk4-00FGus-Fy
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 08:55:40 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a9fb159-2eae-0a2a0a5409dd-0a2a450381cc-46
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 08:55:40 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a9fb16a-fae8-0a2a45030019-a0658309d36c-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 08:55:39 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 363AC82F287D;
 Tue,  8 Sep 2026 02:53:31 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 1/2] Compact reported IPv[4|6] address xenstore values
Date: Tue,  8 Sep 2026 07:55:31 +0100
Message-ID: <20260908065532.1332-1-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-33051d/1788850539-774F44E9-2570B66B/0/0
X-purgate-type: clean
X-purgate-size: 1526

Pass the index of IPv[4|6] into the FrontendDumpIPv[4|6]Address call, to
zero-index the IP address dumps to each of the specific protocols. Otherwise,
an adapter could report uncontiguous indexes across IPv4 and IPv6.
This also avoids cases where the address table contains non-IPv[4|6] addresses,
skipping indexes into the xenstore data.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/frontend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index b772349..bece661 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -907,7 +907,7 @@ FrontendDumpAddressTable(
         case AF_INET: {
             status = FrontendDumpIPv4Address(Frontend,
                                              Transaction,
-                                             Index,
+                                             IpVersion4Count,
                                              Entry);
             if (!NT_SUCCESS(status))
                 goto fail4;
@@ -918,7 +918,7 @@ FrontendDumpAddressTable(
         case AF_INET6: {
             status = FrontendDumpIPv6Address(Frontend,
                                              Transaction,
-                                             Index,
+                                             IpVersion6Count,
                                              Entry);
             if (!NT_SUCCESS(status))
                 goto fail4;
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Tue Sep 08 06:55:44 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 08 Sep 2026 06:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1411137.1641875 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x3pk8-0001QR-Cz; Tue, 08 Sep 2026 06:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1411137.1641875; Tue, 08 Sep 2026 06:55:44 +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 1x3pk8-0001QK-AU; Tue, 08 Sep 2026 06:55:44 +0000
Received: by outflank-mailman (input) for mailman id 1411137;
 Tue, 08 Sep 2026 06:55:43 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x3pk7-0001Q2-K2
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 06:55:43 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x3pk6-000Qs2-HG
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 08:55:42 +0200
Received: from [10.42.69.11] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a9fb163-8faa-0a2a0a5109dd-0a2a450b884a-38
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 08:55:42 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6a9fb16d-b7e8-0a2a450b0019-a0658309d4a6-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 08:55:42 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 3EF01835A835;
 Tue,  8 Sep 2026 02:53:33 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 2/2] Use SystemPowerWorkItem for FdoSystemPowerDownWorker
Date: Tue,  8 Sep 2026 07:55:32 +0100
Message-ID: <20260908065532.1332-2-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
In-Reply-To: <20260908065532.1332-1-owen.smith@citrix.com>
References: <20260908065532.1332-1-owen.smith@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-42698a/1788850542-A88C99EA-833CB702/0/0
X-purgate-type: clean
X-purgate-size: 694

Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/fdo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenvif/fdo.c b/src/xenvif/fdo.c
index e0f793f..6c4c945 100644
--- a/src/xenvif/fdo.c
+++ b/src/xenvif/fdo.c
@@ -2597,7 +2597,7 @@ FdoRequestSetDevicePowerDownComplete(
         Exchange = InterlockedExchangePointer(&Fdo->SystemPowerIrp, Irp);
         ASSERT(Exchange == NULL);
 
-        IoQueueWorkItem(Fdo->DevicePowerWorkItem,
+        IoQueueWorkItem(Fdo->SystemPowerWorkItem,
                         FdoSystemPowerDownWorker,
                         DelayedWorkQueue,
                         Fdo);
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Tue Sep 08 14:39:23 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 08 Sep 2026 14:39:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1412140.1642641 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x3wyp-000055-0E; Tue, 08 Sep 2026 14:39:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1412140.1642641; Tue, 08 Sep 2026 14:39: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 1x3wyo-00004w-Tc; Tue, 08 Sep 2026 14:39:22 +0000
Received: by outflank-mailman (input) for mailman id 1412140;
 Tue, 08 Sep 2026 14:39:21 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a081758447000c4f3@swg.vates.tech>)
 id 1x3wyn-0008W1-4I
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 14:39:21 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x3wyl-00GqrV-Ra
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 16:39:19 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a081758447000c4f3@swg.vates.tech>)
 id 6aa01e0e-8faa-0a2a0a5109dd-0a2a4503cad0-20
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 16:39:19 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a081758447000c4f3@swg.vates.tech>)
 id 6aa01e17-fae8-0a2a45030019-b9ff1c239dbf-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 16:39:19 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a081758447000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 08 Sep 2026 14:39:17 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id C507D84159;
 Tue,  8 Sep 2026 16:39:16 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=fLBxeDLVZWV2cSO7P3ubpEWbYPiS4gqLfLc/rEak97g=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=qWYqbEDwasPdhTPaanvAZLn9Dav6esel4hdvdyhv6z952dKaipArb6x84LH8p0wQsPUMCESm9
 09HCxK3c/LrFR2+1ZnBAMDcCWzyHfFBQ2wGNIk3E0Re42rJbETXemZm+aPJZ2wQyvW5/wr9sc90
 pGG5k66fBQWZPBPUYAR7uRUVyqlqg1M01Xk07EVu/HfIv6k9sSOvaoAt6mewUN/oiyZcpGWpPKc
 TKxFzKa8vZ5BtIJJpQFNE4qaENRkKJS7SfJ+eOS3LmvcObaeg/hxk5XSKdVGM3YBRItK2kpHbEB
 46xlJCTmhAB1EAb4y2S066etCz9cLzQYCMkF9Tqz1vpg==
X-Zone-Loop: f89ab4c3981c8c8871fe311c18455c8d19f4d46187b3
x-campaign-type: default
x-transaction-id: e5093fc1-fd0c-4078-8095-401e43506361
x-swg-uid: 01-f89c370a-d6b6-4f48-aa0b-45db82d8aa90
X-Mailer: Sweego
Message-ID:
 <1788878357.8631fc262581453bbf619ec5b2062170.1a081758447000c4f3@vates.tech>
x-swg-bid: 1788878357.8631fc262581453bbf619ec5b2062170.1a081758447000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Tue, 8 Sep 2026 16:39:16 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/2] Compact reported IPv[4|6] address xenstore values
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260908065532.1332-1-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260908065532.1332-1-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.396b.d2ccbf55642bea34.1a08175817c.197ada7c89a4a92=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1788878356860
X-purgate-ID: tlsNG-33051d/1788878359-75EFF4E9-F9A3F191/0/0
X-purgate-type: clean
X-purgate-size: 2055

---=Part.396b.d2ccbf55642bea34.1a08175817c.197ada7c89a4a92=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 08/09/2026 08:55, Owen Smith wrote:
> Pass the index of IPv[4|6] into the FrontendDumpIPv[4|6]Address call, to
> zero-index the IP address dumps to each of the specific protocols=2E Oth=
erwise,
> an adapter could report uncontiguous indexes across IPv4 and IPv6=2E
> This also avoids cases where the address table contains non-IPv[4|6] add=
resses,
> skipping indexes into the xenstore data=2E
>=20
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/frontend=2Ec | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/src/xenvif/frontend=2Ec b/src/xenvif/frontend=2Ec
> index b772349=2E=2Ebece661 100644
> --- a/src/xenvif/frontend=2Ec
> +++ b/src/xenvif/frontend=2Ec
> @@ -907,7 +907,7 @@ FrontendDumpAddressTable(
>           case AF_INET: {
>               status =3D FrontendDumpIPv4Address(Frontend,
>                                                Transaction,
> -                                             Index,
> +                                             IpVersion4Count,
>                                                Entry);
>               if (!NT_SUCCESS(status))
>                   goto fail4;
> @@ -918,7 +918,7 @@ FrontendDumpAddressTable(
>           case AF_INET6: {
>               status =3D FrontendDumpIPv6Address(Frontend,
>                                                Transaction,
> -                                             Index,
> +                                             IpVersion6Count,
>                                                Entry);
>               if (!NT_SUCCESS(status))
>                   goto fail4;



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.396b.d2ccbf55642bea34.1a08175817c.197ada7c89a4a92=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 08 14:40:07 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 08 Sep 2026 14:40:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1412146.1642644 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x3wzX-0001Cq-2R; Tue, 08 Sep 2026 14:40:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1412146.1642644; Tue, 08 Sep 2026 14:40:07 +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 1x3wzW-0001CY-Vn; Tue, 08 Sep 2026 14:40:06 +0000
Received: by outflank-mailman (input) for mailman id 1412146;
 Tue, 08 Sep 2026 14:40:06 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0817635c0000c4f3@swg.vates.tech>)
 id 1x3wzW-0000zk-0g
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 14:40:06 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x3wzU-00DiDR-R8
 for win-pv-devel@lists.xenproject.org; Tue, 08 Sep 2026 16:40:04 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0817635c0000c4f3@swg.vates.tech>)
 id 6aa01e41-bab6-0a2a0a5309dd-0a2a45019ca2-30
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 16:40:04 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0817635c0000c4f3@swg.vates.tech>)
 id 6aa01e44-5984-0a2a45010019-b9ff1c12b09d-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 08 Sep 2026 16:40:04 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0817635c0000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 08 Sep 2026 14:40:03 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 3EF2584170;
 Tue,  8 Sep 2026 16:40:02 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=psDRRspWL/wI4HkJRv1vRiLqrih01cWppi4tTBCUgDE=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=NlYzYZJT0f0qwVlGT7iMLxp+poRX6v1fUOcOq48va5RdzFoNY14fa6URT1q/jEO9bU0tV2Qco
 TrGO4B6+srZODUZe7M48WM5C64Js8yHCyZs4SCTDSjGghcFGu1otSd2XG3Q1blQ4Jbcdr4uKCtC
 YAXIj0Od+7fkftn5MxzZ1Is0q7fDdhFsZ6C0GXkQew0MleDRY6iJnqeoZTztjFPLkGTOTTRfC4U
 M8RGYzGM15JmT4wwUSq9/GJpyYUEZw4LQW6Of7efZr3xa84/4mEwLUebxY9DYb816mgaJHgMJ0z
 SSNSeC9ONfVcuxi44hIhEmpRJMNXyvnC5QEHdAYC2aqQ==
X-Zone-Loop: ccf190c17de6bef54e3112912353ccef84fcc07e1dfa
x-campaign-type: default
x-transaction-id: 0f8cb0be-d016-4e38-bc20-6a2be06e744e
x-swg-uid: 01-f5b000dc-2b79-420f-a416-76e930c46ab0
X-Mailer: Sweego
Message-ID:
 <1788878403.8631fc262581453bbf619ec5b2062170.1a0817635c0000c4f3@vates.tech>
x-swg-bid: 1788878403.8631fc262581453bbf619ec5b2062170.1a0817635c0000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Tue, 8 Sep 2026 16:40:02 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/2] Use SystemPowerWorkItem for FdoSystemPowerDownWorker
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260908065532.1332-1-owen.smith@citrix.com>
 <20260908065532.1332-2-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260908065532.1332-2-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.396c.19f1652dabf19dff.1a0817632fe.93316b17b81acab=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1788878402302
X-purgate-ID: tlsNG-d62444/1788878404-1D67C757-53A705E1/0/0
X-purgate-type: clean
X-purgate-size: 1180

---=Part.396c.19f1652dabf19dff.1a0817632fe.93316b17b81acab=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 08/09/2026 08:55, Owen Smith wrote:
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/fdo=2Ec | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/src/xenvif/fdo=2Ec b/src/xenvif/fdo=2Ec
> index e0f793f=2E=2E6c4c945 100644
> --- a/src/xenvif/fdo=2Ec
> +++ b/src/xenvif/fdo=2Ec
> @@ -2597,7 +2597,7 @@ FdoRequestSetDevicePowerDownComplete(
>           Exchange =3D InterlockedExchangePointer(&Fdo->SystemPowerIrp, =
Irp);
>           ASSERT(Exchange =3D=3D NULL);
>  =20
> -        IoQueueWorkItem(Fdo->DevicePowerWorkItem,
> +        IoQueueWorkItem(Fdo->SystemPowerWorkItem,
>                           FdoSystemPowerDownWorker,
>                           DelayedWorkQueue,
>                           Fdo);



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.396c.19f1652dabf19dff.1a0817632fe.93316b17b81acab=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 12:54:45 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 12:54:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414603.1644349 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eIe-00015B-08; Thu, 10 Sep 2026 12:54:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414603.1644349; Thu, 10 Sep 2026 12:54:43 +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 1x4eId-00014y-TA; Thu, 10 Sep 2026 12:54:43 +0000
Received: by outflank-mailman (input) for mailman id 1414603;
 Thu, 10 Sep 2026 12:54:43 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x4eId-00014r-4B
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 12:54:43 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eIc-00AnbX-H8
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 14:54:42 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a88a-e002-0a2a0a5209dd-0a2a450cd9ec-24
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:42 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a891-f479-0a2a450c0019-a06583099d56-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:42 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id D608983BA107;
 Thu, 10 Sep 2026 08:52:34 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 1/5] Fix IPv6 zero-run compression.
Date: Thu, 10 Sep 2026 13:54:33 +0100
Message-ID: <20260910125437.282-1-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d25034/1789044882-5290EA5B-6BB3F1D4/0/0
X-purgate-type: clean
X-purgate-size: 1993

ZeroIndex was only set when the first zero was found, and ZeroCount is set to
the longest run of zeros. This would incorrectly compress an address with
a two runs of zeros, e.g. "1:0:0:2:0:0:0:3" to "1::0:0:0:3".
ZeroIndex should be recalculated whenever a longer run of zeros is detected,
so that the above run is correctly compressed to "1:0:2::3"

Simplifies the condition detecting an ending zero run, as Index would always
be 7 when a trailing ":" is required.

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/frontend.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index bece661..56fcc30 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -774,22 +774,21 @@ FrontendDumpIPv6Address(
             Count = 0;
 
         if (Count > ZeroCount) {
-            if (Count == 1)
-                ZeroIndex = Index;
+            ZeroIndex = 1 + Index - Count;
             ZeroCount = Count;
         }
     }
 
     if (ZeroCount > 1) {
-        CHAR                        Parts[8][sizeof(":XXXX")];
+        CHAR                        Parts[8][sizeof(":XXXX")] = { 0 };
 
         for (Index = 0; Index < 8; Index++) {
             // Consecutive 0s are collapsed into a single semicolon, so that
             // appending :xxxx segments would work naturally.
             // Compensate for the missing appended semicolon if the last word
             // was also collapsed.
-            if (Index == ZeroIndex || (Index == 7 &&
-                                       Index == ZeroIndex + ZeroCount - 1)) {
+            if (Index == ZeroIndex ||
+                (Index == 7 && ZeroIndex + ZeroCount == 8)) {
                 Parts[Index][0] = ':';
                 Parts[Index][1] = '\0';
             } else if (Index > ZeroIndex && Index < ZeroIndex + ZeroCount) {
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 12:54:45 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 12:54:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414604.1644352 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eIf-00016S-0e; Thu, 10 Sep 2026 12:54:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414604.1644352; Thu, 10 Sep 2026 12:54:44 +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 1x4eIe-00016L-UI; Thu, 10 Sep 2026 12:54:44 +0000
Received: by outflank-mailman (input) for mailman id 1414604;
 Thu, 10 Sep 2026 12:54:43 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x4eId-00014x-Sm
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 12:54:43 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eId-00Axr0-98
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 14:54:43 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a888-8faa-0a2a0a5109dd-0a2a4504bc9c-46
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:43 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a892-b57f-0a2a45040019-a06583098658-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:43 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 9D93983BA102;
 Thu, 10 Sep 2026 08:52:35 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 2/5] Fix potential Use-After-Free in __MacGetSpeed
Date: Thu, 10 Sep 2026 13:54:34 +0100
Message-ID: <20260910125437.282-2-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
References: <20260910125437.282-1-owen.smith@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-ebf023/1789044883-53AC0B50-84B4695B/0/0
X-purgate-type: clean
X-purgate-size: 2393

If the backend provides a xenstore value for "speed", it can include a unit
character. When parsing this string, the Unit pointer would refer to a buffer
that gets freed earlier.
Change the parsing to store the Unit value as a single CHAR, so that the
buffer can be freed without issue.

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/mac.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/xenvif/mac.c b/src/xenvif/mac.c
index c20f281..3e4e5b7 100644
--- a/src/xenvif/mac.c
+++ b/src/xenvif/mac.c
@@ -700,38 +700,42 @@ __MacGetSpeed(
     PXENVIF_FRONTEND    Frontend;
     PCHAR               Buffer;
     ULONG64             Speed;
-    PCHAR               Unit;
+    CHAR                Unit;
     NTSTATUS            status;
 
     Frontend = Mac->Frontend;
 
+    Speed = Mac->Speed;
+    Unit = 'G';
+
     status = XENBUS_STORE(Read,
                           &Mac->StoreInterface,
                           NULL,
                           FrontendGetPath(Mac->Frontend),
                           "speed",
                           &Buffer);
-    if (!NT_SUCCESS(status)) {
-        Speed = Mac->Speed;
-        Unit = "G";
-    } else {
-        Speed = _strtoui64(Buffer, &Unit, 10);
+    if (NT_SUCCESS(status)) {
+        PCHAR           End;
+
+        Speed = _strtoui64(Buffer, &End, 10);
         if (Speed == _UI64_MAX)
             Speed = Mac->Speed;
-        if (*Unit == '\0')
-            Unit = "G";
+
+        if (*End != '\0') {
+            Unit = *End;
+
+            if (*(End + 1) != '\0') {
+                Warning("INVALID SPEED: %s\n", Buffer);
+                Speed = 0;
+            }
+        }
 
         XENBUS_STORE(Free,
                      &Mac->StoreInterface,
                      Buffer);
     }
 
-    if (*(Unit + 1) != '\0') {
-        Warning("INVALID SPEED: %s\n", Buffer);
-        return 0;
-    }
-
-    switch (*Unit) {
+    switch (Unit) {
     case 'g':
     case 'G':
         Speed *= 1000000000ull;
@@ -748,7 +752,7 @@ __MacGetSpeed(
         break;
 
     default:
-        Warning("INVALID SPEED UNIT: %c\n", *Unit);
+        Warning("INVALID SPEED UNIT: %c\n", Unit);
         return 0;
     }
 
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 12:54:46 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 12:54:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414605.1644357 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eIg-00018S-2n; Thu, 10 Sep 2026 12:54:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414605.1644357; Thu, 10 Sep 2026 12:54:46 +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 1x4eIf-00018K-Va; Thu, 10 Sep 2026 12:54:45 +0000
Received: by outflank-mailman (input) for mailman id 1414605;
 Thu, 10 Sep 2026 12:54:44 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x4eIe-00016F-NE
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 12:54:44 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eIe-00Axr0-3c
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 14:54:44 +0200
Received: from [10.42.69.2] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a87c-8faa-0a2a0a5109dd-0a2a4502d926-36
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:44 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a893-6ca4-0a2a45020019-a06583098afc-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:43 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 6529B83BA10A;
 Thu, 10 Sep 2026 08:52:36 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 3/5] Check *Ring for allocation failure
Date: Thu, 10 Sep 2026 13:54:35 +0100
Message-ID: <20260910125437.282-3-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
References: <20260910125437.282-1-owen.smith@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-720697/1789044884-F2EB32AC-71AAF476/0/0
X-purgate-type: clean
X-purgate-size: 579

Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index fcd91ab..93ad5e8 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -2466,7 +2466,7 @@ __ReceiverRingInitialize(
     *Ring = __ReceiverAllocate(sizeof (XENVIF_RECEIVER_RING));
 
     status = STATUS_NO_MEMORY;
-    if (Ring == NULL)
+    if (*Ring == NULL)
         goto fail1;
 
     KeInitializeSpinLock(&(*Ring)->Lock);
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 12:54:46 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 12:54:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414606.1644361 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eIg-00018k-5L; Thu, 10 Sep 2026 12:54:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414606.1644361; Thu, 10 Sep 2026 12:54:46 +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 1x4eIg-00018V-0Z; Thu, 10 Sep 2026 12:54:46 +0000
Received: by outflank-mailman (input) for mailman id 1414606;
 Thu, 10 Sep 2026 12:54:45 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x4eIf-00017p-Fr
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 12:54:45 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eIe-00Anh5-T1
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 14:54:44 +0200
Received: from [10.42.69.6] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a888-2eae-0a2a0a5409dd-0a2a4506969c-20
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:44 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a893-195a-0a2a45060019-a0658309cd02-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:44 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 36ABD83BA10D;
 Thu, 10 Sep 2026 08:52:37 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 4/5] Avoid unbounded write in __PdoParseAddress
Date: Thu, 10 Sep 2026 13:54:36 +0100
Message-ID: <20260910125437.282-4-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
References: <20260910125437.282-1-owen.smith@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-16d1c6/1789044884-FE67277B-339FD427/0/0
X-purgate-type: clean
X-purgate-size: 1203

If a malicious backend sets the "mac" value longer than 6 pairs of
characters, not including the separator characters, it was possible
to write beyond the Address->Byte array.
Stop parsing the string if there are more than 6 hex pairs, and report
this as an invalid "mac" value.

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/pdo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 405506e..82b4de4 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -702,6 +702,10 @@ __PdoParseAddress(
         else
             break;
 
+        status = STATUS_INVALID_PARAMETER;
+        if (Length == ETHERNET_ADDRESS_LENGTH)
+            goto fail1;
+
         Address->Byte[Length++] = Byte;
 
         // Skip over any separator
@@ -711,10 +715,13 @@ __PdoParseAddress(
 
     status = STATUS_INVALID_PARAMETER;
     if (Length != ETHERNET_ADDRESS_LENGTH)
-        goto fail1;
+        goto fail2;
 
     return STATUS_SUCCESS;
 
+fail2:
+    Error("fail2\n");
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 12:54:47 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 12:54:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414607.1644364 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eIh-0001Bd-4F; Thu, 10 Sep 2026 12:54:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414607.1644364; Thu, 10 Sep 2026 12:54:47 +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 1x4eIh-0001BU-1g; Thu, 10 Sep 2026 12:54:47 +0000
Received: by outflank-mailman (input) for mailman id 1414607;
 Thu, 10 Sep 2026 12:54:46 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x4eIg-000191-BU
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 12:54:46 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eIf-000gxc-NQ
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 14:54:45 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a887-bab6-0a2a0a5309dd-0a2a4507e91c-38
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:45 +0200
Received: from [160.101.131.9] (helo=na1pdmzitismtp02.tibco.com)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aa2a894-b4ea-0a2a45070019-a0658309cd10-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 14:54:45 +0200
Received: from mewpvdipd2033.citrite.net (unknown [10.113.48.64])
 by na1pdmzitismtp02.tibco.com (Postfix) with ESMTP id 0699983BA107;
 Thu, 10 Sep 2026 08:52:37 -0400 (EDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; none
From: Owen Smith <owen.smith@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 5/5] Refactor MacQueryState
Date: Thu, 10 Sep 2026 13:54:37 +0100
Message-ID: <20260910125437.282-5-owen.smith@citrix.com>
X-Mailer: git-send-email 2.51.2.windows.1
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
References: <20260910125437.282-1-owen.smith@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-ef75cf/1789044885-378D1AE4-1375626A/0/0
X-purgate-type: clean
X-purgate-size: 2875

- Align __MacGetDisconnect with __MacGetSpeed
- Remove redundant 'if' around MediaConnectState and MediaDuplexDate assignment
- Remove trailing whitespace

Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 src/xenvif/mac.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/xenvif/mac.c b/src/xenvif/mac.c
index 3e4e5b7..3e441a1 100644
--- a/src/xenvif/mac.c
+++ b/src/xenvif/mac.c
@@ -771,15 +771,15 @@ __MacGetDisconnect(
 
     Frontend = Mac->Frontend;
 
+    Disconnect = FALSE;
+
     status = XENBUS_STORE(Read,
                           &Mac->StoreInterface,
                           NULL,
                           FrontendGetPath(Mac->Frontend),
                           "disconnect",
                           &Buffer);
-    if (!NT_SUCCESS(status)) {
-        Disconnect = FALSE;
-    } else {
+    if (NT_SUCCESS(status)) {
         Disconnect = (BOOLEAN)strtol(Buffer, NULL, 2);
 
         XENBUS_STORE(Free,
@@ -793,9 +793,9 @@ __MacGetDisconnect(
 VOID
 MacQueryState(
     IN  PXENVIF_MAC                 Mac,
-    OUT PNET_IF_MEDIA_CONNECT_STATE MediaConnectState OPTIONAL,
-    OUT PULONG64                    LinkSpeed OPTIONAL,
-    OUT PNET_IF_MEDIA_DUPLEX_STATE  MediaDuplexState OPTIONAL
+    OUT PNET_IF_MEDIA_CONNECT_STATE MediaConnectState   OPTIONAL,
+    OUT PULONG64                    LinkSpeed           OPTIONAL,
+    OUT PNET_IF_MEDIA_DUPLEX_STATE  MediaDuplexState    OPTIONAL
     )
 {
     ULONG64 Speed = __MacGetSpeed(Mac);
@@ -804,17 +804,15 @@ MacQueryState(
     if (Speed == 0)
         Disconnect = TRUE;
 
-    if (MediaConnectState != NULL || MediaDuplexState != NULL) {
-        if (MediaConnectState != NULL)
-            *MediaConnectState = (Disconnect) ?
-                                 MediaConnectStateDisconnected :
-                                 MediaConnectStateConnected;
+    if (MediaConnectState != NULL)
+        *MediaConnectState = (Disconnect) ?
+                             MediaConnectStateDisconnected :
+                             MediaConnectStateConnected;
 
-        if (MediaDuplexState != NULL)
-            *MediaDuplexState = (Disconnect) ?
-                                MediaDuplexStateUnknown :
-                                MediaDuplexStateFull;
-    }
+    if (MediaDuplexState != NULL)
+        *MediaDuplexState = (Disconnect) ?
+                            MediaDuplexStateUnknown :
+                            MediaDuplexStateFull;
 
     if (LinkSpeed != NULL)
         *LinkSpeed = Speed;
@@ -823,7 +821,7 @@ MacQueryState(
 VOID
 MacQueryMaximumFrameSize(
     IN  PXENVIF_MAC Mac,
-    OUT PULONG      Size                     
+    OUT PULONG      Size
     )
 {
     *Size = Mac->MaximumFrameSize;
-- 
2.51.2.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:20:37 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:20:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414697.1644444 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4ehg-0006eC-Rd; Thu, 10 Sep 2026 13:20:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414697.1644444; Thu, 10 Sep 2026 13:20:36 +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 1x4ehg-0006e4-OV; Thu, 10 Sep 2026 13:20:36 +0000
Received: by outflank-mailman (input) for mailman id 1414697;
 Thu, 10 Sep 2026 13:20:35 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@swg.vates.tech>)
 id 1x4ehf-0006dy-H1
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:20:35 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4ehe-00FptS-Sj
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:20:34 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@swg.vates.tech>)
 id 6aa2ae99-e002-0a2a0a5209dd-0a2a4503810e-16
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:20:34 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@swg.vates.tech>)
 id 6aa2ae9f-fae8-0a2a45030019-b9ff1c228a0d-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:20:31 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b7a1492000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:20:28 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 107EB81BAF;
 Thu, 10 Sep 2026 15:20:28 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=TzZo1Wo5JUTqAiCeH6OS3rcR3nvh2DGHPHufRKKx1jo=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=V7t8SB7Hq7rhvM8BCXR+fU0KOU4soAbdy8MGhvfDLM27vA742khLba4QqCQ2R9J3URmt8ged0
 TSN4QwBrEVIZO5YFxjWuxmLd9jY1G2XkKN74fntZvo0xyZDiuQqdKghSoF9cXq3RgEOI9jv74y4
 qXYDIVrMtMPBFOW+TBK97hXLBaSsGJL14jKrJOUpO0yPjEaLGpJjOYSLeqneUa+WPSERaQ4+d0c
 kRrkuQXkU8yuKl3oErqQxGrTsZ1opi/yhOkdkPA0t+Rj4dqML4IunayOfM8SqX2l5/DqoImaZzt
 L2LGft7zFTIbBf5KqxvrlwdY5MJpkGAyLLC07vQS/D8w==
X-Zone-Loop: 7819f3fc77c2658ad2e7a6a5351ab0f0512770e1980b
x-campaign-type: default
x-transaction-id: 84645ad3-1047-4aca-b808-e0451156c3d9
x-swg-uid: 01-2547cd8b-d2fa-4c83-9df0-9c92df84149a
X-Mailer: Sweego
Message-ID:
 <1789046428.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@vates.tech>
x-swg-bid: 1789046428.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:20:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/5] Fix IPv6 zero-run compression.
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.78.27b184f4f1750bef.1a08b7a11de.4a428f7d0a90e311=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789046428130
X-purgate-ID: tlsNG-33051d/1789046431-772F54E9-DCFB85E1/0/0
X-purgate-type: clean
X-purgate-size: 2814

---=Part.78.27b184f4f1750bef.1a08b7a11de.4a428f7d0a90e311=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> ZeroIndex was only set when the first zero was found, and ZeroCount is s=
et to
> the longest run of zeros=2E This would incorrectly compress an address w=
ith
> a two runs of zeros, e=2Eg=2E "1:0:0:2:0:0:0:3" to "1::0:0:0:3"=2E
> ZeroIndex should be recalculated whenever a longer run of zeros is detec=
ted,
> so that the above run is correctly compressed to "1:0:2::3"
>=20
> Simplifies the condition detecting an ending zero run, as Index would al=
ways
> be 7 when a trailing ":" is required=2E
>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Hello,

RFC4291#2=2E2 [1] mandates that the "::" can only appear once in an=20
address=2E If there are more than one "::", the address will become ambigu=
ous=2E

[1] https://datatracker=2Eietf=2Eorg/doc/html/rfc4291#section-2=2E2
> ---
>   src/xenvif/frontend=2Ec | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>=20
> diff --git a/src/xenvif/frontend=2Ec b/src/xenvif/frontend=2Ec
> index bece661=2E=2E56fcc30 100644
> --- a/src/xenvif/frontend=2Ec
> +++ b/src/xenvif/frontend=2Ec
> @@ -774,22 +774,21 @@ FrontendDumpIPv6Address(
>               Count =3D 0;
>  =20
>           if (Count > ZeroCount) {
> -            if (Count =3D=3D 1)
> -                ZeroIndex =3D Index;
> +            ZeroIndex =3D 1 + Index - Count;
>               ZeroCount =3D Count;
>           }
>       }
>  =20
>       if (ZeroCount > 1) {
> -        CHAR                        Parts[8][sizeof(":XXXX")];
> +        CHAR                        Parts[8][sizeof(":XXXX")] =3D { 0 }=
;
>  =20
>           for (Index =3D 0; Index < 8; Index++) {
>               // Consecutive 0s are collapsed into a single semicolon, s=
o that
>               // appending :xxxx segments would work naturally=2E
>               // Compensate for the missing appended semicolon if the la=
st word
>               // was also collapsed=2E
> -            if (Index =3D=3D ZeroIndex || (Index =3D=3D 7 &&
> -                                       Index =3D=3D ZeroIndex + ZeroCou=
nt - 1)) {
> +            if (Index =3D=3D ZeroIndex ||
> +                (Index =3D=3D 7 && ZeroIndex + ZeroCount =3D=3D 8)) {
>                   Parts[Index][0] =3D ':';
>                   Parts[Index][1] =3D '\0';
>               } else if (Index > ZeroIndex && Index < ZeroIndex + ZeroCo=
unt) {



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.78.27b184f4f1750bef.1a08b7a11de.4a428f7d0a90e311=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:27:12 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:27:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414710.1644446 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eo4-0006xr-A7; Thu, 10 Sep 2026 13:27:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414710.1644446; Thu, 10 Sep 2026 13:27: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 1x4eo4-0006xk-7f; Thu, 10 Sep 2026 13:27:12 +0000
Received: by outflank-mailman (input) for mailman id 1414710;
 Thu, 10 Sep 2026 13:27:11 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b802e3a000c4f3@swg.vates.tech>)
 id 1x4eo3-0006xe-Nm
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:27:11 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eo3-00Fr2v-4X
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:27:11 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b802e3a000c4f3@swg.vates.tech>)
 id 6aa2b02a-2eae-0a2a0a5409dd-0a2a4503b224-28
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:27:11 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b802e3a000c4f3@swg.vates.tech>)
 id 6aa2b02e-fae8-0a2a45030019-b9ff1c229599-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:27:11 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b802e3a000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:27:08 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id E50388123A;
 Thu, 10 Sep 2026 15:27:07 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=TA1HkdsJQiZCKEtDoutD7T4cL0n4Pck5warIpQFDki4=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=lfpAFw5lTsc1DF3XW/wdJuDFsDFCs1TIqWNbOTVOQW9YWdDVqn1yVgd6W9Ju5k9QD1N84gfwj
 BF6WeiVg4288/6j4vr8k2h57tAOijYW695s+2ULTnHaNkbsPh6/sQ2GbLwtQbEZ6q1vRoTCMDkh
 zvbfYWd6xoemFklktStLpNuISLxJwSp82Fc7ilXYe2amK298JGkU021mNVr0zl4WmgNoJnf5rdS
 +VniUkmEIDZFqtgg1Oaz5NF7jiHRzLC1Oqm7/awELkzaZoy4O0uLW5Y12bHYUrbRTT1l8kZ67nl
 DQMZmRfqyKKn8JCCCEpUTItMG+snzKh8xtojLq9eHE6A==
X-Zone-Loop: 1e57025c1cc578c2d1ed77d5e4a213cbc4e4e8443537
x-campaign-type: default
x-transaction-id: db0c8c60-2f18-43b3-85b6-2a8f5b0a2f59
x-swg-uid: 01-c86da633-30a0-4504-9047-713954c2e2e4
X-Mailer: Sweego
Message-ID:
 <1789046828.8631fc262581453bbf619ec5b2062170.1a08b802e3a000c4f3@vates.tech>
x-swg-bid: 1789046828.8631fc262581453bbf619ec5b2062170.1a08b802e3a000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:27:07 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/5] Fix IPv6 zero-run compression.
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
 <1789046428.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@vates.tech>
Content-Language: en-US
In-Reply-To: <1789046428.8631fc262581453bbf619ec5b2062170.1a08b7a1492000c4f3@vates.tech>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.7a.a871d89496511e57.1a08b802bd2.861bc28ad1743a1b=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789046827986
X-purgate-ID: tlsNG-33051d/1789046831-6E8CD4E9-622237FF/0/0
X-purgate-type: clean
X-purgate-size: 3000

---=Part.7a.a871d89496511e57.1a08b802bd2.861bc28ad1743a1b=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 15:20, Tu Dinh wrote:
> On 10/09/2026 14:54, Owen Smith wrote:
>> ZeroIndex was only set when the first zero was found, and ZeroCount is =
set to
>> the longest run of zeros=2E This would incorrectly compress an address =
with
>> a two runs of zeros, e=2Eg=2E "1:0:0:2:0:0:0:3" to "1::0:0:0:3"=2E
>> ZeroIndex should be recalculated whenever a longer run of zeros is dete=
cted,
>> so that the above run is correctly compressed to "1:0:2::3"
>>
>> Simplifies the condition detecting an ending zero run, as Index would a=
lways
>> be 7 when a trailing ":" is required=2E
>>
>> Assisted-by: ClaudeCode:claude-opus-4=2E8
>> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>
>=20
> Hello,
>=20
> RFC4291#2=2E2 [1] mandates that the "::" can only appear once in an
> address=2E If there are more than one "::", the address will become ambi=
guous=2E
>=20
> [1] https://datatracker=2Eietf=2Eorg/doc/html/rfc4291#section-2=2E2

Apologies, I misread the message=2E I'll verify=2E

>> ---
>>    src/xenvif/frontend=2Ec | 9 ++++-----
>>    1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/xenvif/frontend=2Ec b/src/xenvif/frontend=2Ec
>> index bece661=2E=2E56fcc30 100644
>> --- a/src/xenvif/frontend=2Ec
>> +++ b/src/xenvif/frontend=2Ec
>> @@ -774,22 +774,21 @@ FrontendDumpIPv6Address(
>>                Count =3D 0;
>>   =20
>>            if (Count > ZeroCount) {
>> -            if (Count =3D=3D 1)
>> -                ZeroIndex =3D Index;
>> +            ZeroIndex =3D 1 + Index - Count;
>>                ZeroCount =3D Count;
>>            }
>>        }
>>   =20
>>        if (ZeroCount > 1) {
>> -        CHAR                        Parts[8][sizeof(":XXXX")];
>> +        CHAR                        Parts[8][sizeof(":XXXX")] =3D { 0 =
};
>>   =20
>>            for (Index =3D 0; Index < 8; Index++) {
>>                // Consecutive 0s are collapsed into a single semicolon,=
 so that
>>                // appending :xxxx segments would work naturally=2E
>>                // Compensate for the missing appended semicolon if the =
last word
>>                // was also collapsed=2E
>> -            if (Index =3D=3D ZeroIndex || (Index =3D=3D 7 &&
>> -                                       Index =3D=3D ZeroIndex + ZeroCo=
unt - 1)) {
>> +            if (Index =3D=3D ZeroIndex ||
>> +                (Index =3D=3D 7 && ZeroIndex + ZeroCount =3D=3D 8)) {
>>                    Parts[Index][0] =3D ':';
>>                    Parts[Index][1] =3D '\0';
>>                } else if (Index > ZeroIndex && Index < ZeroIndex + Zero=
Count) {
>=20
>=20
>=20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.7a.a871d89496511e57.1a08b802bd2.861bc28ad1743a1b=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:34:11 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:34:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414727.1644459 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eup-0000Nz-4m; Thu, 10 Sep 2026 13:34:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414727.1644459; Thu, 10 Sep 2026 13:34:11 +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 1x4eup-0000Ns-2A; Thu, 10 Sep 2026 13:34:11 +0000
Received: by outflank-mailman (input) for mailman id 1414727;
 Thu, 10 Sep 2026 13:34:09 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8677e5000c4f3@swg.vates.tech>)
 id 1x4eun-0000Nm-5g
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:34:09 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4euh-008Y0D-F8
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:34:03 +0200
Received: from [10.42.69.11] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8677e5000c4f3@swg.vates.tech>)
 id 6aa2b1bb-8faa-0a2a0a5109dd-0a2a450be91e-38
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:34:03 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8677e5000c4f3@swg.vates.tech>)
 id 6aa2b1ca-b7e8-0a2a450b0019-b9ff1c22b5a9-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:34:03 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b8677e5000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:34:00 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 1400F81CB6;
 Thu, 10 Sep 2026 15:34:00 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=OXGN2FCn2Q0wJ0oJTjkA06UoNgdchCilhoW1a7qwiII=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=k1XSf29I5NRKUaKWvtGb1kMHCtY47ug+lXp7JmXcx/EszUpZ+1fZbB/GT29gCWBuKmKeMNBQ/
 OChvY+51Rh1ccb0PfbyCYGje6Fj17zvkXn74DKwH1aCnMcdUfI4mK73dOnfWaCX5hMUrKkOttbE
 tdFeoz4S/TwLVg2d0Ob7DkEeb+/PfvtOuRWuAv3O/GlYN4AOmggRLTwOzu5wd7EPyvrod0RWmkv
 Zf98yde6KeiKG9dh+9yV2FwqapRg19viQFJzYYAmCYrOdl5++YLL4GM4YOQEVaFe5k0eHQv6ov1
 6k2ovZQrTy6+R6oGfQGNq940sRO2HlSmKOjrrtvv3I4g==
X-Zone-Loop: 17eb4df296791693e5fd28df9cc06b1a9f846ccc8e3b
x-campaign-type: default
x-transaction-id: 835e2821-3ccb-4cbf-b5e2-2ad0c8ffa94a
x-swg-uid: 01-317d67f7-b6bd-46dc-be7f-105dd094d4ba
X-Mailer: Sweego
Message-ID:
 <1789047240.8631fc262581453bbf619ec5b2062170.1a08b8677e5000c4f3@vates.tech>
x-swg-bid: 1789047240.8631fc262581453bbf619ec5b2062170.1a08b8677e5000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:33:59 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/5] Fix IPv6 zero-run compression.
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-1-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.7c.c41a30076e403b3e.1a08b8675d3.7d5992260db32c7e=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789047240148
X-purgate-ID: tlsNG-42698a/1789047243-A82F49EA-E59AE591/0/0
X-purgate-type: clean
X-purgate-size: 2630

---=Part.7c.c41a30076e403b3e.1a08b8675d3.7d5992260db32c7e=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> ZeroIndex was only set when the first zero was found, and ZeroCount is s=
et to
> the longest run of zeros=2E This would incorrectly compress an address w=
ith
> a two runs of zeros, e=2Eg=2E "1:0:0:2:0:0:0:3" to "1::0:0:0:3"=2E
> ZeroIndex should be recalculated whenever a longer run of zeros is detec=
ted,
> so that the above run is correctly compressed to "1:0:2::3"
>=20
> Simplifies the condition detecting an ending zero run, as Index would al=
ways
> be 7 when a trailing ":" is required=2E
>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/frontend=2Ec | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>=20
> diff --git a/src/xenvif/frontend=2Ec b/src/xenvif/frontend=2Ec
> index bece661=2E=2E56fcc30 100644
> --- a/src/xenvif/frontend=2Ec
> +++ b/src/xenvif/frontend=2Ec
> @@ -774,22 +774,21 @@ FrontendDumpIPv6Address(
>               Count =3D 0;
>  =20
>           if (Count > ZeroCount) {
> -            if (Count =3D=3D 1)
> -                ZeroIndex =3D Index;
> +            ZeroIndex =3D 1 + Index - Count;
>               ZeroCount =3D Count;
>           }
>       }
>  =20
>       if (ZeroCount > 1) {
> -        CHAR                        Parts[8][sizeof(":XXXX")];
> +        CHAR                        Parts[8][sizeof(":XXXX")] =3D { 0 }=
;
>  =20
>           for (Index =3D 0; Index < 8; Index++) {
>               // Consecutive 0s are collapsed into a single semicolon, s=
o that
>               // appending :xxxx segments would work naturally=2E
>               // Compensate for the missing appended semicolon if the la=
st word
>               // was also collapsed=2E
> -            if (Index =3D=3D ZeroIndex || (Index =3D=3D 7 &&
> -                                       Index =3D=3D ZeroIndex + ZeroCou=
nt - 1)) {
> +            if (Index =3D=3D ZeroIndex ||
> +                (Index =3D=3D 7 && ZeroIndex + ZeroCount =3D=3D 8)) {
>                   Parts[Index][0] =3D ':';
>                   Parts[Index][1] =3D '\0';
>               } else if (Index > ZeroIndex && Index < ZeroIndex + ZeroCo=
unt) {



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.7c.c41a30076e403b3e.1a08b8675d3.7d5992260db32c7e=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:36:47 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:36:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414729.1644464 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4exL-0000S3-By; Thu, 10 Sep 2026 13:36:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414729.1644464; Thu, 10 Sep 2026 13:36:47 +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 1x4exL-0000Rw-98; Thu, 10 Sep 2026 13:36:47 +0000
Received: by outflank-mailman (input) for mailman id 1414729;
 Thu, 10 Sep 2026 13:36:45 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b88f19c000c4f3@swg.vates.tech>)
 id 1x4exJ-0000Ra-Kq
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:36:45 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4exI-008YSs-PA
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:36:44 +0200
Received: from [10.42.69.5] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b88f19c000c4f3@swg.vates.tech>)
 id 6aa2b265-8faa-0a2a0a5109dd-0a2a45058242-10
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:36:44 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-c201ff.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b88f19c000c4f3@swg.vates.tech>)
 id 6aa2b26c-4cb1-0a2a45050019-b9ff1c239381-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:36:44 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b88f19c000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:36:42 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 2CFE38123A;
 Thu, 10 Sep 2026 15:36:42 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=0Hkt2G2h4TYgaM78a+iq88utt+StHJ5rAeVLSOXj4Pg=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=YGEeekfy/2rM31YT8W0FuqjmuOhpUe0TNXpGxfi1BI7XeGYDt1xr4/4Zr8IrdS3TLAPojLGJ6
 QjFw8PRO7pxl0SQoh8gxyf06lL3RzkV360qz0JBME0WXJyEf5p6qIf1QNxQiGnQCv++gZDAXYuu
 zTwol/Jei1Zi/N/RBP0ZvvLCv5Ut7d2CLlSN0+sh3PeZxooH0ZOFIuHYHvkEP8ZsLJXU9jbHIm8
 qMfuCAihs7se5BVmFUOWAAsFxVY2kwxDo/OXm06/MMkw3CPeNVjdPKURU171000MBh/tCwIycuu
 zVFN4dEm2yrT5M14bVHrSKRWg5Fv/vPfAvCLTBBxni+Q==
X-Zone-Loop: 53910addb597176e8942f514cd10bd015513ad83f800
x-campaign-type: default
x-transaction-id: 81e4a7b3-8c5d-498d-aec5-e8e1f5a8c36d
x-swg-uid: 01-b574cd0b-4f76-4a24-99d5-8144e2d7197a
X-Mailer: Sweego
Message-ID:
 <1789047402.8631fc262581453bbf619ec5b2062170.1a08b88f19c000c4f3@vates.tech>
x-swg-bid: 1789047402.8631fc262581453bbf619ec5b2062170.1a08b88f19c000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:36:41 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/5] Fix potential Use-After-Free in __MacGetSpeed
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
 <20260910125437.282-2-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-2-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.7d.caaef990aa77e05f.1a08b88ef88.b772f3c404d8bfdb=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789047402377
X-purgate-ID: tlsNG-c201ff/1789047404-73CB82A1-1000A351/0/0
X-purgate-type: clean
X-purgate-size: 3086

---=Part.7d.caaef990aa77e05f.1a08b88ef88.b772f3c404d8bfdb=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> If the backend provides a xenstore value for "speed", it can include a u=
nit
> character=2E When parsing this string, the Unit pointer would refer to a=
 buffer
> that gets freed earlier=2E
> Change the parsing to store the Unit value as a single CHAR, so that the
> buffer can be freed without issue=2E
>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/mac=2Ec | 34 +++++++++++++++++++---------------
>   1 file changed, 19 insertions(+), 15 deletions(-)
>=20
> diff --git a/src/xenvif/mac=2Ec b/src/xenvif/mac=2Ec
> index c20f281=2E=2E3e4e5b7 100644
> --- a/src/xenvif/mac=2Ec
> +++ b/src/xenvif/mac=2Ec
> @@ -700,38 +700,42 @@ __MacGetSpeed(
>       PXENVIF_FRONTEND    Frontend;
>       PCHAR               Buffer;
>       ULONG64             Speed;
> -    PCHAR               Unit;
> +    CHAR                Unit;
>       NTSTATUS            status;
>  =20
>       Frontend =3D Mac->Frontend;
>  =20
> +    Speed =3D Mac->Speed;
> +    Unit =3D 'G';
> +
>       status =3D XENBUS_STORE(Read,
>                             &Mac->StoreInterface,
>                             NULL,
>                             FrontendGetPath(Mac->Frontend),
>                             "speed",
>                             &Buffer);
> -    if (!NT_SUCCESS(status)) {
> -        Speed =3D Mac->Speed;
> -        Unit =3D "G";
> -    } else {
> -        Speed =3D _strtoui64(Buffer, &Unit, 10);
> +    if (NT_SUCCESS(status)) {
> +        PCHAR           End;
> +
> +        Speed =3D _strtoui64(Buffer, &End, 10);
>           if (Speed =3D=3D _UI64_MAX)
>               Speed =3D Mac->Speed;
> -        if (*Unit =3D=3D '\0')
> -            Unit =3D "G";
> +
> +        if (*End !=3D '\0') {
> +            Unit =3D *End;
> +
> +            if (*(End + 1) !=3D '\0') {
> +                Warning("INVALID SPEED: %s\n", Buffer);
> +                Speed =3D 0;
> +            }
> +        }
>  =20
>           XENBUS_STORE(Free,
>                        &Mac->StoreInterface,
>                        Buffer);
>       }
>  =20
> -    if (*(Unit + 1) !=3D '\0') {
> -        Warning("INVALID SPEED: %s\n", Buffer);
> -        return 0;
> -    }
> -
> -    switch (*Unit) {
> +    switch (Unit) {
>       case 'g':
>       case 'G':
>           Speed *=3D 1000000000ull;
> @@ -748,7 +752,7 @@ __MacGetSpeed(
>           break;
>  =20
>       default:
> -        Warning("INVALID SPEED UNIT: %c\n", *Unit);
> +        Warning("INVALID SPEED UNIT: %c\n", Unit);
>           return 0;
>       }
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.7d.caaef990aa77e05f.1a08b88ef88.b772f3c404d8bfdb=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:37:13 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:37:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414730.1644468 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4exl-0000Ug-EV; Thu, 10 Sep 2026 13:37:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414730.1644468; Thu, 10 Sep 2026 13:37:13 +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 1x4exl-0000UZ-BW; Thu, 10 Sep 2026 13:37:13 +0000
Received: by outflank-mailman (input) for mailman id 1414730;
 Thu, 10 Sep 2026 13:37:12 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b893ea8000c4f3@swg.vates.tech>)
 id 1x4exk-0000US-3v
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:37:12 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4exi-00Ax0Y-Sa
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:37:10 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b893ea8000c4f3@swg.vates.tech>)
 id 6aa2b273-bab6-0a2a0a5309dd-0a2a450c9fe8-48
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:37:10 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b893ea8000c4f3@swg.vates.tech>)
 id 6aa2b281-f479-0a2a450c0019-b9ff1c23abbb-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:37:05 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b893ea8000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:37:02 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 1DB8F81E0F;
 Thu, 10 Sep 2026 15:37:02 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=XWJ4qOHAme4fCkzw9vkXOtGoicGe3xH0Fha7Zt3kyzA=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=gKr9UhimT7Ch40vLBF8yLJ3pntXwEX3qGwKM+7NbC/++b4IiyW9NlBkDxACCWnW1qcUGf3VRG
 DYtIFt4vaBuT4WT+dKkLmtH/Paiy9QB2o+mfzp+bd2M48B44v0ryY69aiosHHbl8r8bAgQBKycL
 Bl8dquDLl1TVhM+f/5Q7IMTxn4boPfvaN8ILzhLEzFIpfyMEmkP0bkAZueNKk7bkck6fB76tWbc
 YnnhKSHRa4KzxigNcRRti0fQO28TuTYDNQb4VPZiWyZUB6cKLzFUWx3Tda4toW0ejO6LV03iIKV
 TgwlcE0WiMW4HQ4r/dOiq9d60Yuy+zouUjI1m/sY3jrw==
X-Zone-Loop: b757e59cb22097049367800e958bf8fb7c2783e0226c
x-campaign-type: default
x-transaction-id: 5599ce00-ec48-4583-a231-260493f1f502
x-swg-uid: 01-e19de2ff-b2b8-4acc-afe4-449a693585f2
X-Mailer: Sweego
Message-ID:
 <1789047422.8631fc262581453bbf619ec5b2062170.1a08b893ea8000c4f3@vates.tech>
x-swg-bid: 1789047422.8631fc262581453bbf619ec5b2062170.1a08b893ea8000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:37:01 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 3/5] Check *Ring for allocation failure
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
 <20260910125437.282-3-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-3-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.7e.1238716316dafadf.1a08b893cea.7de854a7b5e28422=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789047422186
X-purgate-ID: tlsNG-d25034/1789047425-50B3DA5B-5B9D1A8C/0/0
X-purgate-type: clean
X-purgate-size: 1068

---=Part.7e.1238716316dafadf.1a08b893cea.7de854a7b5e28422=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/receiver=2Ec | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/src/xenvif/receiver=2Ec b/src/xenvif/receiver=2Ec
> index fcd91ab=2E=2E93ad5e8 100644
> --- a/src/xenvif/receiver=2Ec
> +++ b/src/xenvif/receiver=2Ec
> @@ -2466,7 +2466,7 @@ __ReceiverRingInitialize(
>       *Ring =3D __ReceiverAllocate(sizeof (XENVIF_RECEIVER_RING));
>  =20
>       status =3D STATUS_NO_MEMORY;
> -    if (Ring =3D=3D NULL)
> +    if (*Ring =3D=3D NULL)
>           goto fail1;
>  =20
>       KeInitializeSpinLock(&(*Ring)->Lock);



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.7e.1238716316dafadf.1a08b893cea.7de854a7b5e28422=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:38:24 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:38:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414732.1644473 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4eyu-0000hZ-JV; Thu, 10 Sep 2026 13:38:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414732.1644473; Thu, 10 Sep 2026 13:38:24 +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 1x4eyu-0000hS-FU; Thu, 10 Sep 2026 13:38:24 +0000
Received: by outflank-mailman (input) for mailman id 1414732;
 Thu, 10 Sep 2026 13:38:23 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8a60f6000c4f3@swg.vates.tech>)
 id 1x4eyt-0000hM-84
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:38:23 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4eys-008Yfh-KH
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:38:22 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8a60f6000c4f3@swg.vates.tech>)
 id 6aa2b2cd-8faa-0a2a0a5109dd-0a2a45098d48-4
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:38:22 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8a60f6000c4f3@swg.vates.tech>)
 id 6aa2b2ce-be1a-0a2a45090019-b9ff1c22a033-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:38:22 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b8a60f6000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:38:16 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 5ADEA81CAA;
 Thu, 10 Sep 2026 15:38:16 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=mV1cTJyHDxKULSo013nStitukZnnviqsSpzeL1iVCfo=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=CNGw7F41tLEgA2G3xqseNbpk8jEyAxc9Y/PUPdAAc8vr7AeugBAVeP2hOT4u0DOLjX645U0Qa
 cB7Bk/WvrkwKTM1MvIw7WiKxUbv0+553GiigklhYkWC0jr4J/V/AjmgFGAoWb8kwSCbSss381TV
 76pqG3lVX5mHskgwtbt/t+zOVBWU2mXcGZQMkKRVUFwjeDRDiQhB/X82GOCeyjeB14rlCD882Ke
 UH9LssqLPvv/PGm3SWoIT/0mkPLXDnQlQqGYKamlqB/1aalT3I6ajIFaTF/CJ4lrb++1ChQMnpe
 KgbS61fSDwjg4/JVG7f01q8nRWRkzHUKnGKazzlEWtIg==
X-Zone-Loop: 9d3207d2dbe56a8e3236fe44f62c677c305f57b03864
x-campaign-type: default
x-transaction-id: 60221e3a-391d-4319-86e6-444fdce7dfc4
x-swg-uid: 01-c290905e-58ef-44c3-a203-3b2b45380bbc
X-Mailer: Sweego
Message-ID:
 <1789047497.8631fc262581453bbf619ec5b2062170.1a08b8a60f6000c4f3@vates.tech>
x-swg-bid: 1789047497.8631fc262581453bbf619ec5b2062170.1a08b8a60f6000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:38:16 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 4/5] Avoid unbounded write in __PdoParseAddress
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
 <20260910125437.282-4-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-4-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.7f.a0acc15fcc66b1e.1a08b8a5ee7.6ab4ce181609c22c=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789047496424
X-purgate-ID: tlsNG-bad1c0/1789047502-3BED6034-EDD6AFCC/0/0
X-purgate-type: clean
X-purgate-size: 1763

---=Part.7f.a0acc15fcc66b1e.1a08b8a5ee7.6ab4ce181609c22c=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> If a malicious backend sets the "mac" value longer than 6 pairs of
> characters, not including the separator characters, it was possible
> to write beyond the Address->Byte array=2E
> Stop parsing the string if there are more than 6 hex pairs, and report
> this as an invalid "mac" value=2E
>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/pdo=2Ec | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>=20
> diff --git a/src/xenvif/pdo=2Ec b/src/xenvif/pdo=2Ec
> index 405506e=2E=2E82b4de4 100644
> --- a/src/xenvif/pdo=2Ec
> +++ b/src/xenvif/pdo=2Ec
> @@ -702,6 +702,10 @@ __PdoParseAddress(
>           else
>               break;
>  =20
> +        status =3D STATUS_INVALID_PARAMETER;
> +        if (Length =3D=3D ETHERNET_ADDRESS_LENGTH)
> +            goto fail1;
> +
>           Address->Byte[Length++] =3D Byte;
>  =20
>           // Skip over any separator
> @@ -711,10 +715,13 @@ __PdoParseAddress(
>  =20
>       status =3D STATUS_INVALID_PARAMETER;
>       if (Length !=3D ETHERNET_ADDRESS_LENGTH)
> -        goto fail1;
> +        goto fail2;
>  =20
>       return STATUS_SUCCESS;
>  =20
> +fail2:
> +    Error("fail2\n");
> +
>   fail1:
>       Error("fail1 (%08x)\n", status);
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.7f.a0acc15fcc66b1e.1a08b8a5ee7.6ab4ce181609c22c=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 13:43:26 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 13:43:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414735.1644476 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4f3l-0001qg-Um; Thu, 10 Sep 2026 13:43:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414735.1644476; Thu, 10 Sep 2026 13:43:25 +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 1x4f3l-0001qZ-Ri; Thu, 10 Sep 2026 13:43:25 +0000
Received: by outflank-mailman (input) for mailman id 1414735;
 Thu, 10 Sep 2026 13:43:24 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8f057d000c4f3@swg.vates.tech>)
 id 1x4f3k-0001qR-H3
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 13:43:24 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4f3j-00B7LI-I2
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 15:43:23 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8f057d000c4f3@swg.vates.tech>)
 id 6aa2b3f6-e002-0a2a0a5209dd-0a2a4504cdf8-14
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:43:23 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08b8f057d000c4f3@swg.vates.tech>)
 id 6aa2b3fb-b57f-0a2a45040019-b9ff1c128fa7-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 15:43:23 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08b8f057d000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 13:43:21 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id A0BEB81DCB;
 Thu, 10 Sep 2026 15:43:20 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=4ZDCaYgRHj0/jvxJ+sjR+MW7c32B8jgkz1lQ3T+E/ZM=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=p/rmhx6mTyBC+aof8NAPM5MHbSkTebi+R42RPce5dgYCK0yakJaVdDerPlCTVcKb3vDp3vwX8
 OWlcbAb0L1kSiG18Y+QX8Rnfu3JBHe6w4z4njfGu1LaiW5WEFFXlhw+Uk2TmstaplMrXOSgN+1M
 MV/sGqIc9m20yhytMO9n5Sxw3gpHwMvwRZw8OjITWFsNl6FZa38azcHXTcYich3qzOPqp9da8Gj
 oWIADCQPkdiO2VQl07E/a6Y0/lLSHrN7TGkgrmW+nFAWR4Wc7nFFDW3OBvjAh96cdxS9c85w80B
 aHn7YaNdmefo5+DY/Ba31pbl+OVl/HEbZ8v8hc6ZgRNQ==
X-Zone-Loop: deaaf300dfa634fd31ea675e28108c737142c9d4a907
x-campaign-type: default
x-transaction-id: ac47e7f9-1a83-4898-8306-35fc6b676e2b
x-swg-uid: 01-ec16bac3-d211-4ac8-8b54-b57bace8eab5
X-Mailer: Sweego
Message-ID:
 <1789047801.8631fc262581453bbf619ec5b2062170.1a08b8f057d000c4f3@vates.tech>
x-swg-bid: 1789047801.8631fc262581453bbf619ec5b2062170.1a08b8f057d000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Thu, 10 Sep 2026 15:43:20 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 5/5] Refactor MacQueryState
To: Owen Smith <owen.smith@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910125437.282-1-owen.smith@citrix.com>
 <20260910125437.282-5-owen.smith@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910125437.282-5-owen.smith@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.80.caefb134ffeaf4db.1a08b8f0384.8234f5fdf629b2f6=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789047800709
X-purgate-ID: tlsNG-ebf023/1789047803-536C2B50-DD73DC0B/0/0
X-purgate-type: clean
X-purgate-size: 3537

---=Part.80.caefb134ffeaf4db.1a08b8f0384.8234f5fdf629b2f6=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 14:54, Owen Smith wrote:
> - Align __MacGetDisconnect with __MacGetSpeed
> - Remove redundant 'if' around MediaConnectState and MediaDuplexDate ass=
ignment
> - Remove trailing whitespace
>=20
> Signed-off-by: Owen Smith <owen=2Esmith@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/mac=2Ec | 32 +++++++++++++++-----------------
>   1 file changed, 15 insertions(+), 17 deletions(-)
>=20
> diff --git a/src/xenvif/mac=2Ec b/src/xenvif/mac=2Ec
> index 3e4e5b7=2E=2E3e441a1 100644
> --- a/src/xenvif/mac=2Ec
> +++ b/src/xenvif/mac=2Ec
> @@ -771,15 +771,15 @@ __MacGetDisconnect(
>  =20
>       Frontend =3D Mac->Frontend;
>  =20
> +    Disconnect =3D FALSE;
> +
>       status =3D XENBUS_STORE(Read,
>                             &Mac->StoreInterface,
>                             NULL,
>                             FrontendGetPath(Mac->Frontend),
>                             "disconnect",
>                             &Buffer);
> -    if (!NT_SUCCESS(status)) {
> -        Disconnect =3D FALSE;
> -    } else {
> +    if (NT_SUCCESS(status)) {
>           Disconnect =3D (BOOLEAN)strtol(Buffer, NULL, 2);
>  =20
>           XENBUS_STORE(Free,
> @@ -793,9 +793,9 @@ __MacGetDisconnect(
>   VOID
>   MacQueryState(
>       IN  PXENVIF_MAC                 Mac,
> -    OUT PNET_IF_MEDIA_CONNECT_STATE MediaConnectState OPTIONAL,
> -    OUT PULONG64                    LinkSpeed OPTIONAL,
> -    OUT PNET_IF_MEDIA_DUPLEX_STATE  MediaDuplexState OPTIONAL
> +    OUT PNET_IF_MEDIA_CONNECT_STATE MediaConnectState   OPTIONAL,
> +    OUT PULONG64                    LinkSpeed           OPTIONAL,
> +    OUT PNET_IF_MEDIA_DUPLEX_STATE  MediaDuplexState    OPTIONAL
>       )
>   {
>       ULONG64 Speed =3D __MacGetSpeed(Mac);
> @@ -804,17 +804,15 @@ MacQueryState(
>       if (Speed =3D=3D 0)
>           Disconnect =3D TRUE;
>  =20
> -    if (MediaConnectState !=3D NULL || MediaDuplexState !=3D NULL) {
> -        if (MediaConnectState !=3D NULL)
> -            *MediaConnectState =3D (Disconnect) ?
> -                                 MediaConnectStateDisconnected :
> -                                 MediaConnectStateConnected;
> +    if (MediaConnectState !=3D NULL)
> +        *MediaConnectState =3D (Disconnect) ?
> +                             MediaConnectStateDisconnected :
> +                             MediaConnectStateConnected;
>  =20
> -        if (MediaDuplexState !=3D NULL)
> -            *MediaDuplexState =3D (Disconnect) ?
> -                                MediaDuplexStateUnknown :
> -                                MediaDuplexStateFull;
> -    }
> +    if (MediaDuplexState !=3D NULL)
> +        *MediaDuplexState =3D (Disconnect) ?
> +                            MediaDuplexStateUnknown :
> +                            MediaDuplexStateFull;
>  =20
>       if (LinkSpeed !=3D NULL)
>           *LinkSpeed =3D Speed;
> @@ -823,7 +821,7 @@ MacQueryState(
>   VOID
>   MacQueryMaximumFrameSize(
>       IN  PXENVIF_MAC Mac,
> -    OUT PULONG      Size
> +    OUT PULONG      Size
>       )
>   {
>       *Size =3D Mac->MaximumFrameSize;



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.80.caefb134ffeaf4db.1a08b8f0384.8234f5fdf629b2f6=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 16:12:51 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 16:12:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414980.1644594 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4hOM-0004aK-22; Thu, 10 Sep 2026 16:12:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414980.1644594; Thu, 10 Sep 2026 16:12:50 +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 1x4hOL-0004aC-VJ; Thu, 10 Sep 2026 16:12:49 +0000
Received: by outflank-mailman (input) for mailman id 1414980;
 Thu, 10 Sep 2026 16:12:48 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x4hOK-0004Z0-Pr
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 16:12:48 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4hOK-00HIKa-1i
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 18:12:48 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d6fc-8faa-0a2a0a5109dd-0a2a4501979e-4
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:12:47 +0200
Received: from [209.85.208.50] (helo=mail-ed1-f50.google.com)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d6ff-5984-0a2a45010019-d155d032e412-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:12:47 +0200
Received: by mail-ed1-f50.google.com with SMTP id
 4fb4d7f45d1cf-6a601ba6870so10335908a12.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 09:12:47 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2943bb8fdasm170650166b.26.2026.09.10.09.12.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 10 Sep 2026 09:12:45 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789056767; x=1789661567; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=PalHI49F9+FTlO0TlN350Ys2FLlhnPab4FgCP2M8M+8=;
        b=W9+p+Wi9O1REyOiCKbHh3w3uVpuyc7lkixpYoILZcq7iktUWQWEyF5xNCyQHXRM9LZ
         4z65a6QUWWluvR0qc2AZP8AZ/qGjejlfpws34FCwt1UoDbcAt2lpcDoAo1TbKhZXoig6
         p2gOojwvicsW2TGcvCg0bBmP30rFveKlVYXlI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789056767; x=1789661567;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=PalHI49F9+FTlO0TlN350Ys2FLlhnPab4FgCP2M8M+8=;
        b=b+otN0t+tFAFugwvgIAsB8JOSFFxl2/gFdJT9hM5kVb1NfZAkO6zFIcqANK+SxpJnp
         mOEY1grku3CB4rG8Ou2u0N8OWKAp6TiS//QbeFAwofz5c7g6QBlEQ40ezvpHBE+s00HG
         dzhWpBpLvo/D1zShl+xIhep+PT5FnFT0wPQgi9+yPJaj1s4+0iNUBYQbtqJ36zVOrgbi
         2jAblcT2ffbHTaivhty6WBuNLfV0USfK9iCslqTpj/YHsa4q4LbphHnUdQRFBnOuS0H9
         VPczKp/KQ6spGtEovB7B3FbGk8W2Z9eUupCBfUzLU+g4EI7b9PPRICk9uaIvYAssyn7n
         jaNg==
X-Gm-Message-State: AFuF++mzGb3bFJUgLv5+qgjFWwDTmlh/g0Fwz4bpK6J5+Cs0ZUEtP8RO
	ba2RtfBHTfkvA2kaJ9OBOmr9Xm97kmAGGIwq/Me3XNrmRk1yrYH7k/jBZ5HJwyzXa/yVOK9l83n
	r9Fxf
X-Gm-Gg: AYBFou3so0sUMkYTVjKD2vNktchWM+gOtgY+4TzXK8e2oGj8H3nx6QGhyijAoHKFL0f
	++QuHDEdMYXbw4xrKWQoGEOQNF0QyIk10E1aXP3e8i5TEhA3jNb76hTGV8Y2mTCcHAqG2yLW77X
	5lHzVAEV67xBKIlvKZEKCX7q0hWWFRvlkDAKsRYI/E9TAvIojP/kCy1cn5SENrpwkMEQ9dsXiLk
	RgYIuW7TtpA8Gtp5s6c2j8JVSmjKSyT3yMINHGZo48ZU/7G7e2UgHLbKVw29C25WDnhCXtUpiFy
	OPgqqqWHav+2KCdh1/nLAP6I2RTUU53trI6g88pf0jucAd2kRr3kJVWB38ULQ/hZXsA+msLgJlZ
	xftp1Lhe5z5kdugk0Ckjwa3soCAqvfV7/QRJTMsSmZ3BFDRwu6k7aiBzTT6xdEbNb8MRWShm01c
	iUzN6pR3JihNa4+a/AXivtPgg2NYeLZFQbesncYUPJmouAsnZvuDXyjaMwLmUTaHE/sFbB9r/64
	6sh88dB7wHGYY60eATU03TRFWvUrtsFkJ/3Rw==
X-Received: by 2002:a17:907:7293:b0:c29:555e:bef with SMTP id a640c23a62f3a-c29555e0d0fmr124594766b.9.1789056766247;
        Thu, 10 Sep 2026 09:12:46 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 1/3] xenbus/dma: fail on unknown DMA operations version
Date: Thu, 10 Sep 2026 17:10:09 +0100
Message-ID: <20260910161011.1011-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d62444/1789056767-BF86F757-0F401202/0/0
X-purgate-type: clean
X-purgate-size: 999

Return STATUS_NOT_SUPPORTED instead of ASSERT(FALSE) when an unknown
DMA operations size is encountered, preventing copy with unvalidated size.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/dma.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/xenbus/dma.c b/src/xenbus/dma.c
index 206143e..07d4540 100644
--- a/src/xenbus/dma.c
+++ b/src/xenbus/dma.c
@@ -1657,7 +1657,10 @@ DmaGetAdapter(
         break;
 
     default:
-        ASSERT(FALSE);
+        Error("Unknown DMA operations size %lu\n",
+              Context->LowerOperations->Size);
+        status = STATUS_NOT_SUPPORTED;
+        goto fail3;
     }
 
     // Copy in the requisite number of operations
@@ -1688,6 +1691,11 @@ DmaGetAdapter(
 done:
     return Adapter;
 
+fail3:
+    Error("fail3\n");
+
+    DmaDestroyContext(Context);
+
 fail2:
     Error("fail2\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 16:12:59 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 16:12:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414981.1644597 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4hOV-0004cC-3C; Thu, 10 Sep 2026 16:12:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414981.1644597; Thu, 10 Sep 2026 16:12: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 1x4hOV-0004c5-0W; Thu, 10 Sep 2026 16:12:59 +0000
Received: by outflank-mailman (input) for mailman id 1414981;
 Thu, 10 Sep 2026 16:12:57 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x4hOT-0004bw-D4
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 16:12:57 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4hOS-003Fna-Q5
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 18:12:56 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d704-bab6-0a2a0a5309dd-0a2a450c9c7c-20
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:12:56 +0200
Received: from [74.125.228.140] (helo=mail-ej2-f12.google.com)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d708-f479-0a2a450c0019-4a7de48ca173-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:12:56 +0200
Received: by mail-ej2-f12.google.com with SMTP id
 a640c23a62f3a-c254f8694aeso282348966b.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 09:12:56 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2943bb8fdasm170650166b.26.2026.09.10.09.12.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 10 Sep 2026 09:12:55 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789056776; x=1789661576; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=KzZf27u+n9/fSEJM9vGMOelIY3TQYN0stwHNYFPPr6g=;
        b=XuhTHEx38/zf5Hp0PsCAQa6hb9WVzgJ1CB8i+NzhKy1Mpd+ZUBMsj912d/3Yl8u6db
         uMnD1lGRJDZ2ofX3l5zdJD5Al9xZGGKS3UN/my1U/nP+pv0GB4YskI5ILZAiOEIbCsnV
         yBY216bN0ApDkpf26bfZz6jNZKKiUJP7zcFSs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789056776; x=1789661576;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=KzZf27u+n9/fSEJM9vGMOelIY3TQYN0stwHNYFPPr6g=;
        b=ZQVZ9kgruYwnzCZBmJhlc8EAkCzJd0hW4m2lV8wbmOHRTaeouFHT0Desa5OJjzsurT
         TWKD1IoFgb60MeGeZ1XQVZsK05J+Id72h0qg+wOKSJM1l7xFitvsIe4I0KtCBkfcbNNj
         8lhfdci8/Jd7PuxPugvh1MxdQKhjIT0zngOEpEapuW+kfuz9N2u2MA+pFuXLt6fh4hNn
         ECenYklclvqwQhtkfsV1uUvEJdRRYoo0N3qMD4Vg4BzLyYHD70ejtPU6t+hrcUVz1VqI
         LH7Yaj+J+9Xf/yyrkdP42LbwRZKEBUXRc7PCIMgOJ4UqlhIskYo1mtBneSX7CuKn334i
         D5bA==
X-Gm-Message-State: AFuF++nWNeD00Mm9/FvWfiqpS+sE5DgHAbwMh7rFXQjSV8/RsDK6R9ES
	RfvylJ+pmRBSWegp9Zsc2zg08RdFmZia9BWEaoUPrp65zDhoWi5m8GmJPngbFdNSRJFen1kXGMv
	gHx8/Z6U=
X-Gm-Gg: AYBFou1yAh5vGymRAIccZAiz6WLc9cvXSBX0ZOTVPofnV9XbHBhmU6fnMVbnxeSj/Ki
	tdpwcbdyboOF10tzE5D1wIOSsZG53hKG7Hc+/AQTLEqk3gk6XOwAuRGd3551/TSa1vQBiV7+ANR
	Io04GMwHFESSNOcXAbXSHznBPEbCmjAIvUe5caj5RHV2fUXzpoZB/DBACxDJY/Wm+DwMtcIK/hG
	V1k7BN8pLnUGmp8gS6p7mbEYtW17Y7MNNbIj0nNrDhyyWk65TwNAssdZXkbPvKPqaYdJYMd70h/
	3tdpsjk39Ogfu6cDztK0DROdyY6C/a6DhtZ5EY7GKe6T/Azs+rJvhLCgYcvIUXAdm2slvahAi1H
	RhuncTlC1teg+WZuCYqnKYp4n/UTkFcUP+0cJblfFMT+IAM3F5uI19RZVxqirEl4FSN3BxWd4Nx
	Z3Qy0+tH8N1ZxSch3UGiIXvGcVq7RA3z1DpUY1pQ17SqWES/2otKgtQCbDEMmlqPRf1hhCQ8u0Z
	H0eXkPtT5M07s72zkQxFRaL69GCpVf6eI+bGaE=
X-Received: by 2002:a17:907:94cd:b0:c25:35cd:fdb2 with SMTP id a640c23a62f3a-c2962ab5e2fmr7798566b.7.1789056776013;
        Thu, 10 Sep 2026 09:12:56 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 2/3] xenbus/store: guard against NULL payload in StoreParseWatchEvent
Date: Thu, 10 Sep 2026 17:10:10 +0100
Message-ID: <20260910161011.1011-2-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260910161011.1011-1-david.preetham@citrix.com>
References: <20260910161011.1011-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d25034/1789056776-01AC4A5B-C02182F3/0/0
X-purgate-type: clean
X-purgate-size: 1647

Add NULL and zero-length check at the start of StoreParseWatchEvent
to avoid dereferencing a NULL Data pointer.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/store.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index d1b396b..3bdca38 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -623,6 +623,9 @@ StoreParseWatchEvent(
 {
     PSTR            End;
 
+    if (Data == NULL || Length == 0)
+        goto fail1;
+
     *Path = Data;
     while (*Data != '\0' && Length != 0) {
         Data++;
@@ -630,14 +633,14 @@ StoreParseWatchEvent(
     }
 
     if (Length != TOKEN_LENGTH + 1)
-        goto fail1;
+        goto fail2;
 
     // Skip over the NUL
     Data++;
     --Length;
 
     if (Data[Length - 1] != '\0')
-        goto fail2;
+        goto fail3;
 
     if (strncmp(Data, "TOK|", 4) != 0) {
         Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
@@ -646,23 +649,26 @@ StoreParseWatchEvent(
                 Data[2],
                 Data[3]);
 
-        goto fail3;
+        goto fail4;
     }
 
     Data += 4;
     *Caller = (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
 
     if (*End != '|')
-        goto fail4;
+        goto fail5;
 
     Data = End + 1;
     *Id = (USHORT)strtoul(Data, &End, 16);
 
     if (*End != '\0')
-        goto fail5;
+        goto fail6;
 
     return STATUS_SUCCESS;
 
+fail6:
+    Error("fail6\n");
+
 fail5:
     Error("fail5\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 16:13:04 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 16:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1414982.1644601 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4hOa-0004ee-4K; Thu, 10 Sep 2026 16:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1414982.1644601; Thu, 10 Sep 2026 16:13: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 1x4hOa-0004eX-1q; Thu, 10 Sep 2026 16:13:04 +0000
Received: by outflank-mailman (input) for mailman id 1414982;
 Thu, 10 Sep 2026 16:13:02 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x4hOY-0004eB-GJ
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 16:13:02 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4hOX-003Fna-TD
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 18:13:01 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d704-bab6-0a2a0a5309dd-0a2a450c9c7c-32
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:13:01 +0200
Received: from [209.85.218.54] (helo=mail-ej1-f54.google.com)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa2d70d-f479-0a2a450c0019-d155da36cd99-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 18:13:01 +0200
Received: by mail-ej1-f54.google.com with SMTP id
 a640c23a62f3a-c2941f7229dso241607366b.1
 for <win-pv-devel@lists.xenproject.org>; Thu, 10 Sep 2026 09:13:01 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2943bb8fdasm170650166b.26.2026.09.10.09.13.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 10 Sep 2026 09:13:00 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789056781; x=1789661581; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=/fvYR0HxH96aK2Uqvjcs941dNhhU18OPy6TQwHuvjDY=;
        b=I6Yf0zDfO5OqQl62lIv6Ud1rdw8N4MWQ15DZkv0SWONtEVKUQRW9Vwa4gs5iOvJsL1
         umcVkW5TOP6nOHIIKFW6MADmFB1WyB1Oqvt4OsdNClyxcpyi6PEqkGoJKdGXshGIZZxY
         /WRZxepBqxF/m8XFsTVSBKPfGIuapGt9V+Rok=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789056781; x=1789661581;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=/fvYR0HxH96aK2Uqvjcs941dNhhU18OPy6TQwHuvjDY=;
        b=KHb715K9FVBVmhWdoChaZ6VDaOuhIx3bOjYrddqJbTwyq3kDttqiilZpWkELIgSh1O
         CNq0PaVkYz6ilLd+Wj8ZnQkVMmmdOFx7tlSkcd6y7yp0nCdvSWg/GyQBch5d3LQEff+L
         bWBbn97GuRK80KqcbZunEDOL/uj1fBwUO3Qg5NdJVqKTGR6ogroZOmsbJoCheJzOPdCr
         z6CT7nsXxO6+puyvSoqceLUpHSGx1h6PI9NHWkiGs3b18AbiDh3JfWURRVODz9ZXuLan
         Opj/1VP6sKztNKgOJygir9yzzvk39U3b1zLCWO59lyvHRW1gYhl1pyl+IQbIF8ss8OuG
         agHg==
X-Gm-Message-State: AFuF++lqLYS55l8RGdhBBzzg6G6XKLSnT7udwja3IwoGhv2CXqWMaKpK
	Zo1Py8jNsjnOwSG5Ah75YXeqjFH921ySVrexuYQwu4TUCGDKtKb4IELbTKyii0UC7n5Gu2/+RTL
	6qmK1DCc=
X-Gm-Gg: AYBFou0VwCJ36ikV522YNE3OfeFm7SVRSg0WFIpeh9vZueq9Lih7ziSayl9B27THWGK
	AnT1eTvk6TFon7bL5GeCe4foOYhd5D5Vdjghn6+LEmT92OtGE3EaY8tgzWjxXY/H9nwYkhI9CFx
	M4FNWf8oYm3pgEsZFfDTGpyecjSup4oOiH7YFCNOQI8prt/wbE4zo77kFap4iXxtIR3UBq1eL58
	vII4Rwv8vemzVE9omJ6oVSVJEonOAmW2ZDkHdxRzf6Ld13TiOmqbzsx6Qt4c/9QDdhoCbskMtjP
	XfOlqKy9uV8Bzrry3gA3QOaVaLd2lhRYAamLQ5qVqiJCOiIb89iEvX2266nwGD5W5DwVLJdUTn9
	AoShr2ubi5BGfbkiZnBDkehrbidKJSmEczhHd7xSj15FiTlKBrIgGfgNgwOFdID2uxzFm08SeWl
	3pvwrOXXndz12ZabzGzIVPnEkUmBugHL6rs3kVjDz7bNdj4MqhFkCR9kEYCp2fqxTWKt9VQLJuk
	XFezeOFJMYmA1AAOU8d1icxHE0++boI1xT3vUo=
X-Received: by 2002:a17:907:c313:b0:c29:4fcb:2886 with SMTP id a640c23a62f3a-c294fcb2cc1mr176529066b.39.1789056781112;
        Thu, 10 Sep 2026 09:13:01 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 3/3] xenbus/cache: spill slabs on CacheFill failure to prevent pool leak
Date: Thu, 10 Sep 2026 17:10:11 +0100
Message-ID: <20260910161011.1011-3-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260910161011.1011-1-david.preetham@citrix.com>
References: <20260910161011.1011-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d25034/1789056781-01CC3A5B-B3C2E7D3/0/0
X-purgate-type: clean
X-purgate-size: 602

Call CacheSpill on the fail path in CacheFill to release any slabs
already allocated before the failure, preventing a NonPagedPool leak.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/cache.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index 90aea08..363bd29 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -906,6 +906,8 @@ fail5:
 fail4:
     Error("fail4\n");
 
+    CacheSpill(*Cache, 0);
+
 fail3:
     Error("fail3\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 22:14:36 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 22:14:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1415489.1644876 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4n2R-0002UN-1o; Thu, 10 Sep 2026 22:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1415489.1644876; Thu, 10 Sep 2026 22:14:35 +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 1x4n2Q-0002UG-V0; Thu, 10 Sep 2026 22:14:34 +0000
Received: by outflank-mailman (input) for mailman id 1415489;
 Thu, 10 Sep 2026 22:14:33 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d62fea9000c4f3@swg.vates.tech>)
 id 1x4n2P-0002UA-A6
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 22:14:33 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4n2O-000L9O-Ja
 for win-pv-devel@lists.xenproject.org; Fri, 11 Sep 2026 00:14:32 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d62fea9000c4f3@swg.vates.tech>)
 id 6aa32bbd-bab6-0a2a0a5309dd-0a2a4503cbc0-20
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:14:32 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d62fea9000c4f3@swg.vates.tech>)
 id 6aa32bc7-fae8-0a2a45030019-b9ff1c23ae0f-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:14:32 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08d62fea9000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 22:14:30 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id AB50481CF6;
 Fri, 11 Sep 2026 00:14:29 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=ZlXI5AF0lShneHQieetGiuTSO7dI6bdgG9Z2km3NSps=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=g6cwBowsXUaMuZWF/sZhx+vbJPe0potMbcYnHFykNzzOAAKOYhj43Ll95uV9/Wa9n5PQjx2HY
 wqmRcVwdyz5BOSCkw7O4svWZDdTBYVrvgp4mdU682am7cpArK4qqcNmxKA4/Y0s+LFQPkqVJ8+9
 mudMsjpimr+kcsS52+PtgXMaMkkrVYxZTcH5CayfcMRhUW3fbkaSf9QH1kKeOQmEo2CdDFp6dTJ
 By9b2OziT6lYO1HlQMI1FkoH/6aJtKxgL8gkaQl1mE33V3gP5Tj6z4d/n6R5CaujW2KafPU867I
 vKliA/lJ7pgaQr2CIl4bGbi0G8VxrNBZkhxpNCCpkDXw==
X-Zone-Loop: 03b7f69518e2f9d7e19e9ec231b0d034b13ca1f8db4c
x-campaign-type: default
x-transaction-id: 36578f88-ba4d-4c59-a4cf-ba059acac9df
x-swg-uid: 01-e7448f10-1e1b-44c9-8f64-bebbc9c651aa
X-Mailer: Sweego
Message-ID:
 <1789078470.8631fc262581453bbf619ec5b2062170.1a08d62fea9000c4f3@vates.tech>
x-swg-bid: 1789078470.8631fc262581453bbf619ec5b2062170.1a08d62fea9000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 11 Sep 2026 00:14:29 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 3/3] xenbus/cache: spill slabs on CacheFill failure to
 prevent pool leak
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910161011.1011-1-david.preetham@citrix.com>
 <20260910161011.1011-3-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910161011.1011-3-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.97.2350bb20fd0bd6c5.1a08d62fc7b.75aa33a2711a5100=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789078469755
X-purgate-ID: tlsNG-33051d/1789078472-6C2E04E9-1685AC1F/0/0
X-purgate-type: clean
X-purgate-size: 1126

---=Part.97.2350bb20fd0bd6c5.1a08d62fc7b.75aa33a2711a5100=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 18:13, david ambu wrote:
> Call CacheSpill on the fail path in CacheFill to release any slabs
> already allocated before the failure, preventing a NonPagedPool leak=2E
>=20
> Assisted-by: ClaudeCode:claude-sonnet-4-6
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> ---
>   src/xenbus/cache=2Ec | 2 ++
>   1 file changed, 2 insertions(+)
>=20
> diff --git a/src/xenbus/cache=2Ec b/src/xenbus/cache=2Ec
> index 90aea08=2E=2E363bd29 100644
> --- a/src/xenbus/cache=2Ec
> +++ b/src/xenbus/cache=2Ec
> @@ -906,6 +906,8 @@ fail5:
>   fail4:
>       Error("fail4\n");
>  =20
> +    CacheSpill(*Cache, 0);
> +

The CacheSpill in fail5 might need to be deleted to avoid a duplicate=20
CacheSpill?

>   fail3:
>       Error("fail3\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.97.2350bb20fd0bd6c5.1a08d62fc7b.75aa33a2711a5100=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 22:19:40 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 22:19:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1415492.1644879 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4n7M-0002e7-D9; Thu, 10 Sep 2026 22:19:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1415492.1644879; Thu, 10 Sep 2026 22:19:40 +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 1x4n7M-0002e0-AW; Thu, 10 Sep 2026 22:19:40 +0000
Received: by outflank-mailman (input) for mailman id 1415492;
 Thu, 10 Sep 2026 22:19:39 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d679d22000c4f3@swg.vates.tech>)
 id 1x4n7L-0002dt-8m
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 22:19:39 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4n7K-007J11-66
 for win-pv-devel@lists.xenproject.org; Fri, 11 Sep 2026 00:19:38 +0200
Received: from [10.42.69.11] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d679d22000c4f3@swg.vates.tech>)
 id 6aa32c0a-2eae-0a2a0a5409dd-0a2a450be5fa-48
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:19:37 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d679d22000c4f3@swg.vates.tech>)
 id 6aa32cf9-b7e8-0a2a450b0019-b9ff1c229569-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:19:37 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08d679d22000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 22:19:33 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 4C3E381BAE;
 Fri, 11 Sep 2026 00:19:32 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=sVKAUe84DLrx/tLuZNRz+LZw0EYQ+V9g6PWyvGEIpME=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=ew6woM2MJFC1Uyd7JlEyyqR4H+Ymgr3LPHfNNYDSzwPp3Ju8MOqTRy2TnLl2CSVQrWE9aQ6F9
 +utY5yZm4dA2aBjxwoFrXN9Oe5pp4JqDjf/sY2TvuK6Sq86xwPi9076vSi/Ur0ZX401c0Jd/tKT
 CxuPVTVx+cIvIMS5C7Jo6UDbtQd2aajbOUam7RPoXVnrKIqe1Bfdl/niyuqj1B1aSu6891+ArHb
 dmPsUli1lFG0sFvfn6ujVBDmBtWauKknTeBOwpVoodyDfxUf7pUO7XqSv4+huRzZTqqt6TTwTLU
 AovKrSDyGRf2kHZbAJWKFs3ztMp5Vm1rJMPJzBV88ZVQ==
X-Zone-Loop: 1d17224f2ab16ac0ab83d60aba055ffa5c41aa948c1f
x-campaign-type: default
x-transaction-id: 3164ad71-fa7b-426d-91d5-ea4cecfe0f92
x-swg-uid: 01-c0a1f429-2e44-43c7-b23a-c17c7b9bdd6b
X-Mailer: Sweego
Message-ID:
 <1789078773.8631fc262581453bbf619ec5b2062170.1a08d679d22000c4f3@vates.tech>
x-swg-bid: 1789078773.8631fc262581453bbf619ec5b2062170.1a08d679d22000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 11 Sep 2026 00:19:32 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 2/3] xenbus/store: guard against NULL payload in
 StoreParseWatchEvent
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910161011.1011-1-david.preetham@citrix.com>
 <20260910161011.1011-2-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910161011.1011-2-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.98.fa80c79b4cc15413.1a08d679a8a.bc1256e1cafc17b6=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789078772362
X-purgate-ID: tlsNG-42698a/1789078777-1B8D19EA-C476B12B/0/0
X-purgate-type: clean
X-purgate-size: 2441

---=Part.98.fa80c79b4cc15413.1a08d679a8a.bc1256e1cafc17b6=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 18:13, david ambu wrote:
> Add NULL and zero-length check at the start of StoreParseWatchEvent
> to avoid dereferencing a NULL Data pointer=2E
>=20
> Assisted-by: ClaudeCode:claude-sonnet-4-6
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> ---
>   src/xenbus/store=2Ec | 16 +++++++++++-----
>   1 file changed, 11 insertions(+), 5 deletions(-)
>=20
> diff --git a/src/xenbus/store=2Ec b/src/xenbus/store=2Ec
> index d1b396b=2E=2E3bdca38 100644
> --- a/src/xenbus/store=2Ec
> +++ b/src/xenbus/store=2Ec
> @@ -623,6 +623,9 @@ StoreParseWatchEvent(
>   {
>       PSTR            End;
>  =20
> +    if (Data =3D=3D NULL || Length =3D=3D 0)
> +        goto fail1;
> +
>       *Path =3D Data;
>       while (*Data !=3D '\0' && Length !=3D 0) {

When you're at it, could you flip the check here (while (Length !=3D 0 &&=
=20
*Data !=3D '\0'))? Otherwise *Data could dereference beyond what's=20
intended by Length=2E

>           Data++;
> @@ -630,14 +633,14 @@ StoreParseWatchEvent(
>       }
>  =20
>       if (Length !=3D TOKEN_LENGTH + 1)
> -        goto fail1;
> +        goto fail2;
>  =20
>       // Skip over the NUL
>       Data++;
>       --Length;
>  =20
>       if (Data[Length - 1] !=3D '\0')
> -        goto fail2;
> +        goto fail3;
>  =20
>       if (strncmp(Data, "TOK|", 4) !=3D 0) {
>           Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
> @@ -646,23 +649,26 @@ StoreParseWatchEvent(
>                   Data[2],
>                   Data[3]);
>  =20
> -        goto fail3;
> +        goto fail4;
>       }
>  =20
>       Data +=3D 4;
>       *Caller =3D (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
>  =20
>       if (*End !=3D '|')
> -        goto fail4;
> +        goto fail5;
>  =20
>       Data =3D End + 1;
>       *Id =3D (USHORT)strtoul(Data, &End, 16);
>  =20
>       if (*End !=3D '\0')
> -        goto fail5;
> +        goto fail6;
>  =20
>       return STATUS_SUCCESS;
>  =20
> +fail6:
> +    Error("fail6\n");
> +
>   fail5:
>       Error("fail5\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.98.fa80c79b4cc15413.1a08d679a8a.bc1256e1cafc17b6=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 10 22:20:59 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 10 Sep 2026 22:20:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1415496.1644884 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x4n8d-0003gz-IN; Thu, 10 Sep 2026 22:20:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1415496.1644884; Thu, 10 Sep 2026 22:20: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 1x4n8d-0003gs-FS; Thu, 10 Sep 2026 22:20:59 +0000
Received: by outflank-mailman (input) for mailman id 1415496;
 Thu, 10 Sep 2026 22:20:58 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d68d195000c4f3@swg.vates.tech>)
 id 1x4n8c-0003gm-Gs
 for win-pv-devel@lists.xenproject.org; Thu, 10 Sep 2026 22:20:58 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x4n8b-006cfP-U9
 for win-pv-devel@lists.xenproject.org; Fri, 11 Sep 2026 00:20:57 +0200
Received: from [10.42.69.2] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d68d195000c4f3@swg.vates.tech>)
 id 6aa32cd8-bab6-0a2a0a5309dd-0a2a4502b590-38
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:20:53 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a08d68d195000c4f3@swg.vates.tech>)
 id 6aa32d44-6ca4-0a2a45020019-b9ff1c22a757-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 11 Sep 2026 00:20:53 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a08d68d195000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 10 Sep 2026 22:20:51 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 4532881DBA;
 Fri, 11 Sep 2026 00:20:51 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=AEx16xsy+atBr4dj9SO98p3ouQcXY2D+0rE+v3FXby0=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=OmOz1ZpPCRTQhBa2Q4xV9P4+0UTueZ8FOizwS/+3ZC9/ZnyM5u6s0hL10vHBZaQwkl1FqB6Z2
 6YtK9sL2mb/enSpwINZCdh53rwiLtp/2rZuCR92aUPEMjerRKG0DhSEn+QlF+3i/wagKTkDjs6M
 b+Mk1clOQCOKVw72DYOav3B6ov9zqKkQ71jivUa07aVvRo03tiZp7JzITIuVkTUivmYgDRl/YeF
 +G53xGthGNepoKQ+XN7tYKOP5cQfkeB65KvaEHqVYpOPy1g4wLkMaT1OfwRWkqtFb0FUPfFns1O
 rubNU7dQ2Kayx8WxM6G6XJ3R59uOdJSUueG/4t6L2G4w==
X-Zone-Loop: 230593c58fac6bf16dc4e8b41e8bd0a85be341951432
x-campaign-type: default
x-transaction-id: c333bdec-2506-4072-abff-0ca1b2e1e8a4
x-swg-uid: 01-f230a4f4-fae6-4d42-a045-07cf22466b6e
X-Mailer: Sweego
Message-ID:
 <1789078852.8631fc262581453bbf619ec5b2062170.1a08d68d195000c4f3@vates.tech>
x-swg-bid: 1789078852.8631fc262581453bbf619ec5b2062170.1a08d68d195000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 11 Sep 2026 00:20:51 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/3] xenbus/dma: fail on unknown DMA operations version
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910161011.1011-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260910161011.1011-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.99.cc2925ce3a050372.1a08d68cf03.7e7d64c7b0a4e3a1=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789078851331
X-purgate-ID: tlsNG-720697/1789078853-676BF2AC-394388B5/0/0
X-purgate-type: clean
X-purgate-size: 1604

---=Part.99.cc2925ce3a050372.1a08d68cf03.7e7d64c7b0a4e3a1=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/09/2026 18:13, david ambu wrote:
> Return STATUS_NOT_SUPPORTED instead of ASSERT(FALSE) when an unknown
> DMA operations size is encountered, preventing copy with unvalidated siz=
e=2E
>=20
> Assisted-by: ClaudeCode:claude-sonnet-4-6
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>

I'm not too familiar with this code but it looks OK at first glance=2E

Acked-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenbus/dma=2Ec | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>=20
> diff --git a/src/xenbus/dma=2Ec b/src/xenbus/dma=2Ec
> index 206143e=2E=2E07d4540 100644
> --- a/src/xenbus/dma=2Ec
> +++ b/src/xenbus/dma=2Ec
> @@ -1657,7 +1657,10 @@ DmaGetAdapter(
>           break;
>  =20
>       default:
> -        ASSERT(FALSE);
> +        Error("Unknown DMA operations size %lu\n",
> +              Context->LowerOperations->Size);
> +        status =3D STATUS_NOT_SUPPORTED;
> +        goto fail3;
>       }
>  =20
>       // Copy in the requisite number of operations
> @@ -1688,6 +1691,11 @@ DmaGetAdapter(
>   done:
>       return Adapter;
>  =20
> +fail3:
> +    Error("fail3\n");
> +
> +    DmaDestroyContext(Context);
> +
>   fail2:
>       Error("fail2\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.99.cc2925ce3a050372.1a08d68cf03.7e7d64c7b0a4e3a1=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 10:17:48 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 10:17:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420693.1646941 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x63kx-0007h2-3d; Mon, 14 Sep 2026 10:17:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420693.1646941; Mon, 14 Sep 2026 10:17:47 +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 1x63kx-0007gv-17; Mon, 14 Sep 2026 10:17:47 +0000
Received: by outflank-mailman (input) for mailman id 1420693;
 Mon, 14 Sep 2026 10:17:45 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x63kv-0007fR-3U
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 10:17:45 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x63ku-000r1Q-Fh
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 12:17:44 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7c9c3-2eae-0a2a0a5409dd-0a2a4507dedc-22
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 12:17:44 +0200
Received: from [74.125.228.76] (helo=mail-ed2-f12.google.com)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7c9c7-b4ea-0a2a45070019-4a7de44cb3cb-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 12:17:43 +0200
Received: by mail-ed2-f12.google.com with SMTP id
 4fb4d7f45d1cf-6a60591ae45so3911022a12.2
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 03:17:43 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29852497b0sm280021466b.38.2026.09.14.03.17.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2026 03:17:42 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789381063; x=1789985863; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=qN2BAnMnodj/RALVuUsge20WCN5E1dNXGYcnJwMgp2g=;
        b=hmo7gbUHjAg9uEMMzUPiZP2O9ldE+9MRZZh720IIp7KBp1POlwKDkciRXNu0hnoWJU
         Hli6XOJ4TySvMFSe7f8lwKaLKALXrVgtkBvloXQ6Jz1fST0n12N82thVXnNF8fuOvKgF
         fjayIsCea4Mmp6PHflbKoE+2/6sN0a0Yt/9nU=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789381063; x=1789985863;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=qN2BAnMnodj/RALVuUsge20WCN5E1dNXGYcnJwMgp2g=;
        b=nXq7CGVjMjmkCI0EoQbLceVxr09Ah6NXzU/dq80jP0SYrkOIUUpqOTVjPMXYZ18jlF
         4mKt3WJxbM9XO8cASVLD1gFPnrC/rWX0j9fFNjSfoME1ZE4vWYA3vv3ZCNGXqfW3YCZR
         LRZLGjOO2FJ9GhqB7FsEtkrLnjI7XOmL6XeuWe7tugeuSJY9YdRypIdk24uSzIHB3RrT
         IpTX/Y72iebqSpaT0OBmnbc3YvoLU7ohtyq5aU6yCsUyDLR3IbrLe1yo7DAEas1vykkT
         Btrubw2SL4hvpfKZ3yyZNZMdpG0ks/64Zszzkwe4JmOh1aRATiYe7uZgZupv0zbpUy/w
         iBbg==
X-Gm-Message-State: AFuF++kabHB3aFMaaRRTmgYh4gtqbjzi4+1xXtboi6Fwpxn2TiwkEhZ3
	u1QzOm2Q+evtA13uuq4aTdt4mLHBR2o1/DWx6C4Dpxa/efq3vLbOD5eZTz7Ls14f2lOkWa3CU+9
	LRoAu
X-Gm-Gg: AYBFou3125V+l0YjQBTuN/AQ5m86yBl3vhcaKsRC2dcClPeEYEDaC+SKMfg7k+86eoM
	LVxBzF+qr0vsCiWH+OQvZ+hZPVRGhBJ+mB9pe6xEZJdQu4NfoFYEeAmrTwghFhRjcYT6bjw9t/t
	xoVMVDsIXGNj6ra+R5c8BIfra2PY+P/78aX767wJ3BjCIvhBHDKY3VEhzl93gC7z8X2azIXoTGU
	SIPXosEtetJGfku+LgOE7hi1catahs/NEs7kPnS9MG58ag9M6kvyqBR+MOavspbHcKL2mxn0JCH
	sYfk+q/3nYRPQHIwGly8txFRqC9dlotariTYZEvctxx/BnxgbsfV+A/0mo+GxsBt5Rqq7ygM2M+
	4iNg+zL1paw1+ZChJpTZSR1VZDdcos32hICsFWhwgFfy82+Ij1hgpj+e6BLsI/Oi5jPXewtcpqK
	XulXbE70jDeDw6F6WYcrpDLTZeAof8Ha6v5j6vjyeV3EcKjlglmo+KHQ0GUjNy5Kp5Jvth3kaF4
	Noai17SCcTjcVoI+zrEyBhBhwH9HYHy+szygA==
X-Received: by 2002:a05:6402:4490:b0:6a6:32f5:90b4 with SMTP id 4fb4d7f45d1cf-6a9f63999a4mr2394382a12.22.1789381063044;
        Mon, 14 Sep 2026 03:17:43 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH v2 2/3] xenbus/store: guard against NULL payload in StoreParseWatchEvent
Date: Mon, 14 Sep 2026 11:16:02 +0100
Message-ID: <20260914101603.1923-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260910161011.1011-1-david.preetham@citrix.com>
References: <20260910161011.1011-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-ef75cf/1789381064-3C212AE4-0DD7FB78/0/0
X-purgate-type: clean
X-purgate-size: 1671

Add NULL and zero-length check at the start of StoreParseWatchEvent
to avoid dereferencing a NULL Data pointer.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/store.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index d1b396b..bd9067e 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -623,21 +623,24 @@ StoreParseWatchEvent(
 {
     PSTR            End;
 
+    if (Data == NULL || Length == 0)
+        goto fail1;
+
     *Path = Data;
-    while (*Data != '\0' && Length != 0) {
+    while (Length != 0 && *Data != '\0') {
         Data++;
         --Length;
     }
 
     if (Length != TOKEN_LENGTH + 1)
-        goto fail1;
+        goto fail2;
 
     // Skip over the NUL
     Data++;
     --Length;
 
     if (Data[Length - 1] != '\0')
-        goto fail2;
+        goto fail3;
 
     if (strncmp(Data, "TOK|", 4) != 0) {
         Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
@@ -646,23 +649,26 @@ StoreParseWatchEvent(
                 Data[2],
                 Data[3]);
 
-        goto fail3;
+        goto fail4;
     }
 
     Data += 4;
     *Caller = (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
 
     if (*End != '|')
-        goto fail4;
+        goto fail5;
 
     Data = End + 1;
     *Id = (USHORT)strtoul(Data, &End, 16);
 
     if (*End != '\0')
-        goto fail5;
+        goto fail6;
 
     return STATUS_SUCCESS;
 
+fail6:
+    Error("fail6\n");
+
 fail5:
     Error("fail5\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 10:17:52 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 10:17:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420694.1646944 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x63l2-0007l7-58; Mon, 14 Sep 2026 10:17:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420694.1646944; Mon, 14 Sep 2026 10:17: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 1x63l2-0007kz-2T; Mon, 14 Sep 2026 10:17:52 +0000
Received: by outflank-mailman (input) for mailman id 1420694;
 Mon, 14 Sep 2026 10:17:50 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x63l0-0007kn-RO
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 10:17:50 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x63kz-00FKs7-LQ
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 12:17:49 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7c9c6-e002-0a2a0a5209dd-0a2a4501d97c-30
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 12:17:49 +0200
Received: from [74.125.228.140] (helo=mail-ej2-f12.google.com)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7c9cd-5984-0a2a45010019-4a7de48cecab-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 12:17:49 +0200
Received: by mail-ej2-f12.google.com with SMTP id
 a640c23a62f3a-c254f9f0b20so384022566b.3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 03:17:49 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29852497b0sm280021466b.38.2026.09.14.03.17.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2026 03:17:48 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789381069; x=1789985869; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=PZEe1IKFtVuAQfrSoICpcvvkixX7onTBj+ujAQNXzH8=;
        b=bJt7ijbje73YB1wajNmKj0BVDVFzxdQG0MAcXDP2WLy7ZHEWjj48kDgkCXxTogwGZ0
         4pfF2lVsiMYN9EUegEwB/Tv7KOzfq06RRiUNQGyWRwhPwqTivzcpNcr62e+FyzRuhs7G
         0p3RGCfbCImhN+2pbUhDNDvqS5vSYgcCk7jUw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789381069; x=1789985869;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=PZEe1IKFtVuAQfrSoICpcvvkixX7onTBj+ujAQNXzH8=;
        b=Rj4PQnpiEhxCJt4ZafgDi5ECISYwVFqSZBZ5UX3CSfUsGpU5MY1KSNeensKkJHqtTY
         n/7pqYgAVp5iz8zPii/OxM7QuIhCJqqXjT/cPq5hRnxKks0yGulBXm6ku86ZpwGn+JCG
         5CKSTPrEeaq/ffOsx/x+nRvJ7uTaoMjrv+XLakMPG2l1CbjXN8PLnaxnRzv9qSbe6jr6
         c9iZwEj+bLBzOeH1lK5lD+07EKLfIrK0SpDQhvH87oBLA+Yj7bS18g3ACTTjQsIbKWJB
         qv8h2jZpvCxIJWCtMcFA9pcOUcXTplkMsuGOAm7aBogda69HrGAgN/na6pGcPMpxps1p
         ojPw==
X-Gm-Message-State: AFuF++nJ6ullyeoPEb3aRPmjkXbnr/1Az25R7pl4IarCfIIC0RaEfCAc
	khkM422Le3Y60LFAQhsQPigUtRVBdvInT1CmLAjJMZWDzFoZufAAqampdNEI/bP5d/0GYw0injN
	ym1bY
X-Gm-Gg: AYBFou2rO7gwszI2JohitXwLYrZI+WU4+Jc3PZcuM0Kgb4erSvAZgx95n8tmgw39j5L
	F0EfXZwPQ6wiArATGxGn7HpB6dGaeMafaAHbAeQtNqUVW//A1ld8dK20Pzk5k/4pmVcLP8aXPi3
	WoG7UJ1mRyhqbTCafeRKFBkpHOewnjePFMdibdGBRujhwM7Bvx10cYX23x8+NfW2eSiQLoY5awz
	9g6ZBu8KxbBLaui0ExbFVPEzMpb3PpZJV1vc5VXmWa8U5uq0sin1/bSsc0Rs5GYY45TeTrb/VVY
	UBssOf0Qugh3Yd9ZLN7UER9VnxtO+nNAsWpMIj06f3kxfAVmhHnviushmY9WnlSeLqv4m9b6buG
	NokGrDejUxMwB6M6cawZ5MDIsR7y+bKl+gTuYnuk9+E+GEgamBuPSQfpHUCA31NgSGcQaoehWil
	W6wrhSAwuY9DRhRsTuNcwpeAhwypoTiMtJueFJ4ODcLuDszDm56KlS4h79YZHtEWfYmLor8au4m
	TPinySV3nNWfMZ7swNXYzrj8wqN/8cpa/8lhg==
X-Received: by 2002:a17:907:c18:b0:c25:8e53:45ca with SMTP id a640c23a62f3a-c29b87655b6mr201763266b.21.1789381068817;
        Mon, 14 Sep 2026 03:17:48 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH v2 3/3] xenbus/cache: spill slabs on CacheFill failure to prevent pool leak
Date: Mon, 14 Sep 2026 11:16:03 +0100
Message-ID: <20260914101603.1923-2-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260914101603.1923-1-david.preetham@citrix.com>
References: <20260910161011.1011-1-david.preetham@citrix.com>
 <20260914101603.1923-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d62444/1789381069-BE07B757-C9275632/0/0
X-purgate-type: clean
X-purgate-size: 695

Call CacheSpill on the fail path in CacheFill to release any slabs
already allocated before the failure, preventing a NonPagedPool leak.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index 90aea08..ae72464 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -901,11 +901,11 @@ fail5:
 
     (*Cache)->MagazineCount = 0;
 
-    CacheSpill(*Cache, 0);
-
 fail4:
     Error("fail4\n");
 
+    CacheSpill(*Cache, 0);
+
 fail3:
     Error("fail3\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 12:09:04 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 12:09:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420876.1647092 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x65Ue-0007lb-6H; Mon, 14 Sep 2026 12:09:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420876.1647092; Mon, 14 Sep 2026 12:09: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 1x65Ue-0007lS-3l; Mon, 14 Sep 2026 12:09:04 +0000
Received: by outflank-mailman (input) for mailman id 1420876;
 Mon, 14 Sep 2026 12:09:02 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd212eb000c4f3@swg.vates.tech>)
 id 1x65Uc-0007lH-3S
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 12:09:02 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x65Ub-00DEXK-CU
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 14:09:01 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd212eb000c4f3@swg.vates.tech>)
 id 6aa7e3d7-2eae-0a2a0a5409dd-0a2a4503d658-10
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 14:09:01 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd212eb000c4f3@swg.vates.tech>)
 id 6aa7e3dc-fae8-0a2a45030019-b9ff1c2388b1-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 14:09:00 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a09fd212eb000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 14 Sep 2026 12:08:59 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 30A3681F61;
 Mon, 14 Sep 2026 14:08:59 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=ctPXiZgW2HwoU9TAO/n4RfTN8U4Egv8IFkq8YInghl0=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=Qjmc8ongER8g2WrEJ4kYWHqFz+82gpW7LTWVCi73pydUJyKIdQ78Caq6suUatPDznPcIGAVGW
 XDQrP/EtTudleSY9VdqwQPdTNlIiAqpNs7EagYUpR94XWwqmIs/++GobiTAG82TpsAaxg6m4BwO
 2ZYQ95EOpnzGf4sEZY2EUq1E89eWRBGJh3RsXacBVuuujyqX964vgXgugY3jU51s6uk02U0KVO9
 Stthk+4AzvYLCnRHDvnZGrBYw7iN27OOyFdaZj0XCtPilFgMnq8EPu5AFqmgvwV2z2JUsC783c9
 +CB7BoVpnAVeEuoZJzfXzDvEMCEmn+Lrn7ys3QTpgE1Q==
X-Zone-Loop: 55c557582d48ff31814b1cca56a6291047e642e0c5b0
x-campaign-type: default
x-transaction-id: 4bf2f00e-e8f9-4f54-a77c-ca556e7ed918
x-swg-uid: 01-8b34769d-5fe6-4761-853b-0c0d9524dd83
X-Mailer: Sweego
Message-ID:
 <1789387739.8631fc262581453bbf619ec5b2062170.1a09fd212eb000c4f3@vates.tech>
x-swg-bid: 1789387739.8631fc262581453bbf619ec5b2062170.1a09fd212eb000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 14 Sep 2026 14:08:58 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 2/3] xenbus/store: guard against NULL payload in
 StoreParseWatchEvent
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910161011.1011-1-david.preetham@citrix.com>
 <20260914101603.1923-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260914101603.1923-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.10b.d84c57db65b96f9.1a09fd21074.c7be1bdc6b7cbef6=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789387739253
X-purgate-ID: tlsNG-33051d/1789387741-6C8DD4E9-83FA03FD/0/0
X-purgate-type: clean
X-purgate-size: 2495

---=Part.10b.d84c57db65b96f9.1a09fd21074.c7be1bdc6b7cbef6=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 14/09/2026 12:18, david ambu wrote:
> Add NULL and zero-length check at the start of StoreParseWatchEvent
> to avoid dereferencing a NULL Data pointer=2E
>=20
> Assisted-by: ClaudeCode:claude-sonnet-4-6
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

NB: For future updates to patchsets, please send them separately as a=20
new thread rather than in reply to an existing patchset=2E

Thanks,

> ---
>   src/xenbus/store=2Ec | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
>=20
> diff --git a/src/xenbus/store=2Ec b/src/xenbus/store=2Ec
> index d1b396b=2E=2Ebd9067e 100644
> --- a/src/xenbus/store=2Ec
> +++ b/src/xenbus/store=2Ec
> @@ -623,21 +623,24 @@ StoreParseWatchEvent(
>   {
>       PSTR            End;
>  =20
> +    if (Data =3D=3D NULL || Length =3D=3D 0)
> +        goto fail1;
> +
>       *Path =3D Data;
> -    while (*Data !=3D '\0' && Length !=3D 0) {
> +    while (Length !=3D 0 && *Data !=3D '\0') {
>           Data++;
>           --Length;
>       }
>  =20
>       if (Length !=3D TOKEN_LENGTH + 1)
> -        goto fail1;
> +        goto fail2;
>  =20
>       // Skip over the NUL
>       Data++;
>       --Length;
>  =20
>       if (Data[Length - 1] !=3D '\0')
> -        goto fail2;
> +        goto fail3;
>  =20
>       if (strncmp(Data, "TOK|", 4) !=3D 0) {
>           Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
> @@ -646,23 +649,26 @@ StoreParseWatchEvent(
>                   Data[2],
>                   Data[3]);
>  =20
> -        goto fail3;
> +        goto fail4;
>       }
>  =20
>       Data +=3D 4;
>       *Caller =3D (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
>  =20
>       if (*End !=3D '|')
> -        goto fail4;
> +        goto fail5;
>  =20
>       Data =3D End + 1;
>       *Id =3D (USHORT)strtoul(Data, &End, 16);
>  =20
>       if (*End !=3D '\0')
> -        goto fail5;
> +        goto fail6;
>  =20
>       return STATUS_SUCCESS;
>  =20
> +fail6:
> +    Error("fail6\n");
> +
>   fail5:
>       Error("fail5\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.10b.d84c57db65b96f9.1a09fd21074.c7be1bdc6b7cbef6=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 12:09:58 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 12:09:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420879.1647096 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x65VW-0007rY-9T; Mon, 14 Sep 2026 12:09:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420879.1647096; Mon, 14 Sep 2026 12:09:58 +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 1x65VW-0007rR-6y; Mon, 14 Sep 2026 12:09:58 +0000
Received: by outflank-mailman (input) for mailman id 1420879;
 Mon, 14 Sep 2026 12:09:57 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd2e430000c4f3@swg.vates.tech>)
 id 1x65VU-0007rL-VH
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 12:09:56 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x65VU-00Ff1B-7u
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 14:09:56 +0200
Received: from [10.42.69.3] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd2e430000c4f3@swg.vates.tech>)
 id 6aa7e414-8faa-0a2a0a5109dd-0a2a4503967c-0
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 14:09:56 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a09fd2e430000c4f3@swg.vates.tech>)
 id 6aa7e413-fae8-0a2a45030019-b9ff1c228bfb-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 14:09:55 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a09fd2e430000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 14 Sep 2026 12:09:53 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id E8D6281DD6;
 Mon, 14 Sep 2026 14:09:52 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=lmfcVjNfShyo60Qf78bI7exvDiu0tJH/7e2vYwdqCO8=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=mnxaRqHln9uoxJQW94gvOgK+zfxJKELIUl8IoOnTSGTEYdzXSaWX4W8jimvPti6FfGQd0cAcN
 lmtDvGJLoQ8mSHb94URdaFUzbQl0RC0hZm8w5U6oAknXDLilrUxr8NANfoF95t3zYnaHhaM9rJW
 obtH3QNR2Oa1UjanFuQE7kVw+xv/ml6QfVbRVPRwvr//abK+vML4hOhioAQPwXxi/8kONnPV0Jj
 1f4O9RCskrHCLfLyghtOm0H+72iwrQ0NqZ/XqbDlzJQfOuiB59EQ8Y3Vfm25gM0lLq0aXWM0rqL
 SR2TvDUTLwJ867G820p9OVF26xc1BfRBrKIFE4rDSCiA==
X-Zone-Loop: 9100540ac68598a97070422b5958fcc91d8a60c155ad
x-campaign-type: default
x-transaction-id: 46acc245-7bc8-4098-8ea9-9df91cb17969
x-swg-uid: 01-77647904-9f31-4bd4-9d34-be591acd4608
X-Mailer: Sweego
Message-ID:
 <1789387793.8631fc262581453bbf619ec5b2062170.1a09fd2e430000c4f3@vates.tech>
x-swg-bid: 1789387793.8631fc262581453bbf619ec5b2062170.1a09fd2e430000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 14 Sep 2026 14:09:52 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 3/3] xenbus/cache: spill slabs on CacheFill failure to
 prevent pool leak
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260910161011.1011-1-david.preetham@citrix.com>
 <20260914101603.1923-1-david.preetham@citrix.com>
 <20260914101603.1923-2-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260914101603.1923-2-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.10c.e06fc64ba56c4f59.1a09fd2e267.76da1e4097734c20=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789387793000
X-purgate-ID: tlsNG-33051d/1789387796-7488A4E9-3BFBDC95/0/0
X-purgate-type: clean
X-purgate-size: 1324

---=Part.10c.e06fc64ba56c4f59.1a09fd2e267.76da1e4097734c20=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 14/09/2026 12:18, david ambu wrote:
> Call CacheSpill on the fail path in CacheFill to release any slabs
> already allocated before the failure, preventing a NonPagedPool leak=2E
>=20
> Assisted-by: ClaudeCode:claude-sonnet-4-6
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>

The commit message would need to be updated to take the moving of=20
CacheSpill into account=2E

With that done:

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenbus/cache=2Ec | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/src/xenbus/cache=2Ec b/src/xenbus/cache=2Ec
> index 90aea08=2E=2Eae72464 100644
> --- a/src/xenbus/cache=2Ec
> +++ b/src/xenbus/cache=2Ec
> @@ -901,11 +901,11 @@ fail5:
>  =20
>       (*Cache)->MagazineCount =3D 0;
>  =20
> -    CacheSpill(*Cache, 0);
> -
>   fail4:
>       Error("fail4\n");
>  =20
> +    CacheSpill(*Cache, 0);
> +
>   fail3:
>       Error("fail3\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.10c.e06fc64ba56c4f59.1a09fd2e267.76da1e4097734c20=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 13:14:37 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 13:14:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420947.1647145 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x66W4-000496-RA; Mon, 14 Sep 2026 13:14:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420947.1647145; Mon, 14 Sep 2026 13:14:36 +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 1x66W4-00048z-Oh; Mon, 14 Sep 2026 13:14:36 +0000
Received: by outflank-mailman (input) for mailman id 1420947;
 Mon, 14 Sep 2026 13:14:35 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x66W3-00048q-5u
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 13:14:35 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x66Vx-00DQAe-Hi
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 15:14:29 +0200
Received: from [10.42.69.12] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7f332-2eae-0a2a0a5409dd-0a2a450c995c-10
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:14:29 +0200
Received: from [74.125.228.76] (helo=mail-ed2-f12.google.com)
 by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7f335-f479-0a2a450c0019-4a7de44ce262-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:14:29 +0200
Received: by mail-ed2-f12.google.com with SMTP id
 4fb4d7f45d1cf-6a605c198fdso3647671a12.2
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 06:14:29 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29660234f2sm432551166b.12.2026.09.14.06.14.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2026 06:14:27 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789391669; x=1789996469; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=aCxKZyGQURUQTlRcp4wsF7WDPU7RVjq06GfDzAMM5mg=;
        b=kZSFCbIZY7vxOZBUMNUxSu77IUhqH8i84U+T/HlQU/3v2LVnAEqWv5ArMvrW39nv3S
         g/iv99uezXD1w+DpSKHVw4k38GS0w+QHMcJdtzHGgXfir3wxPxYX+rJPTo98jJ9shDiH
         F49abIqPn6ec8L68Zs7I3gbMFcECVPJ2mF+Ww=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789391669; x=1789996469;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=aCxKZyGQURUQTlRcp4wsF7WDPU7RVjq06GfDzAMM5mg=;
        b=FfxT1n17jnOgO6uk7s6dyz/ZQILd261LRfruTlqeqpd7/coCq6beJZ0zGszotIRN55
         RrPC36mTSE5YaVBU5iQVF0hqc81ymxoBYdhvKz7aehO8tBk8xgf7TARXxOveR9LllrmW
         14cUA1b0iSUkTOxQhI8RO9saoLT8IlEBUmRwPl9IQU1c0eky8Hr8ngZNFPFleEWHrf46
         D49HkY25LphJhWWfoqbT0v9NTRRBZBMgnVjleQzMHgSi20dZ2mCm87BL5urj9cbDwfRr
         H5lo/Ge/tBeuSmVaad2lzYprHn3NjK5pxyPbIdVAPjnKDaJ+xGju5KdYIcBzOlM+jtu5
         w/Fw==
X-Gm-Message-State: AFuF++l3og6tfzk0zEwFS/voDD4F4cdsmmJi4uYqilflXa6ND4LW2hBl
	UT156laLL1IxKdstYsx/Q4ZIY7zaY8FGmx/ivHBJtsOtfz2EXWhoMZsG7UkrCV9pZJwcFMCK54F
	qz6YrNaE=
X-Gm-Gg: AYBFou0RyZpUtia4ELdNTq+uG169aHhfARZTFSM1MFtMDLt2Q0lQWz6j2l+aQ3h4Upe
	JrfQ6nfDnC/CqWZ5ndMJ934+bnttA90JE5vFpMdstLAhgAcK8F6JPYWEJ8jrm+FcF5b8c9Yiv5t
	A1VcoVXlzPDUQPXamIBhORmZX5RyfCjt0n4rvcojM4dfkopyDhnkjQH+oPwtEjtFa+QvRCLv4MS
	AZwSNSxRMujxS3pnJkO5qdm9u+6II0RzRErj+0PIg9pLKY9YavBLMxD0rCW8PIwuXrsbjJhI5ak
	b1CrQIP5UkC95qEghCM7QilwKXjV6EvU6mOb5dFATWOyeZ580haaH9ncgBE/J9hUyg0PgEVuaAp
	lGDx/c8yJr3fUhldBjrodzQlA8AfW/H2k2hEz/l73zpNH9vmIZwGLgZGWxFYENKbIEfzTdpLeZy
	1V3DSzze2lTlmKWVUTGVD09G4zJFIcWDHu2SSzsEXXcB6c6iRcUgiF09OaCzw2tpnT2d1yue9pL
	sADHP3AJ6e7HylYaFQZABDyXkxUDM7iaGgOrIZMt45Q6luRBA==
X-Received: by 2002:a17:907:944f:b0:c26:1691:b36b with SMTP id a640c23a62f3a-c29b870b30emr167299166b.36.1789391668582;
        Mon, 14 Sep 2026 06:14:28 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH v2 1/2] xenbus/store: guard against NULL payload in StoreParseWatchEvent
Date: Mon, 14 Sep 2026 14:14:04 +0100
Message-ID: <20260914131405.577-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d25034/1789391669-004CFA5B-5BAFBE32/0/0
X-purgate-type: clean
X-purgate-size: 1671

Add NULL and zero-length check at the start of StoreParseWatchEvent
to avoid dereferencing a NULL Data pointer.

Signed-off-by: david ambu <david.preetham@citrix.com>
Assisted-by: ClaudeCode:claude-sonnet-4-6
---
 src/xenbus/store.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index d1b396b..bd9067e 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -623,21 +623,24 @@ StoreParseWatchEvent(
 {
     PSTR            End;
 
+    if (Data == NULL || Length == 0)
+        goto fail1;
+
     *Path = Data;
-    while (*Data != '\0' && Length != 0) {
+    while (Length != 0 && *Data != '\0') {
         Data++;
         --Length;
     }
 
     if (Length != TOKEN_LENGTH + 1)
-        goto fail1;
+        goto fail2;
 
     // Skip over the NUL
     Data++;
     --Length;
 
     if (Data[Length - 1] != '\0')
-        goto fail2;
+        goto fail3;
 
     if (strncmp(Data, "TOK|", 4) != 0) {
         Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
@@ -646,23 +649,26 @@ StoreParseWatchEvent(
                 Data[2],
                 Data[3]);
 
-        goto fail3;
+        goto fail4;
     }
 
     Data += 4;
     *Caller = (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
 
     if (*End != '|')
-        goto fail4;
+        goto fail5;
 
     Data = End + 1;
     *Id = (USHORT)strtoul(Data, &End, 16);
 
     if (*End != '\0')
-        goto fail5;
+        goto fail6;
 
     return STATUS_SUCCESS;
 
+fail6:
+    Error("fail6\n");
+
 fail5:
     Error("fail5\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 13:14:50 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 13:14:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420950.1647150 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x66WI-0004Dq-TI; Mon, 14 Sep 2026 13:14:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420950.1647150; Mon, 14 Sep 2026 13:14:50 +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 1x66WI-0004Dj-QP; Mon, 14 Sep 2026 13:14:50 +0000
Received: by outflank-mailman (input) for mailman id 1420950;
 Mon, 14 Sep 2026 13:14:48 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x66WG-0004DE-Qo
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 13:14:48 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x66WF-003ptx-Pm
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 15:14:47 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7f33d-2eae-0a2a0a5409dd-0a2a4507b8ee-32
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:14:47 +0200
Received: from [209.85.218.45] (helo=mail-ej1-f45.google.com)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aa7f347-b4ea-0a2a45070019-d155da2de0c1-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:14:47 +0200
Received: by mail-ej1-f45.google.com with SMTP id
 a640c23a62f3a-c29667ed561so401338066b.2
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 06:14:47 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29660234f2sm432551166b.12.2026.09.14.06.14.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2026 06:14:46 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789391687; x=1789996487; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=O3vHcMBWuXcOMDes/Dg4JA3CbvKxHqUopc0WPNU62Rg=;
        b=h+ymVJt56MLzp+fe7B3DIPECyeV76hoNnBCJB1ucLn1a7DSIj6PLWFA1F9V9BbNiHE
         J7XcNjmzzSfFE7wiv9H33R/4XYG/me/XtZKMQJ5wBDxwpmxVF9aJX/dEOGvhiB6baRjA
         rXmFwpkyQPvGgtxfg0F6kC+bSXsH1tpUmbblQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1789391687; x=1789996487;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=O3vHcMBWuXcOMDes/Dg4JA3CbvKxHqUopc0WPNU62Rg=;
        b=PWRD8ecakjlkF2L8nbk13YD6NstJDURLzWmfTe0uNlu4Oh4/52v1xqwEgJDbMhzzPL
         Mih+dZp8kma9HXG6Ll4+VHSQbnsrnHlI3PlllIqTm82StmZBfvpNDYx7otNAQoOAymQj
         aeBBrudFDnyEzZaNp/BCn2lOQTVLvhnzJgKk1zemyl+KJWuAd00Ab/QVLUvcfJL05+Wi
         4uYruKrzBZNUPIn6DvCWLsRf5tZOItxAlMmv7GTYJ74PKjHiwUsQuCn0Sm1YCavtClav
         Rz5ejMRsbfU4UiQ69sLfvP3OQPtjw/ZaawH0zSX2qEV9ZvhOx/XjPI8vbdBawqebwrn/
         GMcw==
X-Gm-Message-State: AFuF++kgurg/JmaJsh5joiVbBhuuiq6YXJHDqSDlNV/c6PDFX2Oy4boR
	NsNs7FsiHhOGA3OId72t1/LwqcPD/+XXtZDS4KDUIiECNclPYeClghXZ4YDCAj8ZD5/8uRAKR1Q
	f0DIn
X-Gm-Gg: AYBFou2KY1qmmsZDfQRygzwqcD20MjEBx5IE8FyY8zp9yB0de5LmEfZ0ojbZNTGEqqC
	9wjAYRsiWXX0q2u2lgNqF/k9ajZToiqyAK4NJ6St24G6JJThBJ1VhD++fKU86TB4iwhY3sznHDl
	c87KaMp1QuXEko+AO2iAMIkFd3sREPxm3K3mG4SqHIvmtYEWBVEWLPpBddzannEdu7n5kd4CgUZ
	bTOjYwaEjtrLsTfabmroP0B2HSAv0AwcnlRIUJW+3DE64Dc3d3ZRACltH3InU+xb+OgPb585Xzn
	LWtrgRvr/sLPGxUahi2coBs9Tunh6mkMe3fTNvICl1dJP7fbTycGkrSRwcLxQAx60ae5s0Sbhuk
	wZXy7xipIGwQ/1pH5wWnXYLaFJsroT4VNbQvxJ/U/6+QsAzsL9VDMuzcoSxeO5AqEjUbtJ2FfFf
	9jTdVnvvBxUF8o35i/99aAMW8B7sQ1nHUfr/CZDdMzugw6U7ZU1jEphTK1RyTKaokrMHB34QbCf
	B5qv0YATNa4rukXDlCkHf/XXCYIyMdWkVa2Uu+TN76uBX9exw==
X-Received: by 2002:a17:907:3c95:b0:c29:3aef:f2e2 with SMTP id a640c23a62f3a-c29b873d5b4mr162401866b.40.1789391686725;
        Mon, 14 Sep 2026 06:14:46 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH v2 2/2] xenbus/cache: spill slabs on CacheFill failure to prevent pool leak
Date: Mon, 14 Sep 2026 14:14:05 +0100
Message-ID: <20260914131405.577-2-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260914131405.577-1-david.preetham@citrix.com>
References: <20260914131405.577-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-ef75cf/1789391687-378D1AE4-10C3AE3C/0/0
X-purgate-type: clean
X-purgate-size: 836

Move CacheSpill from fail5 to fail4 in CacheFill so that all failure
paths release allocated slabs via fall-through, preventing a
NonPagedPool leak. The duplicate CacheSpill at fail5 is removed since
fail5 falls through to fail4 where the single call now handles both
cases.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenbus/cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index 90aea08..ae72464 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -901,11 +901,11 @@ fail5:
 
     (*Cache)->MagazineCount = 0;
 
-    CacheSpill(*Cache, 0);
-
 fail4:
     Error("fail4\n");
 
+    CacheSpill(*Cache, 0);
+
 fail3:
     Error("fail3\n");
 
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Mon Sep 14 13:15:53 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Sep 2026 13:15:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1420955.1647163 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x66XJ-0004YR-7s; Mon, 14 Sep 2026 13:15:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1420955.1647163; Mon, 14 Sep 2026 13:15:53 +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 1x66XJ-0004YM-4i; Mon, 14 Sep 2026 13:15:53 +0000
Received: by outflank-mailman (input) for mailman id 1420955;
 Mon, 14 Sep 2026 13:15:52 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a00f3fcc000c4f3@swg.vates.tech>)
 id 1x66XI-0004Xp-7M
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 13:15:52 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x66XH-00GtQs-KE
 for win-pv-devel@lists.xenproject.org; Mon, 14 Sep 2026 15:15:51 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a00f3fcc000c4f3@swg.vates.tech>)
 id 6aa7f385-8faa-0a2a0a5109dd-0a2a4507d15a-16
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:15:51 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a00f3fcc000c4f3@swg.vates.tech>)
 id 6aa7f386-b4ea-0a2a45070019-b9ff1c229925-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 14 Sep 2026 15:15:51 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0a00f3fcc000c4f3.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 14 Sep 2026 13:15:49 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 61FBD81FDC;
 Mon, 14 Sep 2026 15:15:48 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=PSgDSp9FujqgJFjsUByBzPTQqNh9O7Ka6G2H4o4jNJE=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=MtWpI9qfq7c0ZWRm6Hg96X8aawvyKgC6UsqkMhu7VdboPjyCqaNZpFQ9omrP1OCubQaEmDsEJ
 gfr78BapDBvnYyYVbScXv3y0zKi68q3GPPTxJqCXOBilwKHfoonf1oLOeozpjtEUH/I4W3y7BPV
 z43PkCqQkKwkXvTiScLrWoaeeG2i5bPoIFCfJ5VqS9a8NAGSfeRowq2eL8qSVIsRFsrEOllIlH5
 eH/umDv+9Ua+gmqbXaXSso4514rF5DB1I2/IvSuSvGiWLMX38/rYC+VGg1Cr+ZjgqpchwuEeF6m
 SzV6fGluBk0m/q/jhZXq5+nUVM2PXcHCBF6OHjRhvOsw==
X-Zone-Loop: d3e04986c40348134d241ff364a01b8c4dfe45b3e212
x-campaign-type: default
x-transaction-id: e7f244fa-ba84-424d-9ad2-647b5bca7c6f
x-swg-uid: 01-46513bd0-ba14-436a-87b7-4dfee28f5dc8
X-Mailer: Sweego
Message-ID:
 <1789391749.8631fc262581453bbf619ec5b2062170.1a0a00f3fcc000c4f3@vates.tech>
x-swg-bid: 1789391749.8631fc262581453bbf619ec5b2062170.1a0a00f3fcc000c4f3
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 14 Sep 2026 15:15:48 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v2 1/2] xenbus/store: guard against NULL payload in
 StoreParseWatchEvent
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260914131405.577-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260914131405.577-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.115.4c2a3e604f61dd14.1a0a00f3d60.58ff6f434b479904=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789391748449
X-purgate-ID: tlsNG-ef75cf/1789391751-376D2AE4-F24A8800/0/0
X-purgate-type: clean
X-purgate-size: 2367

---=Part.115.4c2a3e604f61dd14.1a0a00f3d60.58ff6f434b479904=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 14/09/2026 15:14, david ambu wrote:
> Add NULL and zero-length check at the start of StoreParseWatchEvent
> to avoid dereferencing a NULL Data pointer=2E
>=20
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> Assisted-by: ClaudeCode:claude-sonnet-4-6

Both patches:

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenbus/store=2Ec | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
>=20
> diff --git a/src/xenbus/store=2Ec b/src/xenbus/store=2Ec
> index d1b396b=2E=2Ebd9067e 100644
> --- a/src/xenbus/store=2Ec
> +++ b/src/xenbus/store=2Ec
> @@ -623,21 +623,24 @@ StoreParseWatchEvent(
>   {
>       PSTR            End;
>  =20
> +    if (Data =3D=3D NULL || Length =3D=3D 0)
> +        goto fail1;
> +
>       *Path =3D Data;
> -    while (*Data !=3D '\0' && Length !=3D 0) {
> +    while (Length !=3D 0 && *Data !=3D '\0') {
>           Data++;
>           --Length;
>       }
>  =20
>       if (Length !=3D TOKEN_LENGTH + 1)
> -        goto fail1;
> +        goto fail2;
>  =20
>       // Skip over the NUL
>       Data++;
>       --Length;
>  =20
>       if (Data[Length - 1] !=3D '\0')
> -        goto fail2;
> +        goto fail3;
>  =20
>       if (strncmp(Data, "TOK|", 4) !=3D 0) {
>           Warning("UNRECOGNIZED PRE-AMBLE: %02X%02X%02X%02X\n",
> @@ -646,23 +649,26 @@ StoreParseWatchEvent(
>                   Data[2],
>                   Data[3]);
>  =20
> -        goto fail3;
> +        goto fail4;
>       }
>  =20
>       Data +=3D 4;
>       *Caller =3D (PVOID)(ULONG_PTR)_strtoui64(Data, &End, 16);
>  =20
>       if (*End !=3D '|')
> -        goto fail4;
> +        goto fail5;
>  =20
>       Data =3D End + 1;
>       *Id =3D (USHORT)strtoul(Data, &End, 16);
>  =20
>       if (*End !=3D '\0')
> -        goto fail5;
> +        goto fail6;
>  =20
>       return STATUS_SUCCESS;
>  =20
> +fail6:
> +    Error("fail6\n");
> +
>   fail5:
>       Error("fail5\n");
>  =20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.115.4c2a3e604f61dd14.1a0a00f3d60.58ff6f434b479904=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 15 22:47:41 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Sep 2026 22:47:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1422124.1647664 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6bwB-00033w-Qn; Tue, 15 Sep 2026 22:47:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1422124.1647664; Tue, 15 Sep 2026 22:47:39 +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 1x6bwB-00033p-O9; Tue, 15 Sep 2026 22:47:39 +0000
Received: by outflank-mailman (input) for mailman id 1422124;
 Tue, 15 Sep 2026 22:47:38 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@swg.vates.tech>)
 id 1x6bwA-00033g-4P
 for win-pv-devel@lists.xenproject.org; Tue, 15 Sep 2026 22:47:38 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6bw7-008Fbi-QO
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 00:47:35 +0200
Received: from [10.42.69.8] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@swg.vates.tech>)
 id 6aa9cac6-2eae-0a2a0a5409dd-0a2a4508ebac-46
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:47:35 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@swg.vates.tech>)
 id 6aa9cb07-f659-0a2a45080019-b9ff1c12a575-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:47:35 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0a7410bea00072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 15 Sep 2026 22:47:33 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 53F0082ACD;
 Wed, 16 Sep 2026 00:47:32 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=h8Qhed9Dk2viSfu8L2l0sn+OIT0qX2zIvX5grUu2YhM=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:feedback-id;
 b=I+DQrFfEa7NtSXkJV3w5LadlINtvCtbbchTWh9mxYGbQ5Rxw0dN7jaUP1R8hD1inXgvYfmOQF
 /nvmNhdwpu+VpVn5rMJyCrMyBu/YIMCzBt3tnADq5jSQJo0up4XZeH6SDWkd2XJou1AyJ/y5s5F
 o9nC4FsoIDYCl4k741qagaIXI6retLBRCoMsiRJlyWbfKZYu3exSeVvwL3kAqdOo8IdNco70TG9
 lkXhcrkhPbZC9KyBWLrC0+l3rg3wkSjkoBusxzcHZdL6C2jJ7V2EE63Q8sEOk2ByS5UomGpQbb2
 KHZ07mm4oyHTt5UZagMvXiQA2cORFS2Urz061MMa/oKQ==
X-Zone-Loop: 234419d54bc7597f04fd70af2b78d6663ed402b03b42
x-campaign-type: default
x-transaction-id: b54a65b6-49c1-4f52-ae6f-44a8ff604037
x-swg-uid: 01-0c86df07-609b-4254-9084-247a85201fdf
X-Mailer: Sweego
Message-ID:
 <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
x-swg-bid: 1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH 1/3] Capture Context->Request once per SyncWorker iteration
Date: Wed, 16 Sep 2026 00:47:23 +0200
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.187.1ab54af61189a4c0.1a0a741093a.65911789e2681a3=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789512452410
X-purgate-ID: tlsNG-c1860d/1789512455-D634587B-232FA014/0/0
X-purgate-type: clean
X-purgate-size: 2175

---=Part.187.1ab54af61189a4c0.1a0a741093a.65911789e2681a3=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Context->Request is a shared variable and so we must capture it instead
of rereading every time=2E Otherwise, this sequence will be possible:
* A synchronized action (e=2Eg=2E __SyncProcessorDisableInterrupts)
  completes from the owner's viewpoint, but its worker has not finished
  updating Request =3D Context->Request yet;
* The owner sets Context->Request to something else;
* Request =3D Context->Request executes and sets Request to the wrong
  value=2E

Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/xenbus/sync=2Ec | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/xenbus/sync=2Ec b/src/xenbus/sync=2Ec
index eefa2fe=2E=2Ee034153 100644
--- a/src/xenbus/sync=2Ec
+++ b/src/xenbus/sync=2Ec
@@ -284,21 +284,23 @@ SyncWorker(
=20
     Request =3D SYNC_REQUEST_NONE;
     for (;;) {
-        NTSTATUS status;
+        SYNC_REQUEST    Next;
+        NTSTATUS        status;
=20
         KeMemoryBarrier();
+        Next =3D Context->Request;
=20
-        if (Context->Request =3D=3D SYNC_REQUEST_EXIT)
+        if (Next =3D=3D SYNC_REQUEST_EXIT)
             break;
=20
-        if (Context->Request =3D=3D Request) {
+        if (Next =3D=3D Request) {
             _mm_pause();
             continue;
         }
=20
         status =3D STATUS_SUCCESS;
=20
-        switch (Context->Request) {
+        switch (Next) {
         case SYNC_REQUEST_DISABLE_INTERRUPTS:
             status =3D __SyncProcessorDisableInterrupts(&Irql);
             break;
@@ -321,7 +323,7 @@ SyncWorker(
         }
=20
         if (NT_SUCCESS(status))
-            Request =3D Context->Request;
+            Request =3D Next;
     }
=20
     ASSERT3U(KeGetCurrentIrql(), =3D=3D, DISPATCH_LEVEL);
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.187.1ab54af61189a4c0.1a0a741093a.65911789e2681a3=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 15 22:48:23 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Sep 2026 22:48:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1422125.1647668 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6bws-00036y-Tu; Tue, 15 Sep 2026 22:48:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1422125.1647668; Tue, 15 Sep 2026 22:48: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 1x6bws-00036r-Qx; Tue, 15 Sep 2026 22:48:22 +0000
Received: by outflank-mailman (input) for mailman id 1422125;
 Tue, 15 Sep 2026 22:48:21 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b58400072c4@swg.vates.tech>)
 id 1x6bwr-00036e-BI
 for win-pv-devel@lists.xenproject.org; Tue, 15 Sep 2026 22:48:21 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6bwq-00FNuc-ON
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 00:48:20 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b58400072c4@swg.vates.tech>)
 id 6aa9cb2f-8faa-0a2a0a5109dd-0a2a4509d686-4
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:48:20 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b58400072c4@swg.vates.tech>)
 id 6aa9cb34-be1a-0a2a45090019-b9ff1c22a665-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:48:20 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0a741b58400072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 15 Sep 2026 22:48:16 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id E1E0E85C5D;
 Wed, 16 Sep 2026 00:48:15 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=kCa8dhlZNBrQprLlgEaxwjG2vUUXylP3JnxsnAa7VT4=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id;
 b=sBltyIhENzEi23pHk9OS6T9WZEUBekLW+ETPCMOLRic7diMEVCCNSF1MYx7nN31t8ge2lSzaS
 qt55XMhZubb3fOGgPzj8O6Y4cLFab8frQEFK3FwJ6wtxeiNdoQCeW2bZ8UmCbLXdlA0sZ67SEge
 Dck1Cb9JXgYetFfFHVbJwbBU4i8vehTuo2HVBGLWhCZug6NIoR4x3I2eHyH+SS9jBgi78RjD4Nn
 GAeyasgvr4tVsDPICsOk/GxVFoks06mX0/ohQiV9oy9Gd490XwrJ6YtqA9C36A/zHKWrQcdeg18
 MR1mKmMt3I+FdnHiEao20gu7BGfJfyL+Y/EEaeAcVoww==
X-Zone-Loop: 056f5450f1e85e9f5964b862943fb31b9a70e7d91715
x-campaign-type: default
x-transaction-id: 9b9b765d-c9b3-4719-8dfb-1e212f0d9c79
x-swg-uid: 01-f3c04385-fed9-4706-a9be-fa6ec708dd84
X-Mailer: Sweego
Message-ID:
 <1789512496.8631fc262581453bbf619ec5b2062170.1a0a741b58400072c4@vates.tech>
x-swg-bid: 1789512496.8631fc262581453bbf619ec5b2062170.1a0a741b58400072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH 2/3] sync: Wait for interrupts to be disabled
Date: Wed, 16 Sep 2026 00:48:10 +0200
In-Reply-To: <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
References: <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.188.e624faca42eccfc4.1a0a741b36e.c5cd353917942670=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789512495982
X-purgate-ID: tlsNG-bad1c0/1789512500-FDC6D034-668455BD/0/0
X-purgate-type: clean
X-purgate-size: 3160

---=Part.188.e624faca42eccfc4.1a0a741b36e.c5cd353917942670=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Currently, SyncDisableInterrupts doesn't wait for _disable() to be
issued=2E So SuspendTrigger can issue a suspend before all CPUs have
actually reached a quiescent state=2E

In each worker, increment CompletionCount again after _disable()=2E Wait
for all sync workers to actually issue _disable() in
SyncDisableInterrupts by making sure that CompletionCount reaches 2x the
CPU count=2E

Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/xenbus/sync=2Ec | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/xenbus/sync=2Ec b/src/xenbus/sync=2Ec
index e034153=2E=2E61f9a00 100644
--- a/src/xenbus/sync=2Ec
+++ b/src/xenbus/sync=2Ec
@@ -170,7 +170,7 @@ __SyncProcessorDisableInterrupts(
     while (++Attempts <=3D 1000) {
         KeMemoryBarrier();
=20
-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount >=3D Context->ProcessorCount)
             break;
=20
         _mm_pause();
@@ -180,7 +180,7 @@ __SyncProcessorDisableInterrupts(
         Old =3D Context->CompletionCount;
         New =3D Old - 1;
=20
-        if (Old =3D=3D Context->ProcessorCount)
+        if (Old >=3D Context->ProcessorCount)
             break;
     } while (InterlockedCompareExchange(&Context->CompletionCount, New, O=
ld) !=3D Old);
=20
@@ -189,8 +189,10 @@ __SyncProcessorDisableInterrupts(
         status =3D STATUS_UNSUCCESSFUL;
     }
=20
-    if (NT_SUCCESS(status))
+    if (NT_SUCCESS(status)) {
         _disable();
+        InterlockedIncrement(&Context->CompletionCount);
+    }
=20
     return status;
 }
@@ -237,8 +239,8 @@ __SyncProcessorRunLate(
 }
=20
 static FORCEINLINE VOID
-__SyncWait(
-    VOID
+__SyncWaitTarget(
+    LONG            Target
     )
 {
     PSYNC_CONTEXT   Context =3D &SyncContext;
@@ -246,13 +248,23 @@ __SyncWait(
     for (;;) {
         KeMemoryBarrier();
=20
-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount =3D=3D Target)
             break;
=20
         _mm_pause();
     }
 }
=20
+static FORCEINLINE VOID
+__SyncWait(
+    VOID
+    )
+{
+    PSYNC_CONTEXT   Context =3D &SyncContext;
+
+    __SyncWaitTarget(Context->ProcessorCount);
+}
+
 _Use_decl_annotations_
 VOID
 SyncWorker(
@@ -419,8 +431,10 @@ SyncDisableInterrupts(
     for (;;) {
         status =3D __SyncProcessorDisableInterrupts(Irql);
         _Analysis_assume_(NT_SUCCESS(status));
-        if (NT_SUCCESS(status))
+        if (NT_SUCCESS(status)) {
+            __SyncWaitTarget(2 * Context->ProcessorCount);
             return status;
+        }
=20
         LogPrintf(LOG_LEVEL_WARNING, "SYNC: RE-TRY\n");
     }
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.188.e624faca42eccfc4.1a0a741b36e.c5cd353917942670=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 15 22:48:23 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Sep 2026 22:48:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1422126.1647674 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6bwt-00037I-1x; Tue, 15 Sep 2026 22:48:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1422126.1647674; Tue, 15 Sep 2026 22:48:23 +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 1x6bws-000375-Sn; Tue, 15 Sep 2026 22:48:22 +0000
Received: by outflank-mailman (input) for mailman id 1422126;
 Tue, 15 Sep 2026 22:48:21 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b61800072c4@swg.vates.tech>)
 id 1x6bwr-00036d-OL
 for win-pv-devel@lists.xenproject.org; Tue, 15 Sep 2026 22:48:21 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6bwq-002fUa-OA
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 00:48:20 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b61800072c4@swg.vates.tech>)
 id 6aa9cad5-bab6-0a2a0a5309dd-0a2a45079566-26
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:48:20 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0a741b61800072c4@swg.vates.tech>)
 id 6aa9cb34-b4ea-0a2a45070019-b9ff1c23a609-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 00:48:20 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0a741b61800072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Tue, 15 Sep 2026 22:48:16 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 2E0C98630E;
 Wed, 16 Sep 2026 00:48:16 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=ZT1uzJycgqeykuzHCM1zeAA4CHWGtl2j2wW9vaKI8O4=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id;
 b=TKWjjx+KoLu4UOFYxXo5ibKq5RcRcf5ELK2pPwQyl8o000NPRY8inb4b2N1Qky0LO9wZ4FNv2
 XN1EOnXjSd35SXjPG6oJHb4GGMZ2RnA+HKJoZoh81TJLaePb2UTRJt19k6LLCCkeXtTyIwxKwig
 +FDVzKJtHPJ5CXSVBkh0qqhtkoqw8KkP8NGvlvQHu23TzWEeyohhMSL03w9o/1AFAuucECuDUtk
 hidZRBmKc3Yyf3ue8oNfP/Z+1QhVp+43YnbOQWlp7QCKFiWQzCkDRK+6zmGh0wCTCJlkLYNLV4N
 IS6JTV2OW+pK9195pruWp1C58hYABB6UPFA/UxfRlaBg==
X-Zone-Loop: 8a959be99c1b0dfccc87184b147b89e4092e4e723989
x-campaign-type: default
x-transaction-id: ca75e2a6-4244-4059-80bc-fed8e4394f83
x-swg-uid: 01-75934e92-a2b3-4774-9af0-80e172cc7d26
X-Mailer: Sweego
Message-ID:
 <1789512496.8631fc262581453bbf619ec5b2062170.1a0a741b61800072c4@vates.tech>
x-swg-bid: 1789512496.8631fc262581453bbf619ec5b2062170.1a0a741b61800072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH 3/3] Move TIME_* macros to util.h
Date: Wed, 16 Sep 2026 00:48:11 +0200
In-Reply-To: <20260915224814.44-1-ngoc-tu.dinh@vates.tech>
References: <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
 <20260915224814.44-1-ngoc-tu.dinh@vates.tech>
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.189.340308c54565f881.1a0a741b46f.ea33b08bdf57e5bf=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789512496239
X-purgate-ID: tlsNG-ef75cf/1789512500-35CC7AE4-A4E928E7/0/0
X-purgate-type: clean
X-purgate-size: 3043

---=Part.189.340308c54565f881.1a0a741b46f.ea33b08bdf57e5bf=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

These macros were being repeatedly used and so should share the same
definition=2E

Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/common/util=2Eh  |  5 +++++
 src/xenbus/cache=2Ec |  5 -----
 src/xenbus/fdo=2Ec   |  5 -----
 src/xenbus/store=2Ec | 10 ----------
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/common/util=2Eh b/src/common/util=2Eh
index dbf64fd=2E=2E36f71f9 100644
--- a/src/common/util=2Eh
+++ b/src/common/util=2Eh
@@ -41,6 +41,11 @@
 #define	P2ROUNDUP(_t, _x, _a)   \
         (-(-((_t)(_x)) & -(((_t)(_a)))))
=20
+#define TIME_US(_us)            ((_us) * 10ll)
+#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
+#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
+#define TIME_RELATIVE(_t)       (-(_t))
+
 static FORCEINLINE LONG
 __ffs(
     _In_ unsigned long long mask
diff --git a/src/xenbus/cache=2Ec b/src/xenbus/cache=2Ec
index ae72464=2E=2Ee513f77 100644
--- a/src/xenbus/cache=2Ec
+++ b/src/xenbus/cache=2Ec
@@ -1056,11 +1056,6 @@ CacheDebugCallback(
     }
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_CACHE_MONITOR_PERIOD 5
=20
 static NTSTATUS
diff --git a/src/xenbus/fdo=2Ec b/src/xenbus/fdo=2Ec
index 50075f7=2E=2E0537654 100644
--- a/src/xenbus/fdo=2Ec
+++ b/src/xenbus/fdo=2Ec
@@ -1642,11 +1642,6 @@ loop:
     return STATUS_SUCCESS;
 }
=20
-#define TIME_US(_us)            ((_us) * 10ll)
-#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
-#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
-#define TIME_RELATIVE(_t)       (-(_t))
-
 static FORCEINLINE NTSTATUS
 __FdoBalloonSetActive(
     _In_ PXENBUS_FDO        Fdo
diff --git a/src/xenbus/store=2Ec b/src/xenbus/store=2Ec
index bd9067e=2E=2Efe3efcc 100644
--- a/src/xenbus/store=2Ec
+++ b/src/xenbus/store=2Ec
@@ -909,11 +909,6 @@ StoreDpc(
     __StorePoll(Context);
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_POLL_PERIOD 5
=20
 static PXENBUS_STORE_RESPONSE
@@ -1994,11 +1989,6 @@ StorePoll(
     __StorePoll(Interface->Context);
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_WATCHDOG_PERIOD 15
=20
 static NTSTATUS
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.189.340308c54565f881.1a0a741b46f.ea33b08bdf57e5bf=---


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 16 12:32:25 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Sep 2026 12:32:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1423071.1648352 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6ooK-0004U6-6H; Wed, 16 Sep 2026 12:32:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1423071.1648352; Wed, 16 Sep 2026 12:32:24 +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 1x6ooK-0004Tq-3V; Wed, 16 Sep 2026 12:32:24 +0000
Received: by outflank-mailman (input) for mailman id 1423071;
 Wed, 16 Sep 2026 12:32:23 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa341c1500072c4@swg.vates.tech>)
 id 1x6ooI-0004Se-MC
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 12:32:23 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6ooI-00AKSR-2o
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 14:32:22 +0200
Received: from [10.42.69.6] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa341c1500072c4@swg.vates.tech>)
 id 6aaa8c42-e002-0a2a0a5209dd-0a2a4506bdaa-44
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:32:21 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa341c1500072c4@swg.vates.tech>)
 id 6aaa8c53-195a-0a2a45060019-b9ff1c228ddf-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:32:19 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0aa341c1500072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 16 Sep 2026 12:32:16 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 5AC9181F33
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:32:16 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=sI2rXEc4vRfeev3/75jIaiWOUP/85u5aJY3VDF52A/Y=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=QLxLj6g0x9rgnwooDA2DeGCultPUu3uv4qOrpowSdqBMlik5FeEUuCM05LQY9FZllHXs6Jmpj
 G/6vfCniVJ64o6UChfj4XUikyALmezcQKuEvLYzl+6/HhGdYwpzAs4i7gzYku4+4aMV5zlHelZp
 wYlyo+bnWrRzM8SuCb1Cl+t6fQaxhDNA2HpUR7y0Jje2OJZtw8ndLNz6L/pWablJC5bZWcOKLfw
 uJGwzi0stOZYVOqC0E+jPlzRLPD/5CmDjftOxSVBH+50mm4pj3XJCTstmSTes1TZYm9WzTt66wE
 9dLihvSp5LTINMvKXdAZvJn26eY7BXqVFKHkFFjcXLBA==
X-Zone-Loop: 23159e125bf4435fa818025e5a7b73a85e29ac70d6ac
x-campaign-type: default
x-transaction-id: 01d7b810-022d-4ec3-ab9b-e8b1bbc0b866
x-swg-uid: 01-c9de5169-b5c4-4a8f-8ff9-eed7cb34a32f
X-Mailer: Sweego
Message-ID:
 <1789561936.8631fc262581453bbf619ec5b2062170.1a0aa341c1500072c4@vates.tech>
x-swg-bid: 1789561936.8631fc262581453bbf619ec5b2062170.1a0aa341c1500072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Wed, 16 Sep 2026 14:32:15 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/3] Capture Context->Request once per SyncWorker
 iteration
To: win-pv-devel@lists.xenproject.org
References: <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <1789512453.8631fc262581453bbf619ec5b2062170.1a0a7410bea00072c4@vates.tech>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.1c3.da200392e039572b.1a0aa341a1f.5bce0e04bc4e5459=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789561936415
X-purgate-ID: tlsNG-16d1c6/1789561939-FC20077B-EE6773B8/0/0
X-purgate-type: clean
X-purgate-size: 2604

---=Part.1c3.da200392e039572b.1a0aa341a1f.5bce0e04bc4e5459=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 16/09/2026 00:48, Tu Dinh wrote:
> Context->Request is a shared variable and so we must capture it instead
> of rereading every time=2E Otherwise, this sequence will be possible:
> * A synchronized action (e=2Eg=2E __SyncProcessorDisableInterrupts)
>    completes from the owner's viewpoint, but its worker has not finished
>    updating Request =3D Context->Request yet;
> * The owner sets Context->Request to something else;
> * Request =3D Context->Request executes and sets Request to the wrong
>    value=2E
>=20
> Assisted-by: LLM
> Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
> ---
>   src/xenbus/sync=2Ec | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>=20
> diff --git a/src/xenbus/sync=2Ec b/src/xenbus/sync=2Ec
> index eefa2fe=2E=2Ee034153 100644
> --- a/src/xenbus/sync=2Ec
> +++ b/src/xenbus/sync=2Ec
> @@ -284,21 +284,23 @@ SyncWorker(
>  =20
>       Request =3D SYNC_REQUEST_NONE;
>       for (;;) {
> -        NTSTATUS status;
> +        SYNC_REQUEST    Next;
> +        NTSTATUS        status;
>  =20
>           KeMemoryBarrier();
> +        Next =3D Context->Request;

This read should be replaced with ReadAcquire((LONG *)&Context->Request)=
=20
in order to ensure that the fetch itself is done exactly once as opposed=
=20
to being invented by the compiler=2E ReadAcquire also makes the full=20
barrier unnecessary=2E I'll send a v2=2E

>  =20
> -        if (Context->Request =3D=3D SYNC_REQUEST_EXIT)
> +        if (Next =3D=3D SYNC_REQUEST_EXIT)
>               break;
>  =20
> -        if (Context->Request =3D=3D Request) {
> +        if (Next =3D=3D Request) {
>               _mm_pause();
>               continue;
>           }
>  =20
>           status =3D STATUS_SUCCESS;
>  =20
> -        switch (Context->Request) {
> +        switch (Next) {
>           case SYNC_REQUEST_DISABLE_INTERRUPTS:
>               status =3D __SyncProcessorDisableInterrupts(&Irql);
>               break;
> @@ -321,7 +323,7 @@ SyncWorker(
>           }
>  =20
>           if (NT_SUCCESS(status))
> -            Request =3D Context->Request;
> +            Request =3D Next;
>       }
>  =20
>       ASSERT3U(KeGetCurrentIrql(), =3D=3D, DISPATCH_LEVEL);



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.1c3.da200392e039572b.1a0aa341a1f.5bce0e04bc4e5459=---


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 16 12:35:04 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Sep 2026 12:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1423072.1648356 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6oqu-0005CS-DF; Wed, 16 Sep 2026 12:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1423072.1648356; Wed, 16 Sep 2026 12:35: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 1x6oqu-0005CK-Aa; Wed, 16 Sep 2026 12:35:04 +0000
Received: by outflank-mailman (input) for mailman id 1423072;
 Wed, 16 Sep 2026 12:35:02 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@swg.vates.tech>)
 id 1x6oqs-0005CE-Jw
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 12:35:02 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6oqs-005m5V-0c
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 14:35:02 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@swg.vates.tech>)
 id 6aaa8cf5-8faa-0a2a0a5109dd-0a2a4504d57c-2
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:01 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@swg.vates.tech>)
 id 6aaa8cf4-b57f-0a2a45040019-b9ff1c22a7b7-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:00 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0aa368e5a00072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 16 Sep 2026 12:34:57 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id B9BA481038;
 Wed, 16 Sep 2026 14:34:56 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=iw2w4/XBAtM5Dz8kvZ7Z0shK7D9qsSWq/7HGX0Gat4s=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:feedback-id;
 b=fGBmZV8OyDTFjD3fNzqlpYDgNc/IApF2F1ILWf2IBiYWmuwP9TqzpnIwrByg6nyPyKZpteZkT
 lMzIysPEJf8x4CraeShyWq4ipJmMg4nAkRCulPrF21gGVR/YgJOPy4KiBOrMw8PACoSd1ht02MV
 Zbx2UK6n8FLCKvZh23dFqV7PG8SIrmrdvH5sd/oFJavEigcNByV/MpVwUisaVGatfjFapdy3yyR
 N5mSg0n5Va12p1SEQqJItmSf0+UZjrxa35wUXj8UhRVCuBe/KUkP6eaF04KV5yqHsX97+gIC9xu
 ituyrGi2p1ruj6s5TFfTFAcRrrJw+Y136quAiqk+pbPg==
X-Zone-Loop: 624af92a852cacad59c1f556aa9c501ea6bb455a642d
x-campaign-type: default
x-transaction-id: 01fc8016-54ca-4a48-9f85-2bdd73f88307
x-swg-uid: 01-c61ee44c-2f13-40ad-bd2a-59889f1cb6d8
X-Mailer: Sweego
Message-ID:
 <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
x-swg-bid: 1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH v2 1/3] Capture Context->Request once per SyncWorker iteration
Date: Wed, 16 Sep 2026 14:34:53 +0200
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.1c5.d6ea32bcd34c0476.1a0aa368cac.7f62f70e1cff193c=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789562096813
X-purgate-ID: tlsNG-ebf023/1789562101-C26CAB50-4298B8BA/0/0
X-purgate-type: clean
X-purgate-size: 2200

---=Part.1c5.d6ea32bcd34c0476.1a0aa368cac.7f62f70e1cff193c=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Context->Request is a shared variable and so we must capture it instead
of rereading every time=2E Otherwise, this sequence will be possible:
* A synchronized action (e=2Eg=2E __SyncProcessorDisableInterrupts)
  completes from the owner's viewpoint, but its worker has not finished
  updating Request =3D Context->Request yet;
* The owner sets Context->Request to something else;
* Request =3D Context->Request executes and sets Request to the wrong
  value=2E

Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/xenbus/sync=2Ec | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/xenbus/sync=2Ec b/src/xenbus/sync=2Ec
index eefa2fe=2E=2Eb416dbb 100644
--- a/src/xenbus/sync=2Ec
+++ b/src/xenbus/sync=2Ec
@@ -284,21 +284,22 @@ SyncWorker(
=20
     Request =3D SYNC_REQUEST_NONE;
     for (;;) {
-        NTSTATUS status;
+        SYNC_REQUEST    Next;
+        NTSTATUS        status;
=20
-        KeMemoryBarrier();
+        Next =3D ReadAcquire((LONG *)&Context->Request);
=20
-        if (Context->Request =3D=3D SYNC_REQUEST_EXIT)
+        if (Next =3D=3D SYNC_REQUEST_EXIT)
             break;
=20
-        if (Context->Request =3D=3D Request) {
+        if (Next =3D=3D Request) {
             _mm_pause();
             continue;
         }
=20
         status =3D STATUS_SUCCESS;
=20
-        switch (Context->Request) {
+        switch (Next) {
         case SYNC_REQUEST_DISABLE_INTERRUPTS:
             status =3D __SyncProcessorDisableInterrupts(&Irql);
             break;
@@ -321,7 +322,7 @@ SyncWorker(
         }
=20
         if (NT_SUCCESS(status))
-            Request =3D Context->Request;
+            Request =3D Next;
     }
=20
     ASSERT3U(KeGetCurrentIrql(), =3D=3D, DISPATCH_LEVEL);
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.1c5.d6ea32bcd34c0476.1a0aa368cac.7f62f70e1cff193c=---


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 16 12:35:28 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Sep 2026 12:35:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1423073.1648360 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6orI-0005KV-Fb; Wed, 16 Sep 2026 12:35:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1423073.1648360; Wed, 16 Sep 2026 12:35: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 1x6orI-0005KO-Cf; Wed, 16 Sep 2026 12:35:28 +0000
Received: by outflank-mailman (input) for mailman id 1423073;
 Wed, 16 Sep 2026 12:35:27 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@swg.vates.tech>)
 id 1x6orH-0005J1-7u
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 12:35:27 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6orG-007wQI-Ky
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 14:35:26 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@swg.vates.tech>)
 id 6aaa8d02-e002-0a2a0a5209dd-0a2a450a8a6a-42
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:26 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@swg.vates.tech>)
 id 6aaa8d0d-f2d2-0a2a450a0019-b9ff1c23a3c1-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:26 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0aa36fc5400072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 16 Sep 2026 12:35:25 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id DA05781038;
 Wed, 16 Sep 2026 14:35:24 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=kcHD8GEInNTcuXI0SnQKKMxUuOD+C/aFhoerTxc3EqQ=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id;
 b=hdeRo1Oi1x3+wEsCuhxGpCxlM/bPRS6aMNhidYcgSOY6cAmwi4RCIZeCPwVx51F0759MaJb19
 w1QPjQhFcjwAbLZOVsqZ+u8UUchWwHwxDaneDuo+I/AvIT7XnW9hVRO1XkEHbJa15ZHpkt0uWzm
 pBtzSHMCxcjYOn7Y1MUyIF/VCMrQh8xkdMYn+i9HQA3JZ2NPfDTPXAZdtMjaEdojBcHy7zF7Kse
 ZPe9N+y6ox3Ri8wuROSnOJKnkiHt79Qs/zfYZvP3XwJtUe9QfXBU0wj0CQ6xhv0h/QppekLrxgy
 eNe3vdyc3+xglMXL9W6bXOGQcYJ+KARSN5oljJnK7bQg==
X-Zone-Loop: 41f6bc7b9de9512ade8f3118ce5abf0a9effae3d07e1
x-campaign-type: default
x-transaction-id: e1cc0a56-8122-456a-97cb-2687d6959e46
x-swg-uid: 01-7cb6a052-c4a6-43fa-a30a-1408efe797b2
X-Mailer: Sweego
Message-ID:
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@vates.tech>
x-swg-bid: 1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH v2 2/3] sync: Wait for interrupts to be disabled
Date: Wed, 16 Sep 2026 14:35:19 +0200
In-Reply-To: <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
References: <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.1c6.6ccdee80bc5bfb9d.1a0aa36fa92.3ec77076830ca9f2=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789562124946
X-purgate-ID: tlsNG-4011c0/1789562126-5A3DCCFC-BAF14995/0/0
X-purgate-type: clean
X-purgate-size: 3160

---=Part.1c6.6ccdee80bc5bfb9d.1a0aa36fa92.3ec77076830ca9f2=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Currently, SyncDisableInterrupts doesn't wait for _disable() to be
issued=2E So SuspendTrigger can issue a suspend before all CPUs have
actually reached a quiescent state=2E

In each worker, increment CompletionCount again after _disable()=2E Wait
for all sync workers to actually issue _disable() in
SyncDisableInterrupts by making sure that CompletionCount reaches 2x the
CPU count=2E

Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/xenbus/sync=2Ec | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/xenbus/sync=2Ec b/src/xenbus/sync=2Ec
index b416dbb=2E=2E5111310 100644
--- a/src/xenbus/sync=2Ec
+++ b/src/xenbus/sync=2Ec
@@ -170,7 +170,7 @@ __SyncProcessorDisableInterrupts(
     while (++Attempts <=3D 1000) {
         KeMemoryBarrier();
=20
-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount >=3D Context->ProcessorCount)
             break;
=20
         _mm_pause();
@@ -180,7 +180,7 @@ __SyncProcessorDisableInterrupts(
         Old =3D Context->CompletionCount;
         New =3D Old - 1;
=20
-        if (Old =3D=3D Context->ProcessorCount)
+        if (Old >=3D Context->ProcessorCount)
             break;
     } while (InterlockedCompareExchange(&Context->CompletionCount, New, O=
ld) !=3D Old);
=20
@@ -189,8 +189,10 @@ __SyncProcessorDisableInterrupts(
         status =3D STATUS_UNSUCCESSFUL;
     }
=20
-    if (NT_SUCCESS(status))
+    if (NT_SUCCESS(status)) {
         _disable();
+        InterlockedIncrement(&Context->CompletionCount);
+    }
=20
     return status;
 }
@@ -237,8 +239,8 @@ __SyncProcessorRunLate(
 }
=20
 static FORCEINLINE VOID
-__SyncWait(
-    VOID
+__SyncWaitTarget(
+    LONG            Target
     )
 {
     PSYNC_CONTEXT   Context =3D &SyncContext;
@@ -246,13 +248,23 @@ __SyncWait(
     for (;;) {
         KeMemoryBarrier();
=20
-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount =3D=3D Target)
             break;
=20
         _mm_pause();
     }
 }
=20
+static FORCEINLINE VOID
+__SyncWait(
+    VOID
+    )
+{
+    PSYNC_CONTEXT   Context =3D &SyncContext;
+
+    __SyncWaitTarget(Context->ProcessorCount);
+}
+
 _Use_decl_annotations_
 VOID
 SyncWorker(
@@ -418,8 +430,10 @@ SyncDisableInterrupts(
     for (;;) {
         status =3D __SyncProcessorDisableInterrupts(Irql);
         _Analysis_assume_(NT_SUCCESS(status));
-        if (NT_SUCCESS(status))
+        if (NT_SUCCESS(status)) {
+            __SyncWaitTarget(2 * Context->ProcessorCount);
             return status;
+        }
=20
         LogPrintf(LOG_LEVEL_WARNING, "SYNC: RE-TRY\n");
     }
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.1c6.6ccdee80bc5bfb9d.1a0aa36fa92.3ec77076830ca9f2=---


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 16 12:35:33 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Sep 2026 12:35:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1423074.1648363 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x6orN-0005Nl-GY; Wed, 16 Sep 2026 12:35:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1423074.1648363; Wed, 16 Sep 2026 12:35:33 +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 1x6orN-0005Ne-E8; Wed, 16 Sep 2026 12:35:33 +0000
Received: by outflank-mailman (input) for mailman id 1423074;
 Wed, 16 Sep 2026 12:35:32 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@swg.vates.tech>)
 id 1x6orM-0005NN-7y
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 12:35:32 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x6orL-00AFtf-CR
 for win-pv-devel@lists.xenproject.org; Wed, 16 Sep 2026 14:35:31 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@swg.vates.tech>)
 id 6aaa8d10-bab6-0a2a0a5309dd-0a2a450aa67a-14
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:31 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@swg.vates.tech>)
 id 6aaa8d12-f2d2-0a2a450a0019-b9ff1c12886b-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 16 Sep 2026 14:35:31 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0aa36fd2200072c4.001 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 16 Sep 2026 12:35:25 +0000
Received: from localhost.localdomain (155.223.66.37.rev.sfr.net
 [37.66.223.155]) (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 1420B8216E;
 Wed, 16 Sep 2026 14:35:25 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=8QsormQ2nb32hA7ReqDmOMLhqr4D04jU18d3cKekGHo=;
 h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id;
 b=TGN8SkCrCMmws4JamS8Xg8ex92gNZJqDGEmKgvESqApsClTrvI2xq3YrmtLnqLVrPswAv7Q6v
 iAhLxhTXZcxpcMK7rPQ0T2M6rZfKa6hsxfhSJXQYbmp4PPnOOeRKRTHU7xuQrqqWtkX46i0Y/Jz
 98a0Gua7oe2+OIiVgPkQoPuzM5P3G5e7kyUbWXvXfjvoHx8Ci3l18RCL3foPeDILhCjS4S6z/fL
 WWD7Dl3lRresOReAX/4+Z086tTqOwRXpj9MvoK49ya7CtSswbjo14Q537adlEJ/q70iY+KOf8Fv
 oYN+0I3l59UPHyyX7YMAxY47C1ohcYEZlUTDiVAVo37Q==
X-Zone-Loop: d65f6f4d58d269c7b528bef7c404bc2f354dc1af2f02
x-campaign-type: default
x-transaction-id: 170fef18-ad29-4c91-95e2-a22f4e92350a
x-swg-uid: 01-280cc07b-87f5-4cf6-954e-8eb5c7cbede6
X-Mailer: Sweego
Message-ID:
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@vates.tech>
x-swg-bid: 1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH v2 3/3] Move TIME_* macros to util.h
Date: Wed, 16 Sep 2026 14:35:20 +0200
In-Reply-To: <20260916123522.1792-1-ngoc-tu.dinh@vates.tech>
References: <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
 <20260916123522.1792-1-ngoc-tu.dinh@vates.tech>
MIME-Version: 1.0
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.1c7.e91e4b76e74f5a2b.1a0aa36fb4d.18f72d56756e7937=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789562125133
X-purgate-ID: tlsNG-4011c0/1789562131-510C9CFC-6D1B9326/0/0
X-purgate-type: clean
X-purgate-size: 3043

---=Part.1c7.e91e4b76e74f5a2b.1a0aa36fb4d.18f72d56756e7937=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

These macros were being repeatedly used and so should share the same
definition=2E

Signed-off-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>
---
 src/common/util=2Eh  |  5 +++++
 src/xenbus/cache=2Ec |  5 -----
 src/xenbus/fdo=2Ec   |  5 -----
 src/xenbus/store=2Ec | 10 ----------
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/common/util=2Eh b/src/common/util=2Eh
index dbf64fd=2E=2E36f71f9 100644
--- a/src/common/util=2Eh
+++ b/src/common/util=2Eh
@@ -41,6 +41,11 @@
 #define	P2ROUNDUP(_t, _x, _a)   \
         (-(-((_t)(_x)) & -(((_t)(_a)))))
=20
+#define TIME_US(_us)            ((_us) * 10ll)
+#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
+#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
+#define TIME_RELATIVE(_t)       (-(_t))
+
 static FORCEINLINE LONG
 __ffs(
     _In_ unsigned long long mask
diff --git a/src/xenbus/cache=2Ec b/src/xenbus/cache=2Ec
index ae72464=2E=2Ee513f77 100644
--- a/src/xenbus/cache=2Ec
+++ b/src/xenbus/cache=2Ec
@@ -1056,11 +1056,6 @@ CacheDebugCallback(
     }
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_CACHE_MONITOR_PERIOD 5
=20
 static NTSTATUS
diff --git a/src/xenbus/fdo=2Ec b/src/xenbus/fdo=2Ec
index 50075f7=2E=2E0537654 100644
--- a/src/xenbus/fdo=2Ec
+++ b/src/xenbus/fdo=2Ec
@@ -1642,11 +1642,6 @@ loop:
     return STATUS_SUCCESS;
 }
=20
-#define TIME_US(_us)            ((_us) * 10ll)
-#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
-#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
-#define TIME_RELATIVE(_t)       (-(_t))
-
 static FORCEINLINE NTSTATUS
 __FdoBalloonSetActive(
     _In_ PXENBUS_FDO        Fdo
diff --git a/src/xenbus/store=2Ec b/src/xenbus/store=2Ec
index bd9067e=2E=2Efe3efcc 100644
--- a/src/xenbus/store=2Ec
+++ b/src/xenbus/store=2Ec
@@ -909,11 +909,6 @@ StoreDpc(
     __StorePoll(Context);
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_POLL_PERIOD 5
=20
 static PXENBUS_STORE_RESPONSE
@@ -1994,11 +1989,6 @@ StorePoll(
     __StorePoll(Interface->Context);
 }
=20
-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_WATCHDOG_PERIOD 15
=20
 static NTSTATUS
--=20
2=2E55=2E0=2Ewindows=2E3



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.1c7.e91e4b76e74f5a2b.1a0aa36fb4d.18f72d56756e7937=---


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 13:36:20 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 13:36:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424116.1648818 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7CHj-0000wx-0r; Thu, 17 Sep 2026 13:36:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424116.1648818; Thu, 17 Sep 2026 13:36:18 +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 1x7CHi-0000wq-UK; Thu, 17 Sep 2026 13:36:18 +0000
Received: by outflank-mailman (input) for mailman id 1424116;
 Thu, 17 Sep 2026 13:36:17 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x7CHh-0000wk-Cy
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 13:36:17 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7CHg-00DrGT-LQ
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:36:16 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecc2-8faa-0a2a0a5109dd-0a2a45048022-48
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:16 +0200
Received: from [40.93.198.5]
 (helo=CY7PR03CU001.outbound.protection.outlook.com)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecce-b57f-0a2a45040019-285dc6054fd1-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:16 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by DS7PR03MB8265.namprd03.prod.outlook.com (2603:10b6:8:266::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep
 2026 13:36:12 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%5]) with mapi id 15.21.0406.007; Thu, 17 Sep 2026
 13:36:12 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=THFEWmA01z1eLC1e5y15lnJEvdK/aIYcQVcbPNZwaEebcYVAIvJeuamqzL7hLQ7wsGklqVrDo5fJwtcyz/YjBedcwHTC5V0OnnE47zxiARwjcfpulR9tUYxiHSBQDZi50hxwHwG25sWOk4xxGphpgoldqqHdXEaRs64ni6xL84lS+GTyz2LxbGZcpSwMPrzIFlkvClvFCBvsZf7vHIr3ecOuKrg86VRCfVKV/Ee1znyYIaMnjMHdJUz7vefialgbcufpBpjjl2nSr44S/ETRV9D04FcGNhFqmDLWyaBwzwWxKQh2uYAUChXSdCcZNm1BvlFavsIwN5hJqi96Ok8Cbw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=o9lDiJ045fd0Odc43Y+mt+5EtI6b1+FCbkUUci9xDHE=;
 b=n33BgLlojiqky2n4x9Dl5vPOAQ5srXuib2MKV2gQyQaoagtGWnIJn68MzFZrSWQZwhh+Cm6eGmR4xlRnyUZL83/XTpAWo+bwvYk04wSVnSiZT1LJhQFJPaH+HCfsSDqQIiKBKbJKZ9r6LMSwlbnU5coraL/w11WwFe7tZOnr6JnAw7M7HY8006wDM/WMMCDznNYqg1HxV6+i+u81mi/9LL49kC5vtOFYZsVOtvfHIxoCb2oEJJAKoqja+TDI36j5sGlNjEdJa0SCQrv9FN2xOBF7c26NtBnLx8XVdnhKXuf8JnKDqZ76NX61toAfTo3ekeMcJK9E67LW46eoR9gBWA==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=o9lDiJ045fd0Odc43Y+mt+5EtI6b1+FCbkUUci9xDHE=;
 b=PaAw/suD2OLn2iZzpSV/VpLyNHhtE92n9/a9OQR+kjnUc2qKpTNuDdeT/WdSSS7jwgf5T4xqlUAwwUzl81nj0O7NoxXvuA7rZrxLYs8v5eeqSDxDCENT74Efps4lwLi2PZ99K+87fkLpG9j9ZfTZImNKJyruDb3TRdgn7rx2G4g=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 1/3] Capture Context->Request once per SyncWorker
 iteration
Thread-Topic: [PATCH v2 1/3] Capture Context->Request once per SyncWorker
 iteration
Thread-Index: AQHdRdfUJKgtfp96s0ycQZH053rW57bSx0HZ
Date: Thu, 17 Sep 2026 13:36:11 +0000
Message-ID:
 <SA6PR03MB7760FD5A866F2C0DE2457BB0FEB82@SA6PR03MB7760.namprd03.prod.outlook.com>
References:
 <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
In-Reply-To:
 <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|DS7PR03MB8265:EE_
x-ms-office365-filtering-correlation-id: 307a2d49-9d7b-44f0-30da-08df14c0a384
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|23010399003|376014|1800799024|6133799003|18002099003|22082099003|38070700021|10067099003|11063799006|56012099006;
x-microsoft-antispam-message-info:
 ohT2KVRmA3xJGTZr5dTVOO9X5LzC+VZrYGu8br2ZeyAPPmr6MwEk4KaCUVojPjxxIGe5I4VxMpalRK9XDe8YyoXFkGXkS8+/dJ6cLyxdi42Sud56wyrG6LrehGXEdeG/WIkIPxV8tmIPiWWki6a75+Zw4nFpRd2GDJJZkMz/geLPJrnCqmSxoeltGXCfZQ8a+tvynXFn79SUEWHzjAWf2Ot3PaVJ9Itn2HYoeCNEdVbxZTJTHraC0xhWgYF629RwN1joEfuWh0zIsx4cGNKTMY4iWYExjP+iCVeu6HqTR7FU+gWFw77zDev86VBTfENDyt6CPhIZN2PaM748cl//+Ihh0Q7BIUa+qwA5cQhUDIptpwAA+bdj113Yh+AAuXOC7SRG4jn9wutsvvGoZpjwAQN4ULGQZhfC0jk+Zs3tm0rR9l0YHR6I8X8N91ZhDSDdwtP29GYGqAmgboKfk0RbWrxSYou/J1QtcfI3xjNXKUz8cMnUGETijYRvyJi09DhOplxcmZ8Yx5AbxaNHL/nhZLHWv0uq0cY6bi4PKVy/4jK4im8bWJ+CDyjpBJablmg7MdZuwJ4H5WH3JPXLk3G3xRomrjzgWJhqy/KoOBl2we6zrBaHd9JrJZiD75Aw0BFh8KgEOPVCo8JzCsNJgOedoCHeiHEqe7T1qNt/2e3YMXQ=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(376014)(1800799024)(6133799003)(18002099003)(22082099003)(38070700021)(10067099003)(11063799006)(56012099006);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?B4PLOlUhjfP3AOKtW1UfHE3hQeuunl84i2Ik1pB/e78bx+qps8Km90IrsQ0f?=
 =?us-ascii?Q?n3xTbiDPSYACWeet/f2W68rSZnlPkeMvhALLMNTBcgkRlGaprLDCor04DDk6?=
 =?us-ascii?Q?4Qv8OPMZP77rbq6v6GMihcLKnwK+q8tGf5/LIFMVUUY9ZkqxhNTY/0t0Ky2/?=
 =?us-ascii?Q?SmKuRPYQ9I8zHTkuW1oEBb+9Gz/MVyl0ikKLy9ZV+Qhh35jQoZOgQiUjHH5a?=
 =?us-ascii?Q?C5S//riNz4QuN2Oi6Oa9jJ/8i/xQHRedZxg38hnEx7J3BrN7iYpQiX3cBSgb?=
 =?us-ascii?Q?OD1mLOU06XWgL4raCuVAgSP+2AX7el5JRO23PMqoBcXtU+CV3Wdav4sO7GNI?=
 =?us-ascii?Q?j7fwD5wTUhKa8eGFYtelMqb5bnyynP2K0WcRbvOmkKg20x1W7aMVDnuYsamc?=
 =?us-ascii?Q?eAM+TAyNLFiUAQgfTMRpsYL9JWrR1D/stnyKy8TfY/LkyAID6ctu7/R24m80?=
 =?us-ascii?Q?19U8xtlPaEp0jHoHw7MsJkzdjf49NAR57AKZEb3IueoDaUuX/FRrpatIYFIM?=
 =?us-ascii?Q?Owq55of8DFcRbg+59KW7S7t9yazfRyyFDFGixnn6180l92KeIkrQeMEDvh/B?=
 =?us-ascii?Q?Yp7Bg15ZqukBs2geidLAqq9Z2E0WjoUjvSidoHcmpXovhuDVvJvNNtGFnpqi?=
 =?us-ascii?Q?/7bpRdG6/qN4XVSeCQG0geAK/Qm7jXXwnTknxSQChGYiCzemhw5yBqjiGWWV?=
 =?us-ascii?Q?T96ZjWwTVhmpZ0pogkQPEwOCD6Th1zyRjl0Cn0tYO9zkosDbnziEefGb7zWr?=
 =?us-ascii?Q?hkfMnV39OR63SZ/ewAFGqIOKz7kCuLt0F+cuQLlbvwpqKR6gKT56/HmY+chA?=
 =?us-ascii?Q?V9BDtwKyqzjy4XNysZ0VdMgmiW0oWdO2i2IvZGFc55p8nZW2GQyKBYEUJrJf?=
 =?us-ascii?Q?4Zwu1kdfbq7jQfBvku65d6QHG1r8s93/be97ttCnmaQ5CbihwCK2kU8otcNe?=
 =?us-ascii?Q?EYB/bgBWOHcsAeQ7dr4jOqfMQZkyjqYDqPMz0FnrTVJlZRCBL3G6v2dGgWlk?=
 =?us-ascii?Q?Bv5qzVyZEntYisKqN6f1oOvM5oNX9oIxV4kY3IHAnQSWqyW4To79gb1+qNPE?=
 =?us-ascii?Q?WMY0YBx4Fq936g6pcap6fIJaFJ25I6xA+6n0jdH6dPF+G64VYJoYPch3SCLk?=
 =?us-ascii?Q?Ipgvt8eIQFCQJeGJ5ac+g9W0IH+hDm8v94L9D1wucZzNKeAmLF1bqIpxudGV?=
 =?us-ascii?Q?ZwoJs4AOTTZAPjw+T0I/ADh2orzSIyJGHwGgBqfLDfm86OQZe80ErBRnPC/1?=
 =?us-ascii?Q?SrfWBEDPG+AGqnyk9WxugCv/tw08bATewLRyX9z56Ft7fs7Qf6u1NjKRe1yk?=
 =?us-ascii?Q?cVHEa5Dk3Mejn1mm56UfijRH2LTzamMw8yYaWGaDIFXRY1H+717bHjnhRgMs?=
 =?us-ascii?Q?VLHE5l3AOZWJ+nuJZESk2DQnuFTKO3xHzBLaSOEWA2UquxXJHvCIWXhsTjst?=
 =?us-ascii?Q?o1UCGnLbLU2rpzRV34yh9qUXa7BcU/871Jy9qMNMv0kkVyle3C6Qj8jL16Z3?=
 =?us-ascii?Q?WMQ5nG/TT72E0RESQ0RkGv5b3+s/R9mrEG4cwFCi/mKmnpdHaK1vHrbIO/mN?=
 =?us-ascii?Q?Sn2i7MSrXckU726EsgJTBnOJ56EZivC+3cQJNTRFs3G3ipUk7LSxWq5RGxEY?=
 =?us-ascii?Q?qsmD8Gt25G7aoUFMOx3DVpXa4AfGeavYCTBs2S+jjZY3VcwhNozY542AsDlx?=
 =?us-ascii?Q?QNomrsbU8igMg/y7yvxC+ZLcb0s1YmuPxNw5rjlhilp2rvfy?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 307a2d49-9d7b-44f0-30da-08df14c0a384
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2026 13:36:11.8458
 (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: rP667OpGFL2gmq5qzI9KVsk3iNvLC54MWJxnVo5kTqxx0MnxYXY6AOnPRQcD/SzQfITyDc3754HzJ7p5zoi8Ng==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR03MB8265
X-purgate-ID: tlsNG-ebf023/1789652176-50CDFB50-26E0DCB8/0/0
X-purgate-type: clean
X-purgate-size: 2296

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

________________________________________
From: win-pv-devel <win-pv-devel-bounces@lists.xenproject.org> on behalf of=
 Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: 16 September 2026 1:34 PM
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh
Subject: [PATCH v2 1/3] Capture Context->Request once per SyncWorker iterat=
ion

Context->Request is a shared variable and so we must capture it instead
of rereading every time. Otherwise, this sequence will be possible:
* A synchronized action (e.g. __SyncProcessorDisableInterrupts)
  completes from the owner's viewpoint, but its worker has not finished
  updating Request =3D Context->Request yet;
* The owner sets Context->Request to something else;
* Request =3D Context->Request executes and sets Request to the wrong
  value.

Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/sync.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index eefa2fe..b416dbb 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -284,21 +284,22 @@ SyncWorker(

     Request =3D SYNC_REQUEST_NONE;
     for (;;) {
-        NTSTATUS status;
+        SYNC_REQUEST    Next;
+        NTSTATUS        status;

-        KeMemoryBarrier();
+        Next =3D ReadAcquire((LONG *)&Context->Request);

-        if (Context->Request =3D=3D SYNC_REQUEST_EXIT)
+        if (Next =3D=3D SYNC_REQUEST_EXIT)
             break;

-        if (Context->Request =3D=3D Request) {
+        if (Next =3D=3D Request) {
             _mm_pause();
             continue;
         }

         status =3D STATUS_SUCCESS;

-        switch (Context->Request) {
+        switch (Next) {
         case SYNC_REQUEST_DISABLE_INTERRUPTS:
             status =3D __SyncProcessorDisableInterrupts(&Irql);
             break;
@@ -321,7 +322,7 @@ SyncWorker(
         }

         if (NT_SUCCESS(status))
-            Request =3D Context->Request;
+            Request =3D Next;
     }

     ASSERT3U(KeGetCurrentIrql(), =3D=3D, DISPATCH_LEVEL);
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 13:36:26 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 13:36:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424117.1648821 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7CHq-0000yz-2K; Thu, 17 Sep 2026 13:36:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424117.1648821; Thu, 17 Sep 2026 13:36:26 +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 1x7CHp-0000ys-W3; Thu, 17 Sep 2026 13:36:25 +0000
Received: by outflank-mailman (input) for mailman id 1424117;
 Thu, 17 Sep 2026 13:36:24 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x7CHo-0000yS-3T
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 13:36:24 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7CHn-002ZqV-GQ
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:36:23 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecd1-bab6-0a2a0a5309dd-0a2a4504cfa2-14
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:23 +0200
Received: from [40.93.198.35]
 (helo=CY7PR03CU001.outbound.protection.outlook.com)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecd5-b57f-0a2a45040019-285dc6231efa-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:23 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by DS7PR03MB8265.namprd03.prod.outlook.com (2603:10b6:8:266::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep
 2026 13:36:19 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%5]) with mapi id 15.21.0406.007; Thu, 17 Sep 2026
 13:36:19 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=w/lmMzLJN8oU1Nu1WPA3EJjSmFfbZ4NKVHGSv4Brj8CTMgslLNs2VQpahzEHYvIs3PrkJLUU2OwJL6BRHTxBhMftAkTEUzS+0Bjkw3mxh3thVwwaQVl6TBGkictrUGrPkXkVV3xYyFVPD5ons8x2dezIfmk8orMK7HLNMoQB/lQlg8GehGhhxuqYKZjqQQh+L82d4XVhhNzoH0vRI/RGfvwnZZyZvQR8seL18WrOVnfMjOwhaYXtbhsZlZnUh62QXN9/cQxlQl/4TjmszzBLuZsphhDbty8756UZe1QG9gTDca0ULeGdNhcRks7ApnrEYh7/tKeqSLfG2BnQnf6Bbg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=/Dw2gXi0UgWFWwSublEmSoTw2mKrWWxXGjRZN3znwUI=;
 b=SyspflDlq7QAQnBG3aTB0vj27RqdyMR/eOMDgFBKcObDJR3KhImTKOtXLurvshNyk9ZwICKcoGnzctaLf6NsN8F569SkbCIZzLoyIfnG27fydNsM6GSLZ/MnaxivhecEw+mFggLQIZ/ycz3myr0KxOSIAz0BfZt/3B0wMtZlinyyOPVoI0H8tSqpfPDpBhfI5KDwe8yE8phn4vUEwnMu1TI2E8bgr/xC72JWM1nRjI3sKCELDyYuAGED2v2+NLPfijNYV0bZ3oX+nct191zw2cCeileBMc9ZyLSAiMRcS0IziTxY+6grF+2ZAOpELQ62j/FzlF/EAGj9rHlz0SH7Qg==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=/Dw2gXi0UgWFWwSublEmSoTw2mKrWWxXGjRZN3znwUI=;
 b=pTOjzTusDGmGCb6RGZM7aK0dzF69g0vtSzlrf+oEzBUTxB9X3i3Pf5wALnUOEQtZpk/wZ34FJIaj72S/6zef99+awvs69zG/RanGZ+Z8DMqNOjI5ANXh7517szVOx+iGWKPyUseTGdZiJxflasdmt0b+I5M+xv7zl8FFAV88pOw=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 2/3] sync: Wait for interrupts to be disabled
Thread-Topic: [PATCH v2 2/3] sync: Wait for interrupts to be disabled
Thread-Index: AQHdRdfgeeFXQB3ro0W2SVBHIUp9KLbSx1jX
Date: Thu, 17 Sep 2026 13:36:19 +0000
Message-ID:
 <SA6PR03MB7760865F9128F0A5F87B039BFEB82@SA6PR03MB7760.namprd03.prod.outlook.com>
References:
 <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@vates.tech>
In-Reply-To:
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fc5400072c4@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|DS7PR03MB8265:EE_
x-ms-office365-filtering-correlation-id: cfeac5a6-96b7-48a0-b571-08df14c0a82a
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|23010399003|376014|1800799024|6133799003|18002099003|22082099003|38070700021|4143699003|10067099003|11063799006|56012099006;
x-microsoft-antispam-message-info:
 wjzqKWjNSkdeTNkGZYmFyl7zM51k7a24aK9/hQX2nA+b8Pw3TvU4kl95xUGaCl/N9dehIfV/tumb9yrZdsjaw3jy776xPwlNlnjMxpiXnXe68Oi8h5bqPmC1DbXPFCPvhJRAP6CgscxIbRxKXySIlwMGqsAcwOA44Oe7mS2h+ea04672u8lWrsZw5lh6w1Q+3Cq1s0Pa+xeOLvSdR8b92O1F4tLzn+XaKV2/hMbf1YRyzjE6hcaadyvJCQ6cYrn1jxNqSoFpU//+ePmqFde2yRAJREh9+jicjoCh+AWlDhfWXpeeEkoNZ48JcXD2wwowRgkFsvavTCoNmOtbLwUQj93ShD/muik/1KR6UeCkTt4wEAwfB4gjXjNGY2lf8kUJiDfUGnBwL31qRIblzecUeoY74q1VdryVzfPHwHbJn3Bq1ZzZJlkOMltw9BVWRMZr//E5Ly63yWbWNB81cydEod16+Wbt4EydgwypaqOuHiUhrdI/g5KR5kvIMRS0nqcu7hu2Vs+lnmfWzqOG27pPn5PpiRUv60/NGA9li+z9G8WJav/jfZGLSTOvE99qH9/vStnZx1jsqqgEE1yJq/3nM9YcgxS+qeJkMIkWOCPUAHgC9GtsmY807FTOMSSmBfdY/odeoZxg41mUNeqiB5FWPi4+ZgqOkjdgBSo7Nkk+8qU=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(376014)(1800799024)(6133799003)(18002099003)(22082099003)(38070700021)(4143699003)(10067099003)(11063799006)(56012099006);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?C7Nj029iEJg7NcE2RJI7YYJrIprgo/NyVnpYDBNK3rAOYh+tt7lN3qY59vrP?=
 =?us-ascii?Q?NgkfpVx6Npp+bE1cDeAPos6BE38fyEDLf8ziccgxS1tOXscDvIsrtFrGds/f?=
 =?us-ascii?Q?rXPLSBonltIzBPJ2L7UeL2syemb8E1P1n3Y5ys2ccVJ0TQ1/e5XaDz6W8/t1?=
 =?us-ascii?Q?2dCmaXskj3ECM16p4Vg9RwWH3RCTNNBq5wNDvz5i9TOuegnV8NfdUtzsFtyf?=
 =?us-ascii?Q?z6oQkivi9wIigmvBCdXi1q97Zgtg2je5sPeV4T2kX5XSiHJD9BfGVpaIoKyb?=
 =?us-ascii?Q?dUwlhKfcEiD6Scb7YJZdNoLG0GO2pDkYkn7fDOCTl/5nWphtqCUHJ5hu3Gdp?=
 =?us-ascii?Q?/elCc23rJ/0+oieanJKaJEEoqQBkNVuhATtLgV1B81ndrihB97lqetnAc+sM?=
 =?us-ascii?Q?nrsd1UilzeqlQWahWBQHGTgkUbqWwsU9s4WRI67SmTSiS5s1M6CtzGSP0hJs?=
 =?us-ascii?Q?JznG82/ybQ/Tg/O8Q+EVCnAS/9Hf1d4cU1lhnqby+QiIfHFT3JfH8KeNLAXb?=
 =?us-ascii?Q?lcIy2lcyzCDqKMhOFmvlvmcfV6rkwCg4P4jId2ir10YesymYxs+KlMMeZ53a?=
 =?us-ascii?Q?iQPeoHrJDtMppGUXsZYSlow8Y6f6yniOoxKzGdT9O/CHC6cH9t2fzDiFLA2r?=
 =?us-ascii?Q?v+L6UjFoO0lu88dYFaBi5/9RhQwyL39tOF+Wc9rw17LGx+yr2aqyEQ+SkcaV?=
 =?us-ascii?Q?34Ijhl1VvCj5+zKq/DuYKiyKtH2N5/LnzulD/6C657TPgewrL7ceEqncuEVk?=
 =?us-ascii?Q?/MfgGfgw3s/6fbaXwUOAPQN1wAl7iB0qHA3VmM92vwLvpTtdwDeC00ks4qxL?=
 =?us-ascii?Q?9tUkA4+WcinEPVR4OL1C5QxgmN/DFzX8X55zUXc8F2cYZbvXpN2nJSa53hLi?=
 =?us-ascii?Q?wEFPAlBMfKhbNkZOuiK380r3yUWiAZWjcIfxjNOz2obCyS8AfBut+jfkEsIS?=
 =?us-ascii?Q?B3+DQpMylgEyt3dCZNcxLPVdJU2JHHjufLG2lPHLuMXloI+VEJMq1CDNOErD?=
 =?us-ascii?Q?upqlIGonilrYbHmmZ2ba7z2R1iowSShNhUY7Jc42nAUhHwZ0Py3lMunpYS+J?=
 =?us-ascii?Q?hWLD9MyK+aY/c6ymHrXV0stHHxjXI+KWKQ0tPmMjH+FXTAnQEgne8tT02pEY?=
 =?us-ascii?Q?mq3S6BXttLdSKvEwUf51/LHR4jdSslJipFgTYyt5EitJRjcBlHoQnA1yIUNn?=
 =?us-ascii?Q?NoP3RsV52dTb2dSPwDb/DsIs1YPTSI4ER2DL+RBN6QngFV0LrZij2gCJKG1Q?=
 =?us-ascii?Q?hcd9LD9joCHGTqBK18EUAhx9jiedxLUZIAcXlPZPDQbK0TyefU5ucPEX4Z9+?=
 =?us-ascii?Q?cObRAWeTCD7geUU5z7P5bF2mEZCBCKcy7Wg5DSMHJhVk5sJiUrJ2jJ8sK7Ma?=
 =?us-ascii?Q?eswwWSp9AhZYRf7qjRZ6NylUKjZxSI0vZdZPvG4+7morNNPobggMQRAP5xB7?=
 =?us-ascii?Q?HWEt6cteESi1VyoZLF3DZ+hfaobU4/tEDwZQqXnAB4uFKYlupNCwgfq6zq1+?=
 =?us-ascii?Q?OeWVdI8c8sZTRSqkOPu+2jQT3pDVuwO6FGgrce8h1IpW4hZVLW4RgLQY5anS?=
 =?us-ascii?Q?Ycjc0c+0GN2K+aGoFKVhS8SIVMtNoW6CZA+MRdgJBXU6vDqnsDuvgwhlmGu5?=
 =?us-ascii?Q?XA0BNQt0Cl5eJo22fGDvD0LJYWqP+O8t2WWTPKFuvVmBcQCa6sD9qnAawtJU?=
 =?us-ascii?Q?6UiOEu+FzUkVaIPMUbEevVNlvv/p5KLY6Ru8t7Jyg+iwXhuF?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: cfeac5a6-96b7-48a0-b571-08df14c0a82a
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2026 13:36:19.7140
 (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: LHXI72+krcRP0vVeuDOSC2ZMOH0SqYmZ5Pml0OSTJuLgb6iSoY6ZI6ira0fMItOcydL67pDqbsa/Cyg3g7bVRg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR03MB8265
X-purgate-ID: tlsNG-ebf023/1789652183-C12DCB50-0F3C2822/0/0
X-purgate-type: clean
X-purgate-size: 3230

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

________________________________________
From: win-pv-devel <win-pv-devel-bounces@lists.xenproject.org> on behalf of=
 Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: 16 September 2026 1:35 PM
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh
Subject: [PATCH v2 2/3] sync: Wait for interrupts to be disabled

Currently, SyncDisableInterrupts doesn't wait for _disable() to be
issued. So SuspendTrigger can issue a suspend before all CPUs have
actually reached a quiescent state.

In each worker, increment CompletionCount again after _disable(). Wait
for all sync workers to actually issue _disable() in
SyncDisableInterrupts by making sure that CompletionCount reaches 2x the
CPU count.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/xenbus/sync.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index b416dbb..5111310 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -170,7 +170,7 @@ __SyncProcessorDisableInterrupts(
     while (++Attempts <=3D 1000) {
         KeMemoryBarrier();

-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount >=3D Context->ProcessorCount)
             break;

         _mm_pause();
@@ -180,7 +180,7 @@ __SyncProcessorDisableInterrupts(
         Old =3D Context->CompletionCount;
         New =3D Old - 1;

-        if (Old =3D=3D Context->ProcessorCount)
+        if (Old >=3D Context->ProcessorCount)
             break;
     } while (InterlockedCompareExchange(&Context->CompletionCount, New, Ol=
d) !=3D Old);

@@ -189,8 +189,10 @@ __SyncProcessorDisableInterrupts(
         status =3D STATUS_UNSUCCESSFUL;
     }

-    if (NT_SUCCESS(status))
+    if (NT_SUCCESS(status)) {
         _disable();
+        InterlockedIncrement(&Context->CompletionCount);
+    }

     return status;
 }
@@ -237,8 +239,8 @@ __SyncProcessorRunLate(
 }

 static FORCEINLINE VOID
-__SyncWait(
-    VOID
+__SyncWaitTarget(
+    LONG            Target
     )
 {
     PSYNC_CONTEXT   Context =3D &SyncContext;
@@ -246,13 +248,23 @@ __SyncWait(
     for (;;) {
         KeMemoryBarrier();

-        if (Context->CompletionCount =3D=3D Context->ProcessorCount)
+        if (Context->CompletionCount =3D=3D Target)
             break;

         _mm_pause();
     }
 }

+static FORCEINLINE VOID
+__SyncWait(
+    VOID
+    )
+{
+    PSYNC_CONTEXT   Context =3D &SyncContext;
+
+    __SyncWaitTarget(Context->ProcessorCount);
+}
+
 _Use_decl_annotations_
 VOID
 SyncWorker(
@@ -418,8 +430,10 @@ SyncDisableInterrupts(
     for (;;) {
         status =3D __SyncProcessorDisableInterrupts(Irql);
         _Analysis_assume_(NT_SUCCESS(status));
-        if (NT_SUCCESS(status))
+        if (NT_SUCCESS(status)) {
+            __SyncWaitTarget(2 * Context->ProcessorCount);
             return status;
+        }

         LogPrintf(LOG_LEVEL_WARNING, "SYNC: RE-TRY\n");
     }
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 13:36:31 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 13:36:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424119.1648826 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7CHv-00012k-4H; Thu, 17 Sep 2026 13:36:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424119.1648826; Thu, 17 Sep 2026 13:36:31 +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 1x7CHv-00012c-1S; Thu, 17 Sep 2026 13:36:31 +0000
Received: by outflank-mailman (input) for mailman id 1424119;
 Thu, 17 Sep 2026 13:36:29 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x7CHt-000122-5o
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 13:36:29 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7CHs-002ZqV-Ih
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:36:28 +0200
Received: from [10.42.69.11] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecdc-bab6-0a2a0a5309dd-0a2a450bbf28-2
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:28 +0200
Received: from [40.107.200.5]
 (helo=CH5PR02CU005.outbound.protection.outlook.com)
 by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6aabecd9-b7e8-0a2a450b0019-286bc805a5fd-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 15:36:26 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by DS7PR03MB8265.namprd03.prod.outlook.com (2603:10b6:8:266::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Thu, 17 Sep
 2026 13:36:24 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%5]) with mapi id 15.21.0406.007; Thu, 17 Sep 2026
 13:36:24 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=wNJnc5d+zyIA54GEkEuE2Sk/DM0i5DDDvHU0sVG856rJN6DoQte/ngW0x4keeDdgSgEMCcGVF6X63ZMrh7Z69Q7WomMXWCQjTguJkfSDY2F00UjJORGRmzghQ6LerH1p4HT1Pj7knDELG9U1WCxnp4w7JmH4szfr267v2p/oPL2zlEM6mrrxl3vuwTTEWZtTmKD/QAepewgGjyqK1LXAp/2WyHs0gi92v1Oxa95NfQZbkNqGuLE3O+ggLT39MGUx73/EzNWE3T27LR1f5zJeJsSc8xik27BN0AR/DEOpT5fK33vlfVRbJyHeDrIJHDB59z054JSnYFkzUZYy6WtZMA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=U1PgnLoDTjBYLTW71ZOnMXX1UJWp7UE26mbKk74S8+Y=;
 b=RrHzmhXHAobEGblFbxMPiOjTMokJjVx2IhgvtUuTHX6lmlwzmYLDY10Wn0JqZ+9en+QUH+WzYKDl/2+Tt9drbEJJSdNTOs7fYdruhKts56Gf0QdJf3M3fN0CCnjq16tftdJa62JDGEXUV6Tkxe3hmU4PvbMhbTc373V6G1JymwLACwsr1/+2BB4KIPFosi/bIFHq/1VcOl8CI0qVrfap6S22rlQ+5sRLwjw6YULzV2O0peRcaFrJ7QYzTNXBj79Fu06D98XfSR99SIaDt6MaGD1GSAZE4CBfSRfP9QDJL5UKobtODXIVBTh7F+omRmBuEygm6T5jLSaDAhCi0Exprg==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=U1PgnLoDTjBYLTW71ZOnMXX1UJWp7UE26mbKk74S8+Y=;
 b=u3K7QhR4FxbtLd31cyCbphQQd5VdwVXL9iDceODwyebrLYCLnjiqN6qcV25H+8dJ4Bx0mYCPSymgtAc8LERHmMgwOme+t8PQ6/7qa7F6bpTwz1QiP1WtV7qagvgKtsczKRKOaxUbF59pOMIsOOmj9e4Ezk5aY/E5Aamcyj+Z+kg=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 3/3] Move TIME_* macros to util.h
Thread-Topic: [PATCH v2 3/3] Move TIME_* macros to util.h
Thread-Index: AQHdRdfhQGPhPS6qZUGpYEeXPXuXT7bSx139
Date: Thu, 17 Sep 2026 13:36:24 +0000
Message-ID:
 <SA6PR03MB77603F39FD762E2B76C11C07FEB82@SA6PR03MB7760.namprd03.prod.outlook.com>
References:
 <1789562097.8631fc262581453bbf619ec5b2062170.1a0aa368e5a00072c4@vates.tech>
 <20260916123522.1792-1-ngoc-tu.dinh@vates.tech>
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@vates.tech>
In-Reply-To:
 <1789562125.8631fc262581453bbf619ec5b2062170.1a0aa36fd2200072c4@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|DS7PR03MB8265:EE_
x-ms-office365-filtering-correlation-id: 909a744d-f9ff-4af6-7ec8-08df14c0aae9
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|366016|23010399003|376014|1800799024|18002099003|22082099003|38070700021|4143699003|10067099003|11063799006|56012099006;
x-microsoft-antispam-message-info:
 UVEQAXBm7/dkbEzlgydenf8usTlozoHAJw0b58mSWlufox8yyfmV6+w8ilVzYvBeEhaQnInKrpplAkbZ15HwEVWTALNMjN3IE5F0+xCAR03sKWy4qSIMJg3uanDLRQhtM9V1me+OtjsADTjAVB0plazNZO5zMXFQWJI01bTgjgJVUWA70rQTfIMtloQpIklGQIGG07TpS8Kb3fzPtJwEn0bfHviPS5WsWDUg8SwFQp4bJ0xYq1/c6cHNf6PEGQ/+QWA4ANR+/yq5J6G6vsqFeKKbjQwh/tG8VXkPHEUYH8AZK7CPhuJ6INtRRAob7CsIchWuFetN8P0zslVWNhi2QYOqMPPCZ771isErEy4r3JH3iMr8fa3306e7q2mSz+YdMzZwsq95LK7Nr9dl7zY8pY6c7UVZRcLC+s4Az5+rBH/rCrio35Y3/GFxU/vFnw6me7gT9w+JHTUAwHVY3TILVPqjrLEd/MTWDBU5X8zxWkaZcRVVAy+qHp25tP4UT381RYD27iYIHv7Up3aEPRgP+dyZO9SHTGBU43iyjtk5WyPBx7+cHGgvmkFJ1RFnRM3eoDvlhFoGlan/KBGmS4sMUq+uIwmj3eXJcS/lr1C55iKVnQxm7mdurE+Si6bTd6Ht6dR1TcBUkIpB9VaUGUO5hwzWE4RqZs0JNq+ZRylIWpA=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(376014)(1800799024)(18002099003)(22082099003)(38070700021)(4143699003)(10067099003)(11063799006)(56012099006);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?us-ascii?Q?gIudAAs/mxrY1K3tIaS+kVD10L1tgaafwu8GEkYsrcnjEFnrf3WJNRUgJZ1Y?=
 =?us-ascii?Q?KmGXrnDkZBC5c2OTglxa+XfJ1+ZtIp6KPb4KvsJNAQv/g5N+R2NiRx4rwgSW?=
 =?us-ascii?Q?+kULT41T4RubXd3xZhqG8RueZG1b0zYHWNYLpWYUeqAKB47AUZQkeZIfErCo?=
 =?us-ascii?Q?piJyKvr83XSp1uD+IJj4bo4d8iJnDX0bvKiBFaE9PoikKW0QjnpRFA9zt3Jn?=
 =?us-ascii?Q?AAwRcOnVBVRZ107L2EFNVmWVzEuJ1PNvaRX5Urp9+L3Rj6k0N86BeNr8f2CW?=
 =?us-ascii?Q?fi+s6CjRLQKWc+Ebv1Bk2F4Z+fuUEf+aFUxDXh4DStrwtiR0PjsGosjDNtXl?=
 =?us-ascii?Q?7fyvhq8zjObyvpm3e8kpK1fqTehsf9L+VBNo5qbmHC7toJndZJRY1lh9f4Eq?=
 =?us-ascii?Q?CNc/TwziMCexjs1ru2QhEFYjJl3tub8FXQft6r04pBEOUgOLWPV4Ijag46B4?=
 =?us-ascii?Q?JNl3EEesB977jhtvlq5362OsQFOG/l7+dlvy7IgEka/dsDRj3ePhq+37UWFU?=
 =?us-ascii?Q?c+Vb27AJ/XoGgwoOxbQuWTSeIzud6kgbvdA9/MU34sZmwlxy/K5c/cg9Z/vO?=
 =?us-ascii?Q?9ufqXE2YjVpcqGKcgMxj0O69C/y6DKihG0I096QiUSE4cljs68YC6APzM/V/?=
 =?us-ascii?Q?2zJ8fFUX0EyrB6TFadkVtt/uLc5e78jdnvtJDxCl90ePkyIblVf8ObWwPjeu?=
 =?us-ascii?Q?1Q3jcsu6GafY76X3l6rkiPSnzSaufAVGg+Fp6fcBetbzFj6+LTTH+4NXNFwi?=
 =?us-ascii?Q?MCCOyemvphY1bcT7iJn7NtzxxYQEUMd/1bYYwD4mbqhrGqXssfFnaIB1nsp2?=
 =?us-ascii?Q?cDgm7pdvau3oNyIM2YhH7U9cSKNwOqorkEZN9VGagj2gNUlpYy2PUzaHFrOl?=
 =?us-ascii?Q?Z6RPhNKg5FGa6I1XO1WEA0g9WhsfLvDyHWH+OEpI9/Ujgd6pKCIljdUXOZy7?=
 =?us-ascii?Q?K0P73fKJiP5qaqtTXYmr1WBXVcDPe2LYmVB0ceGfDhJIUPo8GtmJ14TxMF/C?=
 =?us-ascii?Q?xwS1+b/t3eky8fwQvHfU/dOjkB+29kb4iRn1WQQVG3UTomG3lBEVO/kW2k/1?=
 =?us-ascii?Q?u9u4m/1YY9VciB79E2bsAaWILjaddo9zcFkYbPlxOV/p+T3HSAG6Se4dkwLL?=
 =?us-ascii?Q?G2+kffpT4SOdoW6CRWTCZK166O3qHovJYhbmrV57EMBXRfBNVbm2msZHSlT5?=
 =?us-ascii?Q?mZxq6HliqpZIbIJM4xPsdZcRwXrgvadTkD8ZrhAM7Yh9XK4QV7960VNt1Xqq?=
 =?us-ascii?Q?v9r0dSrLQUt5b8/32L6zfBQSd2ZGhXGrLRZFZgDk0AMXnDglbUQioo356jxa?=
 =?us-ascii?Q?AoiHU2lYdWqgdk18Id4u66n+O6wMvYhRlrh45o9jQAv+kI7S08w8vUpEAg34?=
 =?us-ascii?Q?k7bEJuxgYgK+Z0kTi4yEj/n+WjtDlMqXXbFCNILCN7fkebd7E6i61E1uCvd4?=
 =?us-ascii?Q?qkUTBMZqKpS3hOmODOWXSXnscjBmS8Xs4tQPyKs9gg29eN00E2oNQeUs1ZmC?=
 =?us-ascii?Q?3T7+JDM8rEeM+coKTLL1gSBibOP/bgo6LWNngVZnYAkDuW/Dr1N8BllMYx3f?=
 =?us-ascii?Q?AJGgEXsOpY9lz63pV8x1zIxjc75Eg9Z5M4pvtADgQNdirYjkL5kwid8QbjaO?=
 =?us-ascii?Q?6F2gNsnGPQWZZ6uzLxRyVR6Xx/0e9TkJc3dwtDWBiOrRpgz/tK/F0uxaTIRl?=
 =?us-ascii?Q?NPX27iiNWF9FMyyBvN4B75ocmdmWArfbDdTrUmJFpOiX4lRK?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 909a744d-f9ff-4af6-7ec8-08df14c0aae9
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2026 13:36:24.3577
 (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: 6tNDhJFsbs/u6Gkvcisv/8RQH1qlLi2FAEqv2BfS3umXGJUslr5WI0j+mVs76HjC7A2ZfoA4gGKAg8q0SKOjAQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR03MB8265
X-purgate-ID: tlsNG-42698a/1789652187-AB4D39EA-49733D1E/0/0
X-purgate-type: clean
X-purgate-size: 3081

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

________________________________________
From: win-pv-devel <win-pv-devel-bounces@lists.xenproject.org> on behalf of=
 Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: 16 September 2026 1:35 PM
To: win-pv-devel@lists.xenproject.org
Cc: Tu Dinh
Subject: [PATCH v2 3/3] Move TIME_* macros to util.h

These macros were being repeatedly used and so should share the same
definition.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
---
 src/common/util.h  |  5 +++++
 src/xenbus/cache.c |  5 -----
 src/xenbus/fdo.c   |  5 -----
 src/xenbus/store.c | 10 ----------
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/common/util.h b/src/common/util.h
index dbf64fd..36f71f9 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -41,6 +41,11 @@
 #define        P2ROUNDUP(_t, _x, _a)   \
         (-(-((_t)(_x)) & -(((_t)(_a)))))

+#define TIME_US(_us)            ((_us) * 10ll)
+#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
+#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
+#define TIME_RELATIVE(_t)       (-(_t))
+
 static FORCEINLINE LONG
 __ffs(
     _In_ unsigned long long mask
diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index ae72464..e513f77 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -1056,11 +1056,6 @@ CacheDebugCallback(
     }
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_CACHE_MONITOR_PERIOD 5

 static NTSTATUS
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 50075f7..0537654 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -1642,11 +1642,6 @@ loop:
     return STATUS_SUCCESS;
 }

-#define TIME_US(_us)            ((_us) * 10ll)
-#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
-#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
-#define TIME_RELATIVE(_t)       (-(_t))
-
 static FORCEINLINE NTSTATUS
 __FdoBalloonSetActive(
     _In_ PXENBUS_FDO        Fdo
diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index bd9067e..fe3efcc 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -909,11 +909,6 @@ StoreDpc(
     __StorePoll(Context);
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_POLL_PERIOD 5

 static PXENBUS_STORE_RESPONSE
@@ -1994,11 +1989,6 @@ StorePoll(
     __StorePoll(Interface->Context);
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_WATCHDOG_PERIOD 15

 static NTSTATUS
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 15:43:39 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 15:43:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424249.1648847 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7EGx-0000z4-95; Thu, 17 Sep 2026 15:43:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424249.1648847; Thu, 17 Sep 2026 15:43:39 +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 1x7EGx-0000yx-6e; Thu, 17 Sep 2026 15:43:39 +0000
Received: by outflank-mailman (input) for mailman id 1424249;
 Thu, 17 Sep 2026 15:43:38 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x7EGw-0000yq-Gl
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:43:38 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7EGv-00E9Wf-U5
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 17:43:37 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0a9d-8faa-0a2a0a5109dd-0a2a4509b206-18
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:37 +0200
Received: from [74.125.228.140] (helo=mail-ej2-f12.google.com)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0aa9-be1a-0a2a45090019-4a7de48c85f5-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:37 +0200
Received: by mail-ej2-f12.google.com with SMTP id
 a640c23a62f3a-c264788fd58so165667066b.1
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 08:43:37 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29de5baa11sm322343366b.40.2026.09.17.08.43.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 17 Sep 2026 08:43:36 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789659817; x=1790264617; darn=lists.xenproject.org;
        h=content-transfer-encoding:content-type:mime-version:message-id:date
         :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=Ye1IDdrA3FrZbI9CkYHASNraX5c5ej67ACXZfjW6MZo=;
        b=AJKHwomUsFaeM4gB3nFMC1Og94SbDs4VyVDKkG4RQ0uHXMvyGSNnljnuVS9VBgpRIQ
         jn1ErnIG/C/eqSmFqUxN9mXL7lL751xYEghdKMM3IsjcX3sTuSHlh4MixcBDXfZPWd+0
         mWekhy0Sbzib0yYSaAY8scB68xF8hXRNSjZyA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1789659817; x=1790264617;
        h=content-transfer-encoding:content-type:mime-version:message-id:date
         :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=Ye1IDdrA3FrZbI9CkYHASNraX5c5ej67ACXZfjW6MZo=;
        b=WwXHxviQH9FiI4LHZPpkmtBox+AXVCwyp9ssRewBkwf9TXZHpLfBPVThZt1B+JjgJ/
         5NOv5ejQ6FHZGZIE4MVr+O+TZljUgZAhuLHN2z0UfNLF6KJmiVJaT5lL35LNkXkfnKg1
         8/q3CZHbO8jV6mWhmcxFInwvgS8VfWhT/a0UT4DJtgxYkLheeJ8JjHqmkyKl2k8p4I/B
         LKR/lYPdvC665xUUSLsI5FXVgcelH3bvBqmd6wvf0NAZv04pciN4FILanuigueaNsRrz
         2+VFh9nPEUMT4f+JpVIKo3YFXf4EtGf5Gx0z31Nkb8H4VIgtV2vEf+tug1w4rIV3nG4g
         e5bA==
X-Gm-Message-State: AFuF++koV7rl68vRe506X9lm7nxKcIXy3aeFDRZxK/9mIOaX3Xg9S5QC
	6WnKXAm3UTq6cNOIHZa4EtLK8xRy7r9vhIyEIRYFswnTcSGe7p+XPG2Ke5gdQm71fEz/oKz7DtM
	RFbmt
X-Gm-Gg: AYBFou3n8LNE37IeJBzSJ4iTvSKwbQy/rrUHd3ikGZXVgxFajnTg4xuuXeKbQfae5uP
	uWPde94RD6B5WAciNATlINF7wVLNsWgAzKDBZFkW97RJS8VHMZ3yWaPobcYn+BrFVn4rI1kGTAh
	UwGSddDavqZ9oa3f90MlAW+R0iY3K+2rtHbsmD1WRWKLHCKvGKzW3b/3XTUZWjUDjUNS/RNF2u9
	vy5YeVKQIVQ2r12ECsDWU8De0Ft+5oyMOeLlmDvofIrrqIXev3e/rLD1j980eIuYUNsgm+iLZ8I
	WwDjw9y+SDsNL36OZ7vGP+/l+ycN10gpQBCl/4D+P/C9t7wK4CE3/r2wu7BnNJ77dgS9nPnLrIR
	2DO4SuuJgAmn3FKcvtMjKEPxUwndlUJASrTqJUwqBLFnjtUtDss0Of6FRYmL0B/zzIPvgoKUQ0M
	n5lIBnQWP+uO+2WF5ESgZmVv7pbx4LSg547Efhr0SGzP7Pi6R9CRuORuz702FsgavtCPeLt1aXm
	QWKctLgw2gfpGBXvb+SAfoh1AASEggQCa1isyU=
X-Received: by 2002:a17:906:9c89:b0:c20:3402:bd35 with SMTP id a640c23a62f3a-c29e5207783mr502462466b.12.1789659816822;
        Thu, 17 Sep 2026 08:43:36 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 0/2] xennet: improve RX NBL batching and fix TX doorbell coalescing
Date: Thu, 17 Sep 2026 16:41:28 +0100
Message-ID: <20260917154131.2040-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-bad1c0/1789659817-BFED6034-46505C83/0/0
X-purgate-type: clean
X-purgate-size: 1959

This series addresses two independent throughput issues in xennet.

Patch 1 — NBL batching on the receive path:

  The receive path previously called NdisMIndicateReceiveNetBufferLists
  once per NBL (batch size of 1), causing excessive NDIS stack overhead
  on high-throughput workloads. This patch raises NblBatchMax to 32
  (configurable up to 64), groups consecutive NBLs with the same
  EtherType into a single indicate call with
  NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE, and fixes __ReceiverPushPackets
  to move KeMemoryBarrier before the Returned/Indicated reads and return
  early when the queue is empty.

Patch 2 — TX doorbell coalescing across NBL boundaries:

  __TransmitterSendNetBufferList computed the More flag as
  (NET_BUFFER_NEXT_NB(NetBuffer) != NULL), which evaluates to FALSE for
  the last NB of every NBL even when the outer loop still has additional
  NBLs to submit. This caused a premature doorbell ring between
  back-to-back NBLs. Fixed by passing MoreNbls from the outer loop.

  Note: a companion fix in xenvif is also required —
  TransmitterQueuePacket unconditionally reset More = FALSE for
  non-RSS traffic, overriding the value passed in from xennet.

Performance (iperf2, 60 s, 3 runs, Windows PV guest):

  Single-stream TCP:  4,606 -> 6,056 Mbps  (+31.5%)
  8-stream TCP:      14,663 -> 18,679 Mbps  (+27.4%)
  8-stream UDP:       1,117 ->  1,230 Mbps  (+10.1%)
  Single-stream UDP:    327 ->    329 Mbps  (no change, expected)

david ambu (2):
  xennet: improve NBL batching receive path
  xennet: fix TX doorbell coalescing — More flag dropped at NBL
    boundaries

 src/xennet.inf           |   6 +++
 src/xennet/adapter.c     |  13 +++++
 src/xennet/adapter.h     |   8 +++
 src/xennet/receiver.c    | 108 +++++++++++++++++++++++++++++----------
 src/xennet/transmitter.c |   9 ++--
 5 files changed, 114 insertions(+), 30 deletions(-)

-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 15:43:52 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 15:43:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424250.1648851 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7EHA-00011G-Av; Thu, 17 Sep 2026 15:43:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424250.1648851; Thu, 17 Sep 2026 15:43: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 1x7EHA-000119-8P; Thu, 17 Sep 2026 15:43:52 +0000
Received: by outflank-mailman (input) for mailman id 1424250;
 Thu, 17 Sep 2026 15:43:51 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x7EH9-00010q-4v
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:43:51 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7EH8-00ECvy-Hh
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 17:43:50 +0200
Received: from [10.42.69.6] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0ab4-e002-0a2a0a5209dd-0a2a4506a256-8
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:50 +0200
Received: from [74.125.228.140] (helo=mail-ej2-f12.google.com)
 by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0ab6-195a-0a2a45060019-4a7de48cea26-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:50 +0200
Received: by mail-ej2-f12.google.com with SMTP id
 a640c23a62f3a-c254fa663c1so132763466b.0
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 08:43:50 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29de5baa11sm322343366b.40.2026.09.17.08.43.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 17 Sep 2026 08:43:49 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789659830; x=1790264630; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=fsSSNS+X+NRFMjGV+JfBngj90GG0I+MHs5AChmbS5cg=;
        b=VHcMCtj6CXnNRALDIWNRTSXD4Qea+uimbeqDGcInLN2VBXMyuE2yICrMm+F+joVub2
         5vMCQlGnMLK40upbshtM5qnxTrbJ91vtd3IYzkcoKcF89xe/gcgIQLYwYOmL7sffwh46
         e2ukEyP6lzNm6LtCU77nnVidUDqmUOk7UoSqk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1789659830; x=1790264630;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=fsSSNS+X+NRFMjGV+JfBngj90GG0I+MHs5AChmbS5cg=;
        b=yxcSHynXRs8ZgbZ5AAR4zuparlt7tQRUggzQCQs5XtKT7ODVA9Bgijk+jWUw3eOZqN
         4+g2UkCHhZqdf6SS9HU5TQ5GXp3NdZVbpTyhNPfN9HoW+eRkidBVM1jI1AUiSRtgZphK
         NH7izIGyioxzzjVlzrQfjebyqKeOFbjkOyJ4LSh6qEHz9m/9zlTk2jNgsR8OQ8yqQB6b
         hQQJLzkNLXIpObLrSBfdIpoEK6UOmP99P+qcQRsDBclqsP9rp0V51JKdOmL6aEcIMZr0
         uhWr/JCzehbAMZ20fDWLkn+TBShyzCAuPXvgWZ9SBGBnnbsQtPyEafrD0BUv1Jz5z0o3
         TNxg==
X-Gm-Message-State: AFuF++mNMQ50WKKJGmC5MAvG/MckmRGIrE2ojpAP8o84xEeIn2n2tm2/
	Rdd1VACMyQEIUppsuBz3BK963iBTw9go9m5xhrZYgs75Fi1Ouj9RiJPzGT1ySeZZNDUXRoSnO9R
	AWeq1
X-Gm-Gg: AYBFou2LjQZPvPXHTopEtFu3wFt73iqXgynxDLHzSODQQ38R7u3Xeysl4MiVjo33+j+
	Jc/m72w51jcch/j+qHWPguFopUFpjAt9xTA2ZVCilILabe6/tN8JBvDTeDLKyPni+Irmp/7niGg
	3S1oICXk6f+EZt4lQV4Eei40n38MZqVEdunvd5RxfxzhWDArk/diOe6xlCA21z26evY0PTXiq+6
	xRWoEpm9uf8wKR0XA6TezhUTFxAdlw6olpyw7FbC3hoFwoTeWNWddgLtiPetIcpnPh1V4GUbfi2
	oYs1jCDK8+DNotLcXKFvG9HvFzJvUiHSVhU/FcyhtcuuxE3rWQuH44DD/Sj2xJz/HPCqu9LQI71
	1EabjRaiY2x4fhtfp86iEzYeFuqSo4bB4J+T/DVuAXE7YcZlK8S+iGs5ic2am/NrhHJ5TgETHde
	dkNdRC9FZKcqH1VlD0gbmW+ltI+lKzFhp2QGwjFNIRqH51WS+1CQQfkhj2tDmM1s9QVxhvhFbFW
	BzwWkOE/9vSm20bd/QPiL3KTtfLEPlSvUIvtCQ=
X-Received: by 2002:a17:906:7311:b0:c20:9447:bd5e with SMTP id a640c23a62f3a-c29e5245c33mr692904766b.9.1789659829311;
        Thu, 17 Sep 2026 08:43:49 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 1/2] xennet: improve NBL batching receive path
Date: Thu, 17 Sep 2026 16:41:29 +0100
Message-ID: <20260917154131.2040-2-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260917154131.2040-1-david.preetham@citrix.com>
References: <20260917154131.2040-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-16d1c6/1789659830-F520877B-32CA8033/0/0
X-purgate-type: clean
X-purgate-size: 10908

  Raise NblBatchMax default to 32 (max 64). Split batches at
  EtherType boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per
  batch. Fix __ReceiverPushPackets: move KeMemoryBarrier before Returned/
  Indicated reads, and return early when queue is empty.

Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xennet.inf        |   6 +++
 src/xennet/adapter.c  |  13 +++++
 src/xennet/adapter.h  |   8 ++++
 src/xennet/receiver.c | 108 +++++++++++++++++++++++++++++++-----------
 4 files changed, 108 insertions(+), 27 deletions(-)

diff --git a/src/xennet.inf b/src/xennet.inf
index 55e11a2..79730e8 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    Default,    0, "8"
 HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
 HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
 
+HKR, Ndi\Params\NblBatchMax, 			  		  ParamDesc,  0, %NblBatchMax%
+HKR, Ndi\Params\NblBatchMax, 			  		  Type,       0, "int"
+HKR, Ndi\Params\NblBatchMax, 			  		  Default,    0, "32"
+HKR, Ndi\Params\NblBatchMax, 			  		  Min, 	      0, "1"
+HKR, Ndi\Params\NblBatchMax, 			  		  Max, 	      0, "64"
 [XenNet_Inst.Services] 
 AddService=xennet,0x02,XenNet_Service,XenNet_EventLog
 
@@ -248,6 +253,7 @@ Enabled="Enabled"
 Enabled-Rx="Rx Enabled"
 Enabled-Tx="Tx Enabled"
 Enabled-TxRx="Rx & Tx Enabled"
+NblBatchMax="Max Receive Indicate NBLS"
 
 SERVICE_BOOT_START=0x0 
 SERVICE_SYSTEM_START=0x1 
diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index f79c0c8..6e5a95a 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
     int lrov6;
     int rss;
     int numrssqueues;
+    int nblbatchmax;
 } PROPERTIES, *PPROPERTIES;
 
 typedef struct _XENNET_RSS {
@@ -1480,6 +1481,17 @@ AdapterGetHandle(
     return Adapter->NdisAdapterHandle;
 }
 
+ULONG
+AdapterGetNblMaxBatchSize(
+    IN  PXENNET_ADAPTER     Adapter
+    )
+{
+    ULONG val = (ULONG)Adapter->Properties.nblbatchmax;
+    if (val == 0 || val > NBL_BATCH_SIZE_MAX)
+        return NBL_BATCH_SIZE_DEFAULT;
+    return val;
+}
+
 PXENVIF_VIF_INTERFACE
 AdapterGetVifInterface(
     IN  PXENNET_ADAPTER     Adapter
@@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
     READ_PROPERTY(Adapter->Properties.need_csum_value, L"NeedChecksumValue", 1, Handle);
     READ_PROPERTY(Adapter->Properties.rss, L"*RSS", 1, Handle);
     READ_PROPERTY(Adapter->Properties.numrssqueues, L"*NumRSSQueues", 8, Handle);
+    READ_PROPERTY(Adapter->Properties.nblbatchmax, L"NblBatchMax", NBL_BATCH_SIZE_DEFAULT, Handle);
 
     NdisCloseConfiguration(Handle);
 
diff --git a/src/xennet/adapter.h b/src/xennet/adapter.h
index 2ea0345..a54cb4d 100644
--- a/src/xennet/adapter.h
+++ b/src/xennet/adapter.h
@@ -121,4 +121,12 @@ AdapterQueryInformation(
     IN  PNDIS_OID_REQUEST   Request
     );
 
+#define NBL_BATCH_SIZE_DEFAULT  32
+#define NBL_BATCH_SIZE_MAX      64
+
+extern ULONG
+AdapterGetNblMaxBatchSize(
+    IN  PXENNET_ADAPTER     Adapter
+    );
+
 #endif // _XENNET_ADAPTER_H_
diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index b4cf4f0..c46e6a3 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -34,6 +34,7 @@
 #include <procgrp.h>
 #include <tcpip.h>
 #include <xen.h>
+#include <ethernet.h>
 
 #include "util.h"
 #include "receiver.h"
@@ -64,6 +65,7 @@ struct _XENNET_RECEIVER {
 
 typedef struct _NET_BUFFER_LIST_RESERVED {
     PVOID   Cookie;
+    USHORT  EtherType;
 } NET_BUFFER_LIST_RESERVED, *PNET_BUFFER_LIST_RESERVED;
 
 C_ASSERT(sizeof (NET_BUFFER_LIST_RESERVED) <= RTL_FIELD_SIZE(NET_BUFFER_LIST, MiniportReserved));
@@ -120,6 +122,7 @@ __ReceiverAllocateNetBufferList(
     IN  PMDL                    Mdl,
     IN  ULONG                   Offset,
     IN  ULONG                   Length,
+    IN  PXENVIF_PACKET_INFO     Info,
     IN  PVOID                   Cookie
     )
 {
@@ -156,10 +159,25 @@ __ReceiverAllocateNetBufferList(
 
     if (NetBufferList != NULL) {
         PNET_BUFFER_LIST_RESERVED   ListReserved;
+        USHORT                      EtherType = 0;
+
+        if (Info->EthernetHeader.Length != 0) {
+            PUCHAR              Buffer;
+            PETHERNET_HEADER    EthernetHeader;
+
+            Buffer = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority | MdlMappingNoExecute);
+            if (Buffer != NULL) {
+                EthernetHeader = (PETHERNET_HEADER)(Buffer + Offset + Info->EthernetHeader.Offset);
+                EtherType = ETHERNET_HEADER_IS_TAGGED(EthernetHeader) ?
+                            EthernetHeader->Tagged.TypeOrLength :
+                            EthernetHeader->Untagged.TypeOrLength;
+            }
+        }
 
         ListReserved = (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPORT_RESERVED(NetBufferList);
         ASSERT3P(ListReserved->Cookie, ==, NULL);
         ListReserved->Cookie = Cookie;
+        ListReserved->EtherType = EtherType;
     }
 
     return NetBufferList;
@@ -178,6 +196,7 @@ __ReceiverReleaseNetBufferList(
     ListReserved = (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPORT_RESERVED(NetBufferList);
     Cookie = ListReserved->Cookie;
     ListReserved->Cookie = NULL;
+    ListReserved->EtherType = 0;
 
     if (Cache)
         __ReceiverPutNetBufferList(Receiver, NetBufferList);
@@ -240,12 +259,12 @@ __ReceiverReceivePacket(
     NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO   csumInfo;
 
     UNREFERENCED_PARAMETER(MaximumSegmentSize);
-    UNREFERENCED_PARAMETER(Info);
 
     NetBufferList = __ReceiverAllocateNetBufferList(Receiver,
                                                     Mdl,
                                                     Offset,
                                                     Length,
+                                                    Info,
                                                     Cookie);
     if (NetBufferList == NULL)
         goto fail1;
@@ -328,9 +347,11 @@ fail1:
     return NULL;
 }
 
-static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
+
+static FORCEINLINE VOID
+__IndicateReceiveNetBufferLists(
     IN  PXENNET_RECEIVER    Receiver,
-    IN  PNET_BUFFER_LIST    NetBufferLists,
+    IN  PNET_BUFFER_LIST    Remaining,
     IN  NDIS_PORT_NUMBER    PortNumber,
     IN  ULONG               NumberOfNetBufferLists,
     IN  ULONG               ReceiveFlags
@@ -339,39 +360,70 @@ static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
     PXENNET_ADAPTER         Adapter = Receiver->Adapter;
     NDIS_HANDLE             MiniportAdapterHandle = AdapterGetHandle(Adapter);
     PXENVIF_VIF_INTERFACE   VifInterface;
-    ULONG                   Count;
-
-    VifInterface = AdapterGetVifInterface(Receiver->Adapter);
+    ULONG                   Count = 0;
+    ULONG                   NblMaxBatch = AdapterGetNblMaxBatchSize(Adapter);
+
+    while (Remaining != NULL) {
+        PNET_BUFFER_LIST    BatchTail = Remaining;
+        PNET_BUFFER_LIST    NextNbl;
+        ULONG               BatchCount = 1;
+        ULONG               BatchFlags;
+        USHORT              FirstEth;
+
+        FirstEth = ((PNET_BUFFER_LIST_RESERVED)
+                    NET_BUFFER_LIST_MINIPORT_RESERVED(Remaining))->EtherType;
+        NextNbl = NET_BUFFER_LIST_NEXT_NBL(BatchTail);
+
+        while (NextNbl != NULL && BatchCount < NblMaxBatch) {
+            USHORT  CurEth;
+            CurEth = ((PNET_BUFFER_LIST_RESERVED)
+                      NET_BUFFER_LIST_MINIPORT_RESERVED(NextNbl))->EtherType;
+            if (CurEth != FirstEth)
+                break;
+            BatchTail = NextNbl;
+            NextNbl = NET_BUFFER_LIST_NEXT_NBL(BatchTail);
+            BatchCount++;
+        }
 
-    Count = 0;
-    while (NetBufferLists != NULL) {
-        PNET_BUFFER_LIST        Next;
+        NET_BUFFER_LIST_NEXT_NBL(BatchTail) = NULL;
 
-        Next = NET_BUFFER_LIST_NEXT_NBL(NetBufferLists);
-        NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) = NULL;
+        BatchFlags = ReceiveFlags;
+        if (FirstEth != 0)
+            BatchFlags |= NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
+        else
+            BatchFlags &= ~NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
 
         NdisMIndicateReceiveNetBufferLists(MiniportAdapterHandle,
-                                           NetBufferLists,
+                                           Remaining,
                                            PortNumber,
-                                           1,
-                                           ReceiveFlags);
+                                           BatchCount,
+                                           BatchFlags);
 
-        if (ReceiveFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
-            PVOID   Cookie;
+        if (BatchFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
+            PNET_BUFFER_LIST    Current = Remaining;
 
-            Cookie = __ReceiverReleaseNetBufferList(Receiver,
-                                                    NetBufferLists,
-                                                    FALSE);
+            VifInterface = AdapterGetVifInterface(Receiver->Adapter);
 
-            XENVIF_VIF(ReceiverReturnPacket,
-                       VifInterface,
-                       Cookie);
+            while (Current != NULL) {
+                PNET_BUFFER_LIST    Next = NET_BUFFER_LIST_NEXT_NBL(Current);
+                NET_BUFFER_LIST_NEXT_NBL(Current) = NULL;
 
-            (VOID) InterlockedIncrement(&Receiver->Returned);
+                PVOID Cookie = __ReceiverReleaseNetBufferList(Receiver,
+                                                              Current,
+                                                              FALSE);
+
+                XENVIF_VIF(ReceiverReturnPacket,
+                           VifInterface,
+                           Cookie);
+
+                Current = Next;
+            }
+
+            (VOID)InterlockedAdd(&Receiver->Returned, BatchCount);
         }
 
-        Count++;
-        NetBufferLists = Next;
+        Count += BatchCount;
+        Remaining = NextNbl;
     }
     ASSERT3U(Count, ==, NumberOfNetBufferLists);
 }
@@ -402,12 +454,14 @@ __ReceiverPushPackets(
 
     KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
 
-    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
+    if (Count == 0)
+        return;
 
-    Returned = Receiver->Returned;
+    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
 
     KeMemoryBarrier();
 
+    Returned = Receiver->Returned;
     Indicated = Receiver->Indicated;
 
     Flags = NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 15:43:56 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 15:43:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424251.1648857 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7EHE-00013H-D0; Thu, 17 Sep 2026 15:43:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424251.1648857; Thu, 17 Sep 2026 15:43:56 +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 1x7EHE-000137-9r; Thu, 17 Sep 2026 15:43:56 +0000
Received: by outflank-mailman (input) for mailman id 1424251;
 Thu, 17 Sep 2026 15:43:55 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x7EHD-00012v-BU
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:43:55 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7EHC-00E9bC-O2
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 17:43:54 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0ab2-8faa-0a2a0a5109dd-0a2a4507d03a-16
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:54 +0200
Received: from [74.125.228.151] (helo=mail-ej2-f23.google.com)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0aba-b4ea-0a2a45070019-4a7de4978085-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:43:54 +0200
Received: by mail-ej2-f23.google.com with SMTP id
 a640c23a62f3a-c25ef7a3ce9so144843366b.3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 08:43:54 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c29de5baa11sm322343366b.40.2026.09.17.08.43.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 17 Sep 2026 08:43:53 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789659834; x=1790264634; darn=lists.xenproject.org;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=+x/u32xTT+RoapLuWePexyD4ZM5vMJPjrEx2Q09sGOA=;
        b=jDVu4wb0mgz/bpDIFCSTVRrl91584hcJnW9NYII2cjnZgqSWEk7LQ8E0j+1oXxqz9h
         1Gb3UU1hPPHAYtPnFvgX+QuBudoaLGczxOBNi+BlY80qbA0Ko9/WdTfIeTiNSI4VvWuU
         YQuPcJ2InVHsmCVRReQJ2xWTTK9r1Up/rDTKw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1789659834; x=1790264634;
        h=content-transfer-encoding:content-type:mime-version:references
         :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=+x/u32xTT+RoapLuWePexyD4ZM5vMJPjrEx2Q09sGOA=;
        b=jeX45ja+Wa1iRNhThE+B5JTZIQeAF2jxHCBNIJdDg3onqYUpCHabGPkH0fDpDapPsf
         9nE+HWqPl3fvTNjJivawUDw85GW58L6agJFVlps1/sLdZe8FJcSI92gD1B4Z+S4HIoCy
         Ev8c0QhX4wZGtp8m6WLIbPHtqvMtuiiOKnW3d05zoBSGr8uLFYlEqZKZPqCd8DLluXzL
         frTUFBeBVqftF/VO6YTyluz0MiUCA+Wczwp12FvST+8BRMM+vLgqmVYEMzbg0DNpp5XX
         f19Kqx1gBzk5Auc/QLMBt3Ka4wLgpjDnVAIEbtKr5hmQQRdIgoM6t3/4xqCwoFhORFuV
         a9EQ==
X-Gm-Message-State: AFuF++l+4vT12hF57e958u3P+dVfLhoNY2d6TDeRatJYrHo6Vth4wzv0
	wQfJmoPZi1YO08DKVgySHyHB1szj2kYM0spnzjxt606t1W7oZg1vYKfdbjsZtWWsvcMwKIlAVMG
	CT6v3
X-Gm-Gg: AYBFou0G+jpCnCVEbZn8MZeeBFBA8mRwPQtUrwuz0jFYx1SgipXGSPfuGlIO2V9M90C
	2Qgn2dP5U4p4/exUpdEs24i/hCGTYxUxwcGzI90YW4lcW/9numDqEcdZ2dGXhxE1km+qXONOLZ/
	Uk7g9uL2B4O/sevjomjfzDibVpJJ0PZj8C6sas1o1rfc7f2dQ/Q5gB1O785225NUw1SA4wpwKtx
	p7bca1yP5QxsMV67cDe4U9acxN8DX+hKz6YSF5DG5i1erffpQHsUlB218+BP7rpe3GPRckqr+9p
	3mI5vHvQh1XdTAHBfap7Ywd8It44mG3zTM+0cajZjGmbxCyDlCyrl4ZHgAZCZ42gVTP4OdSCmV6
	snjicqKVFQAU3hSoppBlBgWdk9R6ZTrhdmT4pxOXZNeZYHAZN6Y9SqJeIOQU8LuD4U3CNhPVLo7
	yvM+FERyvcytFMU6ooHL3/vdEAM6QBKSlx7PmEOa8KvtNaF5Vb3N8Nd5Ki+5y1G46kC/lUSCm4h
	/wbcaVoWC/0cy4+xvSzh6Q4onXoGxxL4GJ9wd4=
X-Received: by 2002:a17:907:9621:b0:c29:4415:2ec6 with SMTP id a640c23a62f3a-c29e520778fmr575521466b.12.1789659833785;
        Thu, 17 Sep 2026 08:43:53 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 2/2] =?UTF-8?q?xennet:=20fix=20TX=20doorbell=20coalescing?= =?UTF-8?q?=20=E2=80=94=20More=20flag=20dropped=20at=20NBL=20boundaries?=
Date: Thu, 17 Sep 2026 16:41:30 +0100
Message-ID: <20260917154131.2040-3-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260917154131.2040-1-david.preetham@citrix.com>
References: <20260917154131.2040-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-ef75cf/1789659834-A64DBAE4-26C2D8E6/0/0
X-purgate-type: clean
X-purgate-size: 1985

  __TransmitterSendNetBufferList computed the More flag as
  (NET_BUFFER_NEXT_NB(NetBuffer) != NULL), which only looks at remaining
  NET_BUFFERs within the current NBL. This evaluates to FALSE for the last
  NB of every NBL, even when the outer loop in TransmitterSendNetBufferLists
  still has additional NBLs to submit in the same batch.

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xennet/transmitter.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xennet/transmitter.c b/src/xennet/transmitter.c
index 4bb82bc..e17d89f 100644
--- a/src/xennet/transmitter.c
+++ b/src/xennet/transmitter.c
@@ -288,7 +288,8 @@ __TransmitterHash(
 static VOID
 __TransmitterSendNetBufferList(
     IN  PXENNET_TRANSMITTER     Transmitter,
-    IN  PNET_BUFFER_LIST        NetBufferList
+    IN  PNET_BUFFER_LIST        NetBufferList,
+    IN  BOOLEAN                 MoreNbls
     )
 {
     PNET_BUFFER_LIST_RESERVED   ListReserved;
@@ -338,7 +339,7 @@ __TransmitterSendNetBufferList(
                                 MaximumSegmentSize,
                                 TagControlInformation,
                                 &Hash,
-                                (NetBufferListNext != NULL) ? TRUE : FALSE,
+                                (NetBufferListNext != NULL || MoreNbls) ? TRUE : FALSE,
                                 Cookie);
         }
         else
@@ -384,7 +385,9 @@ TransmitterSendNetBufferLists(
         ListNext = NET_BUFFER_LIST_NEXT_NBL(NetBufferList);
         NET_BUFFER_LIST_NEXT_NBL(NetBufferList) = NULL;
 
-        __TransmitterSendNetBufferList(Transmitter, NetBufferList);
+        __TransmitterSendNetBufferList(Transmitter,
+                                       NetBufferList,
+                                       (ListNext != NULL) ? TRUE : FALSE);
 
         NetBufferList = ListNext;
     }
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Thu Sep 17 15:45:08 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Sep 2026 15:45:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1424253.1648860 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7EIO-00017g-GQ; Thu, 17 Sep 2026 15:45:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1424253.1648860; Thu, 17 Sep 2026 15:45:08 +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 1x7EIO-00017Z-Df; Thu, 17 Sep 2026 15:45:08 +0000
Received: by outflank-mailman (input) for mailman id 1424253;
 Thu, 17 Sep 2026 15:45:07 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x7EIN-00017T-FK
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 15:45:07 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7EIM-003STF-SC
 for win-pv-devel@lists.xenproject.org; Thu, 17 Sep 2026 17:45:06 +0200
Received: from [10.42.69.6] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0b01-bab6-0a2a0a5309dd-0a2a4506c046-6
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:45:06 +0200
Received: from [74.125.228.76] (helo=mail-ed2-f12.google.com)
 by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6aac0b02-195a-0a2a45060019-4a7de44cd328-3
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 17:45:06 +0200
Received: by mail-ed2-f12.google.com with SMTP id
 4fb4d7f45d1cf-6a67fa7a64eso1598893a12.1
 for <win-pv-devel@lists.xenproject.org>; Thu, 17 Sep 2026 08:45:06 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.166.251.127])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6aa1d228edfsm4033152a12.10.2026.09.17.08.45.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 17 Sep 2026 08:45:05 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1789659906; x=1790264706; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=TCLAB0cfngKxKmMHs2QOnGqeNIcnMuzXREQrBYEVU6E=;
        b=VxP7pLpK6GbMW5Fk3RfJc19PVQiCRoCYDsOJyJkjLf2ExztV9pZ2gcJ4YY+0kZmsw5
         KT3zjmEdZ8w7XETYK7CVC3yXYf+mjUdM6QR8bRuJGN9uIqC8XKYsa4U/M4EGMpE5ZG24
         6bAXI/tp+g01ejHffjzFYsMp5ESxUQQvZj5Nw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1789659906; x=1790264706;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=TCLAB0cfngKxKmMHs2QOnGqeNIcnMuzXREQrBYEVU6E=;
        b=cOLJCn+Zkj3oI4Wbj7RP+LNIk2VT9ZRJMaHMnlWLASjymvvqPKA1CrN7NGADNWiWWl
         USSQu+P07x2G/5bZyHtCH7/yhSOxIClDJCoWmdpk1AagJPYPMKYF6aKC6+1yaKwytxZU
         wxQ8uwV6elIn8Jzyteve7j8roTn558SXiXAKi+XZToQLx2spAgPvIxq3/RuWYcMzXYTz
         4pxUcKBSGGRtC4FYvFVxk/baBhn3VLV1X67P8UWWzynKwgBxjU65bGA3kjSBnEklgKCf
         9s6ghK+X0JN3BqfT0GKfbD/1ERUR0kQ6411DevMOuabYShs0JKM0/56JMXN1KDvZzuXo
         9G+A==
X-Gm-Message-State: AFuF++mFEkIDeYwGZfmQC97+oTVz4UoW4M/Jt0SkFoJLVvl/YcKFjEK0
	HyZSXBXelGLm+w2LPJNwCj6TDamu5J9VQCRz8K7dEsWKXmSlsY/WpTO3nlRG3KJRCL8D5icRARw
	HSJr8LGg=
X-Gm-Gg: AYBFou3a9P6/5n+2iSz0ViPfTo20oESzjywbhqq/85Ivpq6HxwLN/qrZlAf2WyBkKDC
	V1UMhBT2qd/amquqQGNRar9jvBRExPJ7R6VoHIylzdilc0L/zWDQsazs3ePqUXfT/25iJAUcaRl
	C9gkQ2433v8zQ58G5ImTZPv+3Fu3aOwZG2a7ItSPuQ/T1443UBDNulV5t3XBZiGmW+hGVHAkqof
	9K+wWP1/3VSqUe1M9qF0tvXqHCK6NQ6KpfMpoaZUd0+pwEcUAIPkA3NUj775xXqRBcMYtB1erzs
	8XtAwWZYwAnZ7VLyxZuRjqKySzjrwScKLqBn4iAxJ3J26UbMOKGhO5xqRYIY8ZGlL1dbqoGUnrj
	vyyAKYjkdCzlZPWT/D81VTEJb7nwVQrtw3As5vP2LgfA1rr7akg2h3Dd4nmmsS9YjILrh0Hdcgb
	eUu64ggsxqFxELheENsurCT3Y26v8sNPF/chsPvi/ocsuyJN3c6tEh4jGDJESZAJ9+vhSAGRDbt
	uJfg/TyJGvF/4IwBU17K9QbWEcII3mOrrdA+mk=
X-Received: by 2002:a05:6402:3205:b0:6a7:ea53:f61a with SMTP id 4fb4d7f45d1cf-6aa2240fa64mr5471545a12.25.1789659906126;
        Thu, 17 Sep 2026 08:45:06 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH] xenvif: fix TX doorbell coalescing - More overridden for non-RSS traffic
Date: Thu, 17 Sep 2026 16:44:37 +0100
Message-ID: <20260917154437.1794-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-16d1c6/1789659906-1F4C977B-3C1DC970/0/0
X-purgate-type: clean
X-purgate-size: 824

  TransmitterQueuePacket unconditionally set More = FALSE in the
  XENVIF_PACKET_HASH_ALGORITHM_NONE case, overriding the More value
  passed in from xennet regardless of batch depth.

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: david ambu <david.preetham@citrix.com>
---
 src/xenvif/transmitter.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index 8c4ee41..ad58336 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -5245,7 +5245,6 @@ TransmitterQueuePacket(
     switch (Algorithm) {
     case XENVIF_PACKET_HASH_ALGORITHM_NONE:
         Value = __TransmitterHashPacket(Transmitter, Packet);
-        More = FALSE;
         break;
 
     case XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED:
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Fri Sep 18 11:57:46 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Sep 2026 11:57:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1425207.1649301 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x7XDt-0002bc-BW; Fri, 18 Sep 2026 11:57:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1425207.1649301; Fri, 18 Sep 2026 11:57:45 +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 1x7XDt-0002bV-8p; Fri, 18 Sep 2026 11:57:45 +0000
Received: by outflank-mailman (input) for mailman id 1425207;
 Fri, 18 Sep 2026 11:57:44 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0b4611c4500072c4@swg.vates.tech>)
 id 1x7XDs-0002bN-6J
 for win-pv-devel@lists.xenproject.org; Fri, 18 Sep 2026 11:57:44 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x7XDr-005TV4-IH
 for win-pv-devel@lists.xenproject.org; Fri, 18 Sep 2026 13:57:43 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0b4611c4500072c4@swg.vates.tech>)
 id 6aad2722-bab6-0a2a0a5309dd-0a2a4509b8e4-30
 for <win-pv-devel@lists.xenproject.org>; Fri, 18 Sep 2026 13:57:43 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0b4611c4500072c4@swg.vates.tech>)
 id 6aad2737-be1a-0a2a45090019-b9ff1c2285c5-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 18 Sep 2026 13:57:43 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0b4611c4500072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Fri, 18 Sep 2026 11:57:38 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 86B5281CC2;
 Fri, 18 Sep 2026 13:57:37 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=2GrpTyzpCtz2VIqq3TcgdRANJVcPDOSsRbHm09Ppc0g=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=CQSkGBNq1u4iIb4dtnYTu4dKYb/HSZmkfBcNO+oCXn02AN9esWvWWAVm5seOAQGR9BKbRkwkz
 H7aBroZ+4r0/MWoP2SDAmn7zj6t4sLviy7DhS7hfcG03vrdXGC2BaMbtMXyxBugTAth6k2XePVR
 ZANQH3c41fsgB+lATrPRe50PFs1zOZi0KQuxunqe8ditYRKEN1TdkLEId85Tmf12coTxG3wiwf5
 a+HQS+hIelAAkw3NkTJycndB6R8QzAaFUdsokEd1yOKEu8XkRlsoafEL6A8XuKU6U1/USW3SHWo
 PKUvF04c+QpjueGSVnXcu8OS76oksab2ez+OeJ2LgJOw==
X-Zone-Loop: 1474f9a62f181e1cbad887493cf451343038b21f2197
x-campaign-type: default
x-transaction-id: 5c896e4d-b7f4-416d-90aa-df78a01f7cda
x-swg-uid: 01-57544a0b-aa2d-46e9-9dd0-45570d9fac24
X-Mailer: Sweego
Message-ID:
 <1789732658.8631fc262581453bbf619ec5b2062170.1a0b4611c4500072c4@vates.tech>
x-swg-bid: 1789732658.8631fc262581453bbf619ec5b2062170.1a0b4611c4500072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 18 Sep 2026 13:57:37 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 0/2] xennet: improve RX NBL batching and fix TX doorbell
 coalescing
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154131.2040-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154131.2040-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.24f.77db816b00526fea.1a0b46119c8.8a9d8edbdc86e1d8=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789732657609
X-purgate-ID: tlsNG-bad1c0/1789732663-BE0C5034-835CBE1D/0/0
X-purgate-type: clean
X-purgate-size: 2655

---=Part.24f.77db816b00526fea.1a0b46119c8.8a9d8edbdc86e1d8=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:43, david ambu wrote:
> This series addresses two independent throughput issues in xennet=2E
>=20
> Patch 1 =E2=80=94 NBL batching on the receive path:
>=20
>    The receive path previously called NdisMIndicateReceiveNetBufferLists
>    once per NBL (batch size of 1), causing excessive NDIS stack overhead
>    on high-throughput workloads=2E This patch raises NblBatchMax to 32
>    (configurable up to 64), groups consecutive NBLs with the same
>    EtherType into a single indicate call with
>    NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE, and fixes __ReceiverPushPackets
>    to move KeMemoryBarrier before the Returned/Indicated reads and retur=
n
>    early when the queue is empty=2E
>=20
> Patch 2 =E2=80=94 TX doorbell coalescing across NBL boundaries:
>=20
>    __TransmitterSendNetBufferList computed the More flag as
>    (NET_BUFFER_NEXT_NB(NetBuffer) !=3D NULL), which evaluates to FALSE f=
or
>    the last NB of every NBL even when the outer loop still has additiona=
l
>    NBLs to submit=2E This caused a premature doorbell ring between
>    back-to-back NBLs=2E Fixed by passing MoreNbls from the outer loop=2E
>=20
>    Note: a companion fix in xenvif is also required =E2=80=94
>    TransmitterQueuePacket unconditionally reset More =3D FALSE for
>    non-RSS traffic, overriding the value passed in from xennet=2E
>=20
> Performance (iperf2, 60 s, 3 runs, Windows PV guest):
>=20
>    Single-stream TCP:  4,606 -> 6,056 Mbps  (+31=2E5%)
>    8-stream TCP:      14,663 -> 18,679 Mbps  (+27=2E4%)
>    8-stream UDP:       1,117 ->  1,230 Mbps  (+10=2E1%)
>    Single-stream UDP:    327 ->    329 Mbps  (no change, expected)

Thanks for the patches, they look very promising=2E We'll need to do some=
=20
research on our end to validate the findings=2E

>=20
> david ambu (2):
>    xennet: improve NBL batching receive path
>    xennet: fix TX doorbell coalescing =E2=80=94 More flag dropped at NBL
>      boundaries
>=20
>   src/xennet=2Einf           |   6 +++
>   src/xennet/adapter=2Ec     |  13 +++++
>   src/xennet/adapter=2Eh     |   8 +++
>   src/xennet/receiver=2Ec    | 108 +++++++++++++++++++++++++++++--------=
--
>   src/xennet/transmitter=2Ec |   9 ++--
>   5 files changed, 114 insertions(+), 30 deletions(-)
>=20



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.24f.77db816b00526fea.1a0b46119c8.8a9d8edbdc86e1d8=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 21 13:07:24 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Sep 2026 13:07:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1427474.1650180 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8djw-0007M1-2J; Mon, 21 Sep 2026 13:07:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1427474.1650180; Mon, 21 Sep 2026 13:07:24 +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 1x8djv-0007Lt-Vw; Mon, 21 Sep 2026 13:07:23 +0000
Received: by outflank-mailman (input) for mailman id 1427474;
 Mon, 21 Sep 2026 13:07:23 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c413f16d00072c4@swg.vates.tech>)
 id 1x8djv-0007Le-9t
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 13:07:23 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8dju-001GpB-N7
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 15:07:22 +0200
Received: from [10.42.69.2] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c413f16d00072c4@swg.vates.tech>)
 id 6ab12bf5-e002-0a2a0a5209dd-0a2a4502a6c0-32
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:07:22 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c413f16d00072c4@swg.vates.tech>)
 id 6ab12c07-6ca4-0a2a45020019-b9ff1c22a1ef-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:07:19 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0c413f16d00072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 21 Sep 2026 13:07:16 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id B9600823B7;
 Mon, 21 Sep 2026 15:07:15 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=Fjv/guu8K5m7zifK8Hw7H4oFQnu2tLK8EFMh7HTj0e4=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=I2toCEVWFn/55C7uCEOgO2g1L/S28CDgpcCl3tNu7iWs5HcwsTnk1NCIIWhxumA6y/gQHVx2g
 iT1spVR+vAD9Tsi67OkeP44asQO7WiFHZAww1y9pYNKlw3haVOuhP2eErQQcsOFgEO+7gU06K/K
 yK7PuBc9gQTe9RjZx8HVuuekfkT3RKwiioiBxfWot2RafSN1RAXrMrEWppaqYiKDFIeEIHDPXP7
 dy/0H/Y6XF3zVHxwAB50tZh9gsveAdfaPMyDf7FD76yDhjEHLk4SbJ6Q/HJwS8qCFWYhrmQfo13
 il/cdpTnckJc2DGU+l4XLZXi/TwjZfPiMVh7GQn2uTWQ==
X-Zone-Loop: 90e331183545d479cd98e2798b1fb0205b2ec80c455a
x-campaign-type: default
x-transaction-id: cd1bb722-989a-4003-bd54-6e0728bac736
x-swg-uid: 01-659ef519-e50d-455d-a620-d9cc91906559
X-Mailer: Sweego
Message-ID:
 <1789996036.8631fc262581453bbf619ec5b2062170.1a0c413f16d00072c4@vates.tech>
x-swg-bid: 1789996036.8631fc262581453bbf619ec5b2062170.1a0c413f16d00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 21 Sep 2026 15:07:15 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 0/2] xennet: improve RX NBL batching and fix TX doorbell
 coalescing
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154131.2040-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154131.2040-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.2a8.6ef6b8dc6ec1d542.1a0c413eee5.af7b451bcfabfebe=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789996035816
X-purgate-ID: tlsNG-720697/1789996039-F20A82AC-35959BB2/0/0
X-purgate-type: clean
X-purgate-size: 3445

---=Part.2a8.6ef6b8dc6ec1d542.1a0c413eee5.af7b451bcfabfebe=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:43, david ambu wrote:
> This series addresses two independent throughput issues in xennet=2E
>=20
> Patch 1 =E2=80=94 NBL batching on the receive path:
>=20
>    The receive path previously called NdisMIndicateReceiveNetBufferLists
>    once per NBL (batch size of 1), causing excessive NDIS stack overhead
>    on high-throughput workloads=2E This patch raises NblBatchMax to 32
>    (configurable up to 64), groups consecutive NBLs with the same
>    EtherType into a single indicate call with
>    NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE, and fixes __ReceiverPushPackets
>    to move KeMemoryBarrier before the Returned/Indicated reads and retur=
n
>    early when the queue is empty=2E
>=20
> Patch 2 =E2=80=94 TX doorbell coalescing across NBL boundaries:
>=20
>    __TransmitterSendNetBufferList computed the More flag as
>    (NET_BUFFER_NEXT_NB(NetBuffer) !=3D NULL), which evaluates to FALSE f=
or
>    the last NB of every NBL even when the outer loop still has additiona=
l
>    NBLs to submit=2E This caused a premature doorbell ring between
>    back-to-back NBLs=2E Fixed by passing MoreNbls from the outer loop=2E
>=20
>    Note: a companion fix in xenvif is also required =E2=80=94
>    TransmitterQueuePacket unconditionally reset More =3D FALSE for
>    non-RSS traffic, overriding the value passed in from xennet=2E
>=20
> Performance (iperf2, 60 s, 3 runs, Windows PV guest):
>=20
>    Single-stream TCP:  4,606 -> 6,056 Mbps  (+31=2E5%)
>    8-stream TCP:      14,663 -> 18,679 Mbps  (+27=2E4%)
>    8-stream UDP:       1,117 ->  1,230 Mbps  (+10=2E1%)
>    Single-stream UDP:    327 ->    329 Mbps  (no change, expected)
>=20
> david ambu (2):
>    xennet: improve NBL batching receive path
>    xennet: fix TX doorbell coalescing =E2=80=94 More flag dropped at NBL
>      boundaries
>=20
>   src/xennet=2Einf           |   6 +++
>   src/xennet/adapter=2Ec     |  13 +++++
>   src/xennet/adapter=2Eh     |   8 +++
>   src/xennet/receiver=2Ec    | 108 +++++++++++++++++++++++++++++--------=
--
>   src/xennet/transmitter=2Ec |   9 ++--
>   5 files changed, 114 insertions(+), 30 deletions(-)
>=20

Hello,

I don't think this is the right method=2E

XenVif's TransmitterQueuePacket is eventually called by XenNet's=20
__TransmitterSendNetBufferList which is eventually called by=20
MiniportSendNetBufferLists=2E MiniportSendNetBufferLists states that=20
different NBLs can be split into multiple transmit queues if they belong=
=20
to different connections=2E

In this case, the More flag is needed to terminate each NBL because if=20
subsequent NBLs are not assigned to the same TX queue, you will not=20
drain the queue of the previous NBL=2E So you may end up with packets=20
stuck in the TX queue without being drained to the backend=2E

For the purpose of batching NBLs, XenNet will need to be aware of the=20
target queue of each NBL and group together NBLs destined for the same=20
queue=2E Then further optimizations can be done by letting XenVif accept=
=20
an entire chain of NBLs instead=2E


-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.2a8.6ef6b8dc6ec1d542.1a0c413eee5.af7b451bcfabfebe=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 21 13:08:48 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Sep 2026 13:08:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1427484.1650192 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8dlI-0008Av-Bx; Mon, 21 Sep 2026 13:08:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1427484.1650192; Mon, 21 Sep 2026 13:08:48 +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 1x8dlI-0008Ao-9T; Mon, 21 Sep 2026 13:08:48 +0000
Received: by outflank-mailman (input) for mailman id 1427484;
 Mon, 21 Sep 2026 13:08:47 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4153b3c00072c4@swg.vates.tech>)
 id 1x8dlH-0008Ae-7k
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 13:08:47 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8dlG-00HExj-0V
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 15:08:46 +0200
Received: from [10.42.69.4] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4153b3c00072c4@swg.vates.tech>)
 id 6ab12c5c-2eae-0a2a0a5409dd-0a2a450482d8-6
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:08:45 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4153b3c00072c4@swg.vates.tech>)
 id 6ab12c5d-b57f-0a2a45040019-b9ff1c128bb3-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:08:45 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0c4153b3c00072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 21 Sep 2026 13:08:40 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 382F8823EC;
 Mon, 21 Sep 2026 15:08:40 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=rddLmBzXV7wqa/ri2wLRYMOERNtYRUWuNBXAfhP2kv4=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=eV2zDGXd59pY+DTaoZGBoAoXBlFI5C8WDyKlGaTtNUdS3TPohgBxAsAS3O252u/dlrKRvOGcp
 Y4qnE/GtJ6iXQufPpNvZ/9WW19WrEMn8NvWJNwg7gFrdzVOfnFfoDv7p5s1DfFoHC6fsknCDmwq
 /4o3hr4zmCzcKDKhzBrAl/exX6tHtdKxq0jYJ2uMfPhh1Is+kX6xtfpOCVQsraDgByQTN+Nf760
 bAc8QPusqsWQ2ofRiIKMtLTWTDC+2QopQdZgXqh6x8TpvZ+FFbyZqdMuTiaZfQLb4DAD2xCYNlx
 QjmFfh6G6/0Z0MGAFCEsbqrd5uP6+GPJWEjVQU42hE2A==
X-Zone-Loop: f8229f5e1e11d17814848a9f49fa9220a736917d1df0
x-campaign-type: default
x-transaction-id: 38f31322-30ea-4339-8b3a-e457cd36dc04
x-swg-uid: 01-8b83549e-122b-45fa-bfaa-a18fed08b01b
X-Mailer: Sweego
Message-ID:
 <1789996120.8631fc262581453bbf619ec5b2062170.1a0c4153b3c00072c4@vates.tech>
x-swg-bid: 1789996120.8631fc262581453bbf619ec5b2062170.1a0c4153b3c00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 21 Sep 2026 15:08:40 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] xenvif: fix TX doorbell coalescing - More overridden for
 non-RSS traffic
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154437.1794-1-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154437.1794-1-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.2a9.635e5d40deb1f5f3.1a0c41538d5.15679f583b560144=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789996120277
X-purgate-ID: tlsNG-ebf023/1789996125-C38C1B50-C36B6F30/0/0
X-purgate-type: clean
X-purgate-size: 1390

---=Part.2a9.635e5d40deb1f5f3.1a0c41538d5.15679f583b560144=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:45, david ambu wrote:
>    TransmitterQueuePacket unconditionally set More =3D FALSE in the
>    XENVIF_PACKET_HASH_ALGORITHM_NONE case, overriding the More value
>    passed in from xennet regardless of batch depth=2E

Could you unindent the commit message?

>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>

With that changed:

Reviewed-by: Tu Dinh <ngoc-tu=2Edinh@vates=2Etech>

> ---
>   src/xenvif/transmitter=2Ec | 1 -
>   1 file changed, 1 deletion(-)
>=20
> diff --git a/src/xenvif/transmitter=2Ec b/src/xenvif/transmitter=2Ec
> index 8c4ee41=2E=2Ead58336 100644
> --- a/src/xenvif/transmitter=2Ec
> +++ b/src/xenvif/transmitter=2Ec
> @@ -5245,7 +5245,6 @@ TransmitterQueuePacket(
>       switch (Algorithm) {
>       case XENVIF_PACKET_HASH_ALGORITHM_NONE:
>           Value =3D __TransmitterHashPacket(Transmitter, Packet);
> -        More =3D FALSE;
>           break;
>  =20
>       case XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED:



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.2a9.635e5d40deb1f5f3.1a0c41538d5.15679f583b560144=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 21 13:13:35 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Sep 2026 13:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1427497.1650206 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8dpv-0001S0-1d; Mon, 21 Sep 2026 13:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1427497.1650206; Mon, 21 Sep 2026 13:13:35 +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 1x8dpu-0001Rt-VD; Mon, 21 Sep 2026 13:13:34 +0000
Received: by outflank-mailman (input) for mailman id 1427497;
 Mon, 21 Sep 2026 13:13:33 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@swg.vates.tech>)
 id 1x8dpt-0001Rn-6o
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 13:13:33 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8dpr-002T1B-OA
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 15:13:31 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@swg.vates.tech>)
 id 6ab12d79-bab6-0a2a0a5309dd-0a2a450ad608-14
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:13:31 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@swg.vates.tech>)
 id 6ab12d7b-f2d2-0a2a450a0019-b9ff1c23895d-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:13:31 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0c4199fa300072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 21 Sep 2026 13:13:28 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 14712803E7;
 Mon, 21 Sep 2026 15:13:28 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=mNem9fiUVtsZNP2rOGJyclNXwjNFc4mcSnQMIzKt1so=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=L8wWJ1+ZvMXvBDqxqWcWe3hIvrO94+FO/M4M++KLo61DWuIK9sxVhtznSwdxfTKybR0KQ3j3Y
 StFAzHQ2Tqhpf4iI0DfbAkEOUTZhhfBIJgrFHCu2AQQWciZ0Nf5rf1on4oR1vHicn+eMFUB4SdR
 ipnpzEHcKFJmHOhvTmVBbz8azpV9Mpbds/flmNl248w/IyrPvhAGmZFDAqMJNTn/KxAKVV3usEp
 m5qrXKaDto5XyBVNt5AX/NjML88oSGl8wuTO900kuhnehstmVG3U57RVYPYNzPLtqk7Facpnv1T
 4uE/miXKJMJIZF7+gws6qrsfnygc8NsxW4Fc/QM/UKoA==
X-Zone-Loop: 61ab078f687be995ab18b7532d74955e5a5ffdfaf523
x-campaign-type: default
x-transaction-id: 86e50732-ec79-42c2-8015-76d1f26e3251
x-swg-uid: 01-750e92ca-0f0c-4fb2-b33e-32a67dc63082
X-Mailer: Sweego
Message-ID:
 <1789996408.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@vates.tech>
x-swg-bid: 1789996408.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 21 Sep 2026 15:13:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/2] xennet: improve NBL batching receive path
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154131.2040-1-david.preetham@citrix.com>
 <20260917154131.2040-2-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154131.2040-2-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.2ab.56e8b55f4c8c28a1.1a0c4199d3f.a9497b7104507d75=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789996408128
X-purgate-ID: tlsNG-4011c0/1789996411-4BAD4CFC-2C76CA44/0/0
X-purgate-type: clean
X-purgate-size: 3845

---=Part.2ab.56e8b55f4c8c28a1.1a0c4199d3f.a9497b7104507d75=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:43, david ambu wrote:
>    Raise NblBatchMax default to 32 (max 64)=2E Split batches at
>    EtherType boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per
>    batch=2E Fix __ReceiverPushPackets: move KeMemoryBarrier before Retur=
ned/
>    Indicated reads, and return early when queue is empty=2E
>=20
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> ---
>   src/xennet=2Einf        |   6 +++
>   src/xennet/adapter=2Ec  |  13 +++++
>   src/xennet/adapter=2Eh  |   8 ++++
>   src/xennet/receiver=2Ec | 108 +++++++++++++++++++++++++++++++---------=
--
>   4 files changed, 108 insertions(+), 27 deletions(-)
>=20
> diff --git a/src/xennet=2Einf b/src/xennet=2Einf
> index 55e11a2=2E=2E79730e8 100644
> --- a/src/xennet=2Einf
> +++ b/src/xennet=2Einf
> @@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    D=
efault,    0, "8"
>   HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
>   HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
>  =20
> +HKR, Ndi\Params\NblBatchMax, 			  		  ParamDesc,  0, %NblBatchMax%
> +HKR, Ndi\Params\NblBatchMax, 			  		  Type,       0, "int"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Default,    0, "32"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Min, 	      0, "1"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Max, 	      0, "64"
>   [XenNet_Inst=2EServices]
>   AddService=3Dxennet,0x02,XenNet_Service,XenNet_EventLog
>  =20
> @@ -248,6 +253,7 @@ Enabled=3D"Enabled"
>   Enabled-Rx=3D"Rx Enabled"
>   Enabled-Tx=3D"Tx Enabled"
>   Enabled-TxRx=3D"Rx & Tx Enabled"
> +NblBatchMax=3D"Max Receive Indicate NBLS"
>  =20
>   SERVICE_BOOT_START=3D0x0
>   SERVICE_SYSTEM_START=3D0x1
> diff --git a/src/xennet/adapter=2Ec b/src/xennet/adapter=2Ec
> index f79c0c8=2E=2E6e5a95a 100644
> --- a/src/xennet/adapter=2Ec
> +++ b/src/xennet/adapter=2Ec
> @@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
>       int lrov6;
>       int rss;
>       int numrssqueues;
> +    int nblbatchmax;
>   } PROPERTIES, *PPROPERTIES;
>  =20
>   typedef struct _XENNET_RSS {
> @@ -1480,6 +1481,17 @@ AdapterGetHandle(
>       return Adapter->NdisAdapterHandle;
>   }
>  =20
> +ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    )
> +{
> +    ULONG val =3D (ULONG)Adapter->Properties=2Enblbatchmax;
> +    if (val =3D=3D 0 || val > NBL_BATCH_SIZE_MAX)
> +        return NBL_BATCH_SIZE_DEFAULT;
> +    return val;
> +}
> +
>   PXENVIF_VIF_INTERFACE
>   AdapterGetVifInterface(
>       IN  PXENNET_ADAPTER     Adapter
> @@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
>       READ_PROPERTY(Adapter->Properties=2Eneed_csum_value, L"NeedChecksu=
mValue", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Erss, L"*RSS", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Enumrssqueues, L"*NumRSSQueues"=
, 8, Handle);
> +    READ_PROPERTY(Adapter->Properties=2Enblbatchmax, L"NblBatchMax", NB=
L_BATCH_SIZE_DEFAULT, Handle);
>  =20
>       NdisCloseConfiguration(Handle);
>  =20
> diff --git a/src/xennet/adapter=2Eh b/src/xennet/adapter=2Eh
> index 2ea0345=2E=2Ea54cb4d 100644
> --- a/src/xennet/adapter=2Eh
> +++ b/src/xennet/adapter=2Eh
> @@ -121,4 +121,12 @@ AdapterQueryInformation(
>       IN  PNDIS_OID_REQUEST   Request
>       );
>  =20
> +#define NBL_BATCH_SIZE_DEFAULT  32
> +#define NBL_BATCH_SIZE_MAX      64

Is there a method to know what's the ideal NBL batching size?



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.2ab.56e8b55f4c8c28a1.1a0c4199d3f.a9497b7104507d75=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 21 13:17:57 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Sep 2026 13:17:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1427499.1650210 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8du9-0001ef-CB; Mon, 21 Sep 2026 13:17:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1427499.1650210; Mon, 21 Sep 2026 13:17:57 +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 1x8du9-0001eX-9G; Mon, 21 Sep 2026 13:17:57 +0000
Received: by outflank-mailman (input) for mailman id 1427499;
 Mon, 21 Sep 2026 13:17:56 +0000
Received: from mx.expurgate.net ([194.145.224.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c41d9fbd00072c4@swg.vates.tech>)
 id 1x8du8-0001eR-3C
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 13:17:56 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8du7-006iAw-3I
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 15:17:55 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c41d9fbd00072c4@swg.vates.tech>)
 id 6ab12e7c-bab6-0a2a0a5309dd-0a2a4501bf66-20
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:17:55 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c41d9fbd00072c4@swg.vates.tech>)
 id 6ab12e82-5984-0a2a45010019-b9ff1c23b331-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 15:17:54 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0c41d9fbd00072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 21 Sep 2026 13:17:50 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 5106280B5E;
 Mon, 21 Sep 2026 15:17:50 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=imUgOuUjLm4JhJ5NdWusqi5KNeSq++2mOVhvZELC4Bs=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=inDdLICAFCjW/rJSylWhPC8njlA3GSemIZXhTMUhKfKaYCTSOoNpgHOKomQo91IjBUkDPEy8y
 x5W4DZY2MRwqJ04LO5JDsp1dPXPVxzLwFBcIyhPcltFSP4x2SuhpsqS/2uFYGsETGK9J4Kd4UhY
 6dZTIa5IZ1jGjXktUXqrEHAoRfCdhz1cQYD5o8mvFVOyueCYnjksR/fp5I9hqoQobqtNsVkbVLz
 h5vkwz+PlVgaW9RIJ4RWvVkebNU2pFk5V8doIfwvkpp7pCGWS62jLf8nabLSXHdXJYLYtQu8Wly
 3JCIuR08eI63hwc1Yu6tjP5H3aoUmkNMayb1XkkoI1QA==
X-Zone-Loop: bc78b7d746d51cb960fb4129995c85d3da749b6ecbd2
x-campaign-type: default
x-transaction-id: b0d6d284-ef4c-4217-bf26-b8f430db2176
x-swg-uid: 01-99239730-8335-4b69-bff4-cb5afc34365d
X-Mailer: Sweego
Message-ID:
 <1789996670.8631fc262581453bbf619ec5b2062170.1a0c41d9fbd00072c4@vates.tech>
x-swg-bid: 1789996670.8631fc262581453bbf619ec5b2062170.1a0c41d9fbd00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 21 Sep 2026 15:17:50 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: =?UTF-8?Q?Re=3A_=5BPATCH_2/2=5D_xennet=3A_fix_TX_doorbell_coalescin?=
 =?UTF-8?Q?g_=E2=80=94_More_flag_dropped_at_NBL_boundaries?=
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154131.2040-1-david.preetham@citrix.com>
 <20260917154131.2040-3-david.preetham@citrix.com>
Content-Language: en-US
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154131.2040-3-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.2ad.f10af502b5018caa.1a0c41d9db3.28a7696112f92316=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1789996670387
X-purgate-ID: tlsNG-d62444/1789996675-1DA7E757-BCFE66EA/0/0
X-purgate-type: clean
X-purgate-size: 2592

---=Part.2ad.f10af502b5018caa.1a0c41d9db3.28a7696112f92316=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:43, david ambu wrote:
>    __TransmitterSendNetBufferList computed the More flag as
>    (NET_BUFFER_NEXT_NB(NetBuffer) !=3D NULL), which only looks at remain=
ing
>    NET_BUFFERs within the current NBL=2E This evaluates to FALSE for the=
 last
>    NB of every NBL, even when the outer loop in TransmitterSendNetBuffer=
Lists
>    still has additional NBLs to submit in the same batch=2E
>=20
> Assisted-by: ClaudeCode:claude-opus-4=2E8
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>

Please don't use the Unicode '=E2=80=94' in the commit message=2E

> ---
>   src/xennet/transmitter=2Ec | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>=20
> diff --git a/src/xennet/transmitter=2Ec b/src/xennet/transmitter=2Ec
> index 4bb82bc=2E=2Ee17d89f 100644
> --- a/src/xennet/transmitter=2Ec
> +++ b/src/xennet/transmitter=2Ec
> @@ -288,7 +288,8 @@ __TransmitterHash(
>   static VOID
>   __TransmitterSendNetBufferList(
>       IN  PXENNET_TRANSMITTER     Transmitter,
> -    IN  PNET_BUFFER_LIST        NetBufferList
> +    IN  PNET_BUFFER_LIST        NetBufferList,
> +    IN  BOOLEAN                 MoreNbls
>       )
>   {
>       PNET_BUFFER_LIST_RESERVED   ListReserved;
> @@ -338,7 +339,7 @@ __TransmitterSendNetBufferList(
>                                   MaximumSegmentSize,
>                                   TagControlInformation,
>                                   &Hash,
> -                                (NetBufferListNext !=3D NULL) ? TRUE : =
FALSE,
> +                                (NetBufferListNext !=3D NULL || MoreNbl=
s) ? TRUE : FALSE,
>                                   Cookie);
>           }
>           else
> @@ -384,7 +385,9 @@ TransmitterSendNetBufferLists(
>           ListNext =3D NET_BUFFER_LIST_NEXT_NBL(NetBufferList);
>           NET_BUFFER_LIST_NEXT_NBL(NetBufferList) =3D NULL;
>  =20
> -        __TransmitterSendNetBufferList(Transmitter, NetBufferList);
> +        __TransmitterSendNetBufferList(Transmitter,
> +                                       NetBufferList,
> +                                       (ListNext !=3D NULL) ? TRUE : FA=
LSE);
>  =20
>           NetBufferList =3D ListNext;
>       }



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.2ad.f10af502b5018caa.1a0c41d9db3.28a7696112f92316=---


From win-pv-devel-bounces@lists.xenproject.org Mon Sep 21 16:03:16 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Sep 2026 16:03:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1427739.1650533 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8gU7-0002nr-Tu; Mon, 21 Sep 2026 16:03:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1427739.1650533; Mon, 21 Sep 2026 16:03:15 +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 1x8gU7-0002nk-RF; Mon, 21 Sep 2026 16:03:15 +0000
Received: by outflank-mailman (input) for mailman id 1427739;
 Mon, 21 Sep 2026 16:03:14 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4b4f79200072c4@swg.vates.tech>)
 id 1x8gU6-0002nW-MB
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 16:03:14 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8gU6-0055bQ-39
 for win-pv-devel@lists.xenproject.org; Mon, 21 Sep 2026 18:03:14 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4b4f79200072c4@swg.vates.tech>)
 id 6ab15537-8faa-0a2a0a5109dd-0a2a4501d398-38
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 18:03:14 +0200
Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0c4b4f79200072c4@swg.vates.tech>)
 id 6ab15541-5984-0a2a45010019-b9ff1c12a4e1-3
 for <win-pv-devel@lists.xenproject.org>; Mon, 21 Sep 2026 18:03:13 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0c4b4f79200072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 21 Sep 2026 16:03:09 +0000
Received: from [192.168.1.121] (88-185-151-209.subs.proxad.net
 [88.185.151.209]) (Authenticated sender: cesaire.mounah@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 8429B81038;
 Mon, 21 Sep 2026 18:03:08 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=UUxqvohtiepXZQ31opM0UYTyOa3Xa2btZIObaZnCaos=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=B7apOvdWginX0Q3hN0uDK22RqOznsYc4PCVgUlRyP9CRU2qJWqPvmeFgJWpHgb4o/wfblTM5M
 IGFvw2KdHYSa+n/+TMGRh3v5cFfLqTpZmDPHRrWA4Ka3sy4gwUFUk/pqiuc6huhruBGvId0Rzu3
 q5U4kvJbJ7ulVJ4qXJc0PBLo17rZupmnb72ns8oL+GOHKTRzaPmPEzr94uFBaA0ZR7BUdAnmBMk
 U5QBDMO/DRApzNQt6pICXYN9mWjt0VUfbCNQhPNKX/Hn16ymr4zoKAf7y/ow0FfZjFgtB//VEOp
 db72JgsHnXzeBPJPHyi11B20nIm/XTbqGfJF1DTAxnpQ==
X-Zone-Loop: 693b1b5bbd5d1b3d33e78b309e2bde5d28507fa4466e
x-campaign-type: default
x-transaction-id: 7da72794-bc0f-4737-a9f0-1984e2979d9d
x-swg-uid: 01-c52a2cf6-c231-4054-a920-ea4adea7cd7e
X-Mailer: Sweego
Message-ID:
 <1790006589.8631fc262581453bbf619ec5b2062170.1a0c4b4f79200072c4@vates.tech>
x-swg-bid: 1790006589.8631fc262581453bbf619ec5b2062170.1a0c4b4f79200072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Mon, 21 Sep 2026 18:03:08 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: Mounah Honore Cesaire <cesaire.mounah@vates.tech>
Subject: Re: win-pv-devel Digest, Vol 140, Issue 14
To: win-pv-devel@lists.xenproject.org,
 win-pv-devel-request@lists.xenproject.org
References: <mailman.12269.1789659907.884.win-pv-devel@lists.xenproject.org>
Content-Language: en-US
In-Reply-To: <mailman.12269.1789659907.884.win-pv-devel@lists.xenproject.org>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.2bd.adf616db0779615c.1a0c4b4f4ca.d11db32f9771e957=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1790006588622
X-purgate-ID: tlsNG-d62444/1790006593-BE867757-6BE7C190/0/0
X-purgate-type: clean
X-purgate-size: 4603

---=Part.2bd.adf616db0779615c.1a0c4b4f4ca.d11db32f9771e957=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


On 9/17/26 5:45 PM, win-pv-devel-request@lists=2Exenproject=2Eorg wrote:
> Send win-pv-devel mailing list submissions to
> 	win-pv-devel@lists=2Exenproject=2Eorg
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists=2Exenproject=2Eorg/mailman/listinfo/win-pv-devel
> or, via email, send a message with subject or body 'help' to
> 	win-pv-devel-request@lists=2Exenproject=2Eorg
>
> You can reach the person managing the list at
> 	win-pv-devel-owner@lists=2Exenproject=2Eorg
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of win-pv-devel digest=2E=2E=2E"
>
>
> Today's Topics:
>
>     1=2E [PATCH 0/2] xennet: improve RX NBL batching and fix TX
>        doorbell coalescing (david ambu)
>     2=2E [PATCH 1/2] xennet: improve NBL batching receive path (david am=
bu)
>     3=2E [PATCH 2/2] xennet: fix TX doorbell coalescing ? More flag
>        dropped at NBL boundaries (david ambu)
>     4=2E [PATCH] xenvif: fix TX doorbell coalescing - More overridden
>        for non-RSS traffic (david ambu)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 17 Sep 2026 16:41:28 +0100
> From: david ambu<david=2Epreetham@citrix=2Ecom>
> To:win-pv-devel@lists=2Exenproject=2Eorg
> Cc: david ambu<david=2Epreetham@citrix=2Ecom>
> Subject: [PATCH 0/2] xennet: improve RX NBL batching and fix TX
> 	doorbell coalescing
> Message-ID:<20260917154131=2E2040-1-david=2Epreetham@citrix=2Ecom>
> Content-Type: text/plain; charset=3DUTF-8
>
> This series addresses two independent throughput issues in xennet=2E
>
> Patch 1 ? NBL batching on the receive path:
>
>    The receive path previously called NdisMIndicateReceiveNetBufferLists
>    once per NBL (batch size of 1), causing excessive NDIS stack overhead
>    on high-throughput workloads=2E This patch raises NblBatchMax to 32
>    (configurable up to 64), groups consecutive NBLs with the same
>    EtherType into a single indicate call with
>    NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE, and fixes __ReceiverPushPackets
>    to move KeMemoryBarrier before the Returned/Indicated reads and retur=
n
>    early when the queue is empty=2E

Hello,

Patch 1 looks fine for me=2E
Just a remark: moving KeMemoryBarrier before Returned read seems to=20
break the ordering as Returned needs to be read before Indicated=2E Or=20
maybe there is no need for an ordering here?

> Patch 2 ? TX doorbell coalescing across NBL boundaries:
>
>    __TransmitterSendNetBufferList computed the More flag as
>    (NET_BUFFER_NEXT_NB(NetBuffer) !=3D NULL), which evaluates to FALSE f=
or
>    the last NB of every NBL even when the outer loop still has additiona=
l
>    NBLs to submit=2E This caused a premature doorbell ring between
>    back-to-back NBLs=2E Fixed by passing MoreNbls from the outer loop=2E
>
>    Note: a companion fix in xenvif is also required ?
>    TransmitterQueuePacket unconditionally reset More =3D FALSE for
>    non-RSS traffic, overriding the value passed in from xennet=2E
>
> Performance (iperf2, 60 s, 3 runs, Windows PV guest):
>
>    Single-stream TCP:  4,606 -> 6,056 Mbps  (+31=2E5%)
>    8-stream TCP:      14,663 -> 18,679 Mbps  (+27=2E4%)
>    8-stream UDP:       1,117 ->  1,230 Mbps  (+10=2E1%)
>    Single-stream UDP:    327 ->    329 Mbps  (no change, expected)
Batching packets can also potentially add latency costs=2E A latency=20
benchmark should also be done=2E
> david ambu (2):
>    xennet: improve NBL batching receive path
>    xennet: fix TX doorbell coalescing ? More flag dropped at NBL
>      boundaries
>
>   src/xennet=2Einf           |   6 +++
>   src/xennet/adapter=2Ec     |  13 +++++
>   src/xennet/adapter=2Eh     |   8 +++
>   src/xennet/receiver=2Ec    | 108 +++++++++++++++++++++++++++++--------=
--
>   src/xennet/transmitter=2Ec |   9 ++--
>   5 files changed, 114 insertions(+), 30 deletions(-)
PS: For now I can only respond to the digest, sorry=2E This should be=20
fixed in future mails=2E

--=20

C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates=2Etech



-- 
C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen=
 Orchestra - Vates solutions

web: https://vates=2Etech
---=Part.2bd.adf616db0779615c.1a0c4b4f4ca.d11db32f9771e957=---


From win-pv-devel-bounces@lists.xenproject.org Tue Sep 22 09:43:03 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Sep 2026 09:43:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1428423.1651184 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x8x1i-0000mS-8E; Tue, 22 Sep 2026 09:43:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1428423.1651184; Tue, 22 Sep 2026 09:43:02 +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 1x8x1i-0000mK-4v; Tue, 22 Sep 2026 09:43:02 +0000
Received: by outflank-mailman (input) for mailman id 1428423;
 Tue, 22 Sep 2026 09:43:01 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1x8x1h-0000mB-Cb
 for win-pv-devel@lists.xenproject.org; Tue, 22 Sep 2026 09:43:01 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x8x1g-005CFS-EH
 for win-pv-devel@lists.xenproject.org; Tue, 22 Sep 2026 11:43:00 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab24d90-bab6-0a2a0a5309dd-0a2a450ac31e-38
 for <win-pv-devel@lists.xenproject.org>; Tue, 22 Sep 2026 11:43:00 +0200
Received: from [40.93.196.1]
 (helo=SA9PR02CU001.outbound.protection.outlook.com)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab24da2-f2d2-0a2a450a0019-285dc4012ff2-3
 for <win-pv-devel@lists.xenproject.org>; Tue, 22 Sep 2026 11:42:59 +0200
Received: from IA3PR03MB7740.namprd03.prod.outlook.com (2603:10b6:208:512::11)
 by DM4PR03MB6125.namprd03.prod.outlook.com (2603:10b6:5:394::14) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.14; Tue, 22 Sep
 2026 09:42:57 +0000
Received: from IA3PR03MB7740.namprd03.prod.outlook.com
 ([fe80::c380:74fc:823a:8213]) by IA3PR03MB7740.namprd03.prod.outlook.com
 ([fe80::c380:74fc:823a:8213%6]) with mapi id 15.21.0451.014; Tue, 22 Sep 2026
 09:42:57 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=iNkaDYkewJUYWoXBl/nTf93+CmbgDmGracL6VTPGl2OsEQXg81MvokYIHGUBLJi6pdlq+3G6qRiEl11EYictq8xqOl98M8ZQWnQZW3bsc6nOo6ipSHL1HWsuV1W7aJsRio2Q/8AT9RZFwY9tNfJwxiBi/zWs7+wtBNDWvcVIUZiG+0W4H19cIofPby7Iv6newxPeH0TU1SZvta7RmT3ikYzD5bgcxPP3+bK6rJ0MXyeRNoOdL/Ym/tE3yJ8YUBdNunCl87TZ98Bv+JxjpisV0Hik7tRRnkmPZyb7EUn/RuFdVAom1jim/mbGyN+c7nnvlQSQk9Otw+dP5pBUj/BKQg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=lBdHHrZnpAagsNtAfec6L4G7ZRS1+mW44Ni8r3CdZPo=;
 b=ivaP3gORTSpkfAVgJE4KRjVrfbNNb0b2iihnVBqbgHNIfk5G14pZKYtV9Z8NTeqUcWSdgIQxpRBLMgcKMLKZrc2xPmtLx2vVEam+ZF7odqbsvdmRS9EIZEqSDIj0HjLj1o9GEzDNCNXvqktejLcXQv8dYgzX+50auDyQ28yWLNDJNm6TD+jmT4BcVA0fsG2GZamBbuAt/VYHXhgJESHJtpc00m232kZurcoRfrxG5p86umgYrvX8SMyq8xtZ7gI0OlaWcp0sTuy+YEvDeYNUQOReKUPwSnXHwuxXFMRPiRg0ZWxivfd1FW53aNn9lhOEvvNBntaM/4WliFbgm5IhAA==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=lBdHHrZnpAagsNtAfec6L4G7ZRS1+mW44Ni8r3CdZPo=;
 b=q6GwDOa2U6TuOaxqZ4gB/8Qo5nykfkuxc8yA8aacsnKFl2hP0/6CbGr3Nokut5A1bX6FIIdY2UMvI2WOxNSCGx5X80beDzMbbReLoDtN6fXBaWqHmwIXLVuCMmMcbGgCudMUkCnzryRjPHWX8L2GCeBPrCCEqT+UXWVMzIDY5XE=
From: David ambu <david.preetham@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, "win-pv-devel@lists.xenproject.org"
	<win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] xennet: improve NBL batching receive path
Thread-Topic: [PATCH 1/2] xennet: improve NBL batching receive path
Thread-Index: AQHdRrtbOC5MOKioGkW3NxBw8Vd7xLbZCIOAgAFUbgQ=
Date: Tue, 22 Sep 2026 09:42:56 +0000
Message-ID:
 <IA3PR03MB7740E0069E1B2C9ADB2E3CE5EA832@IA3PR03MB7740.namprd03.prod.outlook.com>
References: <20260917154131.2040-1-david.preetham@citrix.com>
 <20260917154131.2040-2-david.preetham@citrix.com>
 <1789996408.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@vates.tech>
In-Reply-To:
 <1789996408.8631fc262581453bbf619ec5b2062170.1a0c4199fa300072c4@vates.tech>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: IA3PR03MB7740:EE_|DM4PR03MB6125:EE_
x-ms-office365-filtering-correlation-id: c9fa4828-ff80-4b79-b38a-08df188de1ec
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|1800799024|366016|376014|23010399003|6133799003|22082099003|18002099003|13003099007|8096899003|11063799006|5023799004|10067099003|38070700021|4143699003|56012099006;
x-microsoft-antispam-message-info:
 Az+OW53CMLxe9oOVZ3/fQXuHmAKWzJ0zwfH2XYOzxXao88RbBbm2DrqyDzht1yl/IPVv/JzQBz8kjewM1bWvcEghrqbaR8f8c9RV76B/vueuDdffnwjEXscd6rsbLCe9w47CH6h5pd8ioUzauNc/wpXNj7bJqYcFCzGAVN/EtnIH7D3dKekHz/BdNlE8ClVQXJcIzTIsSZ1vAr0KvcWd/vBsD0KpNyC/2HhboxVaCpROwCMRE3EhO1orhog1I8R56gBRiqdBsw3tOukryoSg3hqxiRGdX7L52ayKtOdTAExCtioM+/iPrHcYV04SgebAI+ZEIjmZM9TRx/YWX3vgz3ZKfa0ZgAtlqNNSusWyr5ovUZZt0hoFscOI9ZZ/qObnPu0UyeWBwxHe67je1TfxAY1zpsGdrqnL/TAB5BWhcxJFnLw/DD7hrmXbzZZKtgIUexH88E9VEXmPLlw5OvIhVRfFJa6X4FQ+785jWHDQM/dFgFx0sv2fm8XImPFHi7aiQ3hqVc/FAlKcAO3zUm2ISHFaF1iqN4MA6cmho8JwaKbWldypYysj0UuGqhLYwlV2R+uvvy9yUgqLb+4sw1wBJrFV4YiMbp3Nhx4etHUJPK/PWqLUNXQBdujduMRwDU15rKcF1s+Kx9If4mi7BFs3gBbdEolOGxjJgM2yt8HICIs=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA3PR03MB7740.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(23010399003)(6133799003)(22082099003)(18002099003)(13003099007)(8096899003)(11063799006)(5023799004)(10067099003)(38070700021)(4143699003)(56012099006);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?iso-8859-1?Q?kx4iEne93lAedcaLO1FT1Kqy/elHWAfjTfeL5M3x03a7aMy43TRa3oM/9e?=
 =?iso-8859-1?Q?JE3EE+bmpPczqclv0XOg6WPkJTMu2nXCDbH4OYZy/BQuVY9V/s1yFW+6Cd?=
 =?iso-8859-1?Q?mJMOS4WCoYAHbJF/+0U0oo6B12GUQIwDORiBQITJf7PF06oDuZFvsvLLdl?=
 =?iso-8859-1?Q?ShpopzyN/ySH3gJxxgiFa9frlM/QBTmcJYWD4v5wvgwqmsS8Zs5nNdh+8/?=
 =?iso-8859-1?Q?WY/2d/3mzJnlwzqANjxStqy3bjqNtUXPperqKhH/0xO1skARfAX9NjL5Gw?=
 =?iso-8859-1?Q?bgq4euA9ASD/hytvVYpOrYTptPqSX5CW9gpJ+Z/iqhDbP3a/ywIBf+cy3+?=
 =?iso-8859-1?Q?L22GX480YyuC2YYkYku8bwixz82dZDhKT+aZVY6uE7imEmUNHH7u0vBmf4?=
 =?iso-8859-1?Q?/rhz4h/VcWkO1GVJhqbIN0H1VMf4HzU0whtvof8FnzHJWczqlyKPEwhtEf?=
 =?iso-8859-1?Q?buoV+y5LduceSgUpH4YoY5TCWou1/2+lViU5t/afT3VmD+TPw6J2DO3+/r?=
 =?iso-8859-1?Q?b7R4CkvyA+ki1cU8EHCPncbLBYZ9zImJZAlrF7yfU/3gsqMo4raWIYKeZ/?=
 =?iso-8859-1?Q?G81pDN7RN2A5KI6fFa6SkwI8LfnrZ7pe8bXB2pZDEhRjoT181bpNaouJHu?=
 =?iso-8859-1?Q?c+l2SQCmtTYT/+rV+e+BSZrb7W1EA3vd2hT1+60NxN+7B8uvg7IsrqE+WQ?=
 =?iso-8859-1?Q?o3WSS8gBnOBgQNO6o3NOhZzfXUhEAwwN8YeyvsiW2Qa0G0rm1bmAjSwRRz?=
 =?iso-8859-1?Q?TyO9jMbitfJ+AAx9D1wM8R9aBL6ox4VxjlT45eX1rq0MVYCK1ILyQKRIV0?=
 =?iso-8859-1?Q?DVRT9HO/54YBQ/z+ZtMSKeMqk7rmH9dd7ecBIjoexOs546++Z7DTrA8bKk?=
 =?iso-8859-1?Q?Jur/WR/4hrYuW5Be/pB5JGPHBftIP6jY5gqQTue+pmTABFw/ddhdxouuFK?=
 =?iso-8859-1?Q?HGoD05/cn8bNxOklk7rqHfPv7bKUOzocXcV+V5NF9zVB1FkCqS6Qn75gg0?=
 =?iso-8859-1?Q?xn0KzCzj7gnlx2qn3DWi2Neu+SjqBN0IFyi1kA5l8kGQBi9mLl9+n9ocy0?=
 =?iso-8859-1?Q?/Aan2q5/cJ6gpiGrhnDiTkggXnCw6v4tc5PGQnAAVUiqVnz0wecUTLpQcK?=
 =?iso-8859-1?Q?VcISyJP3VNDtBrxJ2BS3OY9tjJCkwoVPrEU6JT36fhqpHrqDLZ8snUXiK2?=
 =?iso-8859-1?Q?EtBRf9jOt7iW4joV0e8Q31fWk7sMZZmUZU8uZ9QI8kwyyAIdur9fdeBsyH?=
 =?iso-8859-1?Q?L5HzSg82yr/+ayfV00arYiGHclIXOv2CX9UB86lNm7yfc3pq6rFwe6Chzl?=
 =?iso-8859-1?Q?3lGOWVuMStnFrgqeT+A+F7Q+rrT9xtkXR+2Sy/7FFqtzx5FAxTQ+t//1Ak?=
 =?iso-8859-1?Q?QXtIylr4Guf9fQUaSHHgvgnXYvWmvP2SAEhE9LmCXtIiqsJouTsRVgNLKf?=
 =?iso-8859-1?Q?ANM3mNI2IuzjbeXG1etGPMHeAjN1IevqMj4D085UyPN1SCzBUSrTbh7A9v?=
 =?iso-8859-1?Q?QSjd7zrMekMToNsxYMZPx/CyHSFczzfYBvf0fT9sybdQCfoWq3J2+3BHG7?=
 =?iso-8859-1?Q?0y62yP48DREctbDsNfvPFkxHxdzlVvmMmRp4tHkeRAU0btEoRX9f+7Eol0?=
 =?iso-8859-1?Q?LVVFwPS7blReaQSubuar6aQ2jmlaJ/pd2fYT3O3WOXginsJMC0oWa5MdYp?=
 =?iso-8859-1?Q?U8ef/PvZYeA+ykFTeXcWZEcsfUrno9cs2mScZRnzhJGRKWMoMS0r2k95Pe?=
 =?iso-8859-1?Q?1nYNUuW9u+rctWIXWTirGHgNWQK43UrqpcDbdXTOehvWBh+LmHMUMnW9IO?=
 =?iso-8859-1?Q?nsfDX/Csqg=3D=3D?=
Content-Type: multipart/alternative;
	boundary="_000_IA3PR03MB7740E0069E1B2C9ADB2E3CE5EA832IA3PR03MB7740namp_"
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: IA3PR03MB7740.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c9fa4828-ff80-4b79-b38a-08df188de1ec
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2026 09:42:56.9227
 (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: 706l9VfPOtXW8cgobR+MoCAY90M3vg6dQLzKyPXFwYB2NtZ5GVF4td4QBXlcOsajCiA1hCRpmeztD6PdgDeMbbKUQi/eTcI4zWgRKOywdfE=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR03MB6125
X-purgate-ID: tlsNG-4011c0/1790070180-5A9D9CFC-B798D390/0/0
X-purgate-type: clean
X-purgate-size: 14132

--_000_IA3PR03MB7740E0069E1B2C9ADB2E3CE5EA832IA3PR03MB7740namp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
Our performance testing shows that batch sizes of 8 or 16 introduce stabili=
ty fluctuations and higher CPU overhead, whereas a size of 32 delivers opti=
mal, stable throughput.

Per NDIS architectural guidelines and driver best practices, a range of 32 =
to 64 is considered the optimal sweet spot for balancing framework overhead=
 against system latency, making 32 our ideal baseline.

________________________________
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
Sent: Monday, September 21, 2026 2:13 PM
To: David ambu <david.preetham@citrix.com>; win-pv-devel@lists.xenproject.o=
rg <win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] xennet: improve NBL batching receive path

On 17/09/2026 17:43, david ambu wrote:
>    Raise NblBatchMax default to 32 (max 64). Split batches at
>    EtherType boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per
>    batch. Fix __ReceiverPushPackets: move KeMemoryBarrier before Returned=
/
>    Indicated reads, and return early when queue is empty.
>
> Signed-off-by: david ambu <david.preetham@citrix.com>
> ---
>   src/xennet.inf        |   6 +++
>   src/xennet/adapter.c  |  13 +++++
>   src/xennet/adapter.h  |   8 ++++
>   src/xennet/receiver.c | 108 +++++++++++++++++++++++++++++++-----------
>   4 files changed, 108 insertions(+), 27 deletions(-)
>
> diff --git a/src/xennet.inf b/src/xennet.inf
> index 55e11a2..79730e8 100644
> --- a/src/xennet.inf
> +++ b/src/xennet.inf
> @@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    De=
fault,    0, "8"
>   HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
>   HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
>
> +HKR, Ndi\Params\NblBatchMax,                                      ParamD=
esc,  0, %NblBatchMax%
> +HKR, Ndi\Params\NblBatchMax,                                      Type, =
      0, "int"
> +HKR, Ndi\Params\NblBatchMax,                                      Defaul=
t,    0, "32"
> +HKR, Ndi\Params\NblBatchMax,                                      Min,  =
        0, "1"
> +HKR, Ndi\Params\NblBatchMax,                                      Max,  =
        0, "64"
>   [XenNet_Inst.Services]
>   AddService=3Dxennet,0x02,XenNet_Service,XenNet_EventLog
>
> @@ -248,6 +253,7 @@ Enabled=3D"Enabled"
>   Enabled-Rx=3D"Rx Enabled"
>   Enabled-Tx=3D"Tx Enabled"
>   Enabled-TxRx=3D"Rx & Tx Enabled"
> +NblBatchMax=3D"Max Receive Indicate NBLS"
>
>   SERVICE_BOOT_START=3D0x0
>   SERVICE_SYSTEM_START=3D0x1
> diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
> index f79c0c8..6e5a95a 100644
> --- a/src/xennet/adapter.c
> +++ b/src/xennet/adapter.c
> @@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
>       int lrov6;
>       int rss;
>       int numrssqueues;
> +    int nblbatchmax;
>   } PROPERTIES, *PPROPERTIES;
>
>   typedef struct _XENNET_RSS {
> @@ -1480,6 +1481,17 @@ AdapterGetHandle(
>       return Adapter->NdisAdapterHandle;
>   }
>
> +ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    )
> +{
> +    ULONG val =3D (ULONG)Adapter->Properties.nblbatchmax;
> +    if (val =3D=3D 0 || val > NBL_BATCH_SIZE_MAX)
> +        return NBL_BATCH_SIZE_DEFAULT;
> +    return val;
> +}
> +
>   PXENVIF_VIF_INTERFACE
>   AdapterGetVifInterface(
>       IN  PXENNET_ADAPTER     Adapter
> @@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
>       READ_PROPERTY(Adapter->Properties.need_csum_value, L"NeedChecksumVa=
lue", 1, Handle);
>       READ_PROPERTY(Adapter->Properties.rss, L"*RSS", 1, Handle);
>       READ_PROPERTY(Adapter->Properties.numrssqueues, L"*NumRSSQueues", 8=
, Handle);
> +    READ_PROPERTY(Adapter->Properties.nblbatchmax, L"NblBatchMax", NBL_B=
ATCH_SIZE_DEFAULT, Handle);
>
>       NdisCloseConfiguration(Handle);
>
> diff --git a/src/xennet/adapter.h b/src/xennet/adapter.h
> index 2ea0345..a54cb4d 100644
> --- a/src/xennet/adapter.h
> +++ b/src/xennet/adapter.h
> @@ -121,4 +121,12 @@ AdapterQueryInformation(
>       IN  PNDIS_OID_REQUEST   Request
>       );
>
> +#define NBL_BATCH_SIZE_DEFAULT  32
> +#define NBL_BATCH_SIZE_MAX      64

Is there a method to know what's the ideal NBL batching size?



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

--_000_IA3PR03MB7740E0069E1B2C9ADB2E3CE5EA832IA3PR03MB7740namp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Hi,&nbsp;</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Our performance testing shows that batch sizes of 8 or 16 introduce stabili=
ty fluctuations and higher CPU overhead, whereas a size of 32 delivers opti=
mal, stable throughput.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Per NDIS architectural guidelines and driver best practices, a range of 32 =
to 64 is considered the optimal sweet spot for balancing framework overhead=
 against system latency, making 32 our ideal baseline.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<hr style=3D"display: inline-block; width: 98%;">
<div id=3D"divRplyFwdMsg">
<div style=3D"direction: ltr; font-family: Calibri, sans-serif; font-size: =
11pt; color: rgb(0, 0, 0);">
<b>From:</b> Tu Dinh &lt;ngoc-tu.dinh@vates.tech&gt;<br>
<b>Sent:</b> Monday, September 21, 2026 2:13 PM<br>
<b>To:</b> David ambu &lt;david.preetham@citrix.com&gt;; win-pv-devel@lists=
.xenproject.org &lt;win-pv-devel@lists.xenproject.org&gt;<br>
<b>Subject:</b> Re: [PATCH 1/2] xennet: improve NBL batching receive path</=
div>
<div style=3D"direction: ltr;">&nbsp;</div>
</div>
<div style=3D"font-size: 11pt;">On 17/09/2026 17:43, david ambu wrote:<br>
&gt;&nbsp;&nbsp;&nbsp; Raise NblBatchMax default to 32 (max 64). Split batc=
hes at<br>
&gt;&nbsp;&nbsp;&nbsp; EtherType boundaries and set NDIS_RECEIVE_FLAGS_SING=
LE_ETHER_TYPE per<br>
&gt;&nbsp;&nbsp;&nbsp; batch. Fix __ReceiverPushPackets: move KeMemoryBarri=
er before Returned/<br>
&gt;&nbsp;&nbsp;&nbsp; Indicated reads, and return early when queue is empt=
y.<br>
&gt;<br>
&gt; Signed-off-by: david ambu &lt;david.preetham@citrix.com&gt;<br>
&gt; ---<br>
&gt;&nbsp;&nbsp; src/xennet.inf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |=
&nbsp;&nbsp; 6 +++<br>
&gt;&nbsp;&nbsp; src/xennet/adapter.c&nbsp; |&nbsp; 13 +++++<br>
&gt;&nbsp;&nbsp; src/xennet/adapter.h&nbsp; |&nbsp;&nbsp; 8 ++++<br>
&gt;&nbsp;&nbsp; src/xennet/receiver.c | 108 ++++++++++++++++++++++++++++++=
+-----------<br>
&gt;&nbsp;&nbsp; 4 files changed, 108 insertions(+), 27 deletions(-)<br>
&gt;<br>
&gt; diff --git a/src/xennet.inf b/src/xennet.inf<br>
&gt; index 55e11a2..79730e8 100644<br>
&gt; --- a/src/xennet.inf<br>
&gt; +++ b/src/xennet.inf<br>
&gt; @@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; Default,&nbsp;&nbsp;&nbsp; 0, &quot;8&quot;<br>
&gt;&nbsp;&nbsp; HKR, Ndi\params\*NumRSSQueues,&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; Min,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, &quot;1&quot;=
<br>
&gt;&nbsp;&nbsp; HKR, Ndi\params\*NumRSSQueues,&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; Max,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, &quot;8&quot;=
<br>
&gt;&nbsp;&nbsp;<br>
&gt; +HKR, Ndi\Params\NblBatchMax,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ParamDesc,&nbsp; 0, %NblBatchMax%<br>
&gt; +HKR, Ndi\Params\NblBatchMax,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0=
, &quot;int&quot;<br>
&gt; +HKR, Ndi\Params\NblBatchMax,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Default,&nbsp;&nbsp;&nbsp; 0, &quot;32&quot=
;<br>
&gt; +HKR, Ndi\Params\NblBatchMax,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Min,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; 0, &quot;1&quot;<br>
&gt; +HKR, Ndi\Params\NblBatchMax,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Max,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; 0, &quot;64&quot;<br>
&gt;&nbsp;&nbsp; [XenNet_Inst.Services]<br>
&gt;&nbsp;&nbsp; AddService=3Dxennet,0x02,XenNet_Service,XenNet_EventLog<br=
>
&gt;&nbsp;&nbsp;<br>
&gt; @@ -248,6 +253,7 @@ Enabled=3D&quot;Enabled&quot;<br>
&gt;&nbsp;&nbsp; Enabled-Rx=3D&quot;Rx Enabled&quot;<br>
&gt;&nbsp;&nbsp; Enabled-Tx=3D&quot;Tx Enabled&quot;<br>
&gt;&nbsp;&nbsp; Enabled-TxRx=3D&quot;Rx &amp; Tx Enabled&quot;<br>
&gt; +NblBatchMax=3D&quot;Max Receive Indicate NBLS&quot;<br>
&gt;&nbsp;&nbsp;<br>
&gt;&nbsp;&nbsp; SERVICE_BOOT_START=3D0x0<br>
&gt;&nbsp;&nbsp; SERVICE_SYSTEM_START=3D0x1<br>
&gt; diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c<br>
&gt; index f79c0c8..6e5a95a 100644<br>
&gt; --- a/src/xennet/adapter.c<br>
&gt; +++ b/src/xennet/adapter.c<br>
&gt; @@ -63,6 +63,7 @@ typedef struct _PROPERTIES {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int lrov6;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int rss;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int numrssqueues;<br>
&gt; +&nbsp;&nbsp;&nbsp; int nblbatchmax;<br>
&gt;&nbsp;&nbsp; } PROPERTIES, *PPROPERTIES;<br>
&gt;&nbsp;&nbsp;<br>
&gt;&nbsp;&nbsp; typedef struct _XENNET_RSS {<br>
&gt; @@ -1480,6 +1481,17 @@ AdapterGetHandle(<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Adapter-&gt;NdisAdapterHand=
le;<br>
&gt;&nbsp;&nbsp; }<br>
&gt;&nbsp;&nbsp;<br>
&gt; +ULONG<br>
&gt; +AdapterGetNblMaxBatchSize(<br>
&gt; +&nbsp;&nbsp;&nbsp; IN&nbsp; PXENNET_ADAPTER&nbsp;&nbsp;&nbsp;&nbsp; A=
dapter<br>
&gt; +&nbsp;&nbsp;&nbsp; )<br>
&gt; +{<br>
&gt; +&nbsp;&nbsp;&nbsp; ULONG val =3D (ULONG)Adapter-&gt;Properties.nblbat=
chmax;<br>
&gt; +&nbsp;&nbsp;&nbsp; if (val =3D=3D 0 || val &gt; NBL_BATCH_SIZE_MAX)<b=
r>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return NBL_BATCH_SIZE_DEFA=
ULT;<br>
&gt; +&nbsp;&nbsp;&nbsp; return val;<br>
&gt; +}<br>
&gt; +<br>
&gt;&nbsp;&nbsp; PXENVIF_VIF_INTERFACE<br>
&gt;&nbsp;&nbsp; AdapterGetVifInterface(<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IN&nbsp; PXENNET_ADAPTER&nbsp;&nbs=
p;&nbsp;&nbsp; Adapter<br>
&gt; @@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ_PROPERTY(Adapter-&gt;Properti=
es.need_csum_value, L&quot;NeedChecksumValue&quot;, 1, Handle);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ_PROPERTY(Adapter-&gt;Properti=
es.rss, L&quot;*RSS&quot;, 1, Handle);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ_PROPERTY(Adapter-&gt;Properti=
es.numrssqueues, L&quot;*NumRSSQueues&quot;, 8, Handle);<br>
&gt; +&nbsp;&nbsp;&nbsp; READ_PROPERTY(Adapter-&gt;Properties.nblbatchmax, =
L&quot;NblBatchMax&quot;, NBL_BATCH_SIZE_DEFAULT, Handle);<br>
&gt;&nbsp;&nbsp;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NdisCloseConfiguration(Handle);<br=
>
&gt;&nbsp;&nbsp;<br>
&gt; diff --git a/src/xennet/adapter.h b/src/xennet/adapter.h<br>
&gt; index 2ea0345..a54cb4d 100644<br>
&gt; --- a/src/xennet/adapter.h<br>
&gt; +++ b/src/xennet/adapter.h<br>
&gt; @@ -121,4 +121,12 @@ AdapterQueryInformation(<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IN&nbsp; PNDIS_OID_REQUEST&nbsp;&n=
bsp; Request<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>
&gt;&nbsp;&nbsp;<br>
&gt; +#define NBL_BATCH_SIZE_DEFAULT&nbsp; 32<br>
&gt; +#define NBL_BATCH_SIZE_MAX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 64<br>
<br>
Is there a method to know what's the ideal NBL batching size?<br>
<br>
<br>
<br>
--<br>
Ngoc Tu Dinh | Vates XCP-ng Developer<br>
<br>
XCP-ng &amp; Xen Orchestra - Vates solutions<br>
<br>
web: <a href=3D"https://vates.tech" id=3D"OWA84ccd34d-2208-7bc0-8af0-43f020=
5a8816" class=3D"OWAAutoLink" data-auth=3D"NotApplicable">
https://vates.tech</a></div>
</body>
</html>

--_000_IA3PR03MB7740E0069E1B2C9ADB2E3CE5EA832IA3PR03MB7740namp_--


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 23 08:26:56 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Sep 2026 08:26:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1429860.1652484 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x9IJc-0003UG-4F; Wed, 23 Sep 2026 08:26:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1429860.1652484; Wed, 23 Sep 2026 08:26:56 +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 1x9IJc-0003U9-1k; Wed, 23 Sep 2026 08:26:56 +0000
Received: by outflank-mailman (input) for mailman id 1429860;
 Wed, 23 Sep 2026 08:26:55 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@swg.vates.tech>)
 id 1x9IJa-0003Tz-73
 for win-pv-devel@lists.xenproject.org; Wed, 23 Sep 2026 08:26:54 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x9IJZ-000vd7-GL
 for win-pv-devel@lists.xenproject.org; Wed, 23 Sep 2026 10:26:53 +0200
Received: from [10.42.69.8] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@swg.vates.tech>)
 id 6ab38d4a-2eae-0a2a0a5409dd-0a2a4508d4d8-16
 for <win-pv-devel@lists.xenproject.org>; Wed, 23 Sep 2026 10:26:53 +0200
Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net)
 by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@swg.vates.tech>)
 id 6ab38d4c-f659-0a2a45080019-b9ff1c2381a9-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 23 Sep 2026 10:26:53 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0cd5fee1500072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Wed, 23 Sep 2026 08:26:51 +0000
Received: from [192.168.1.61] (155.223.66.37.rev.sfr.net [37.66.223.155])
 (Authenticated sender: ngoc-tu.dinh@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 80E1A80B5E;
 Wed, 23 Sep 2026 10:26:50 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=CA70C0BHb1u6mOhJh81g6mklUhEnk/vJzi+KJk5GoLs=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=se6CZ0PbbXG4Cn8Xz9mI/iM7IjlXTqg6hMzc9HlQsNhs9Xl7FA3zryiy4zRYx4sFSTTsqfuI+
 1LksK+JTLfA00E6NB05l4Cum+xLpbNvFxnJsWtg34YX8Bq3iLTal0+3O0+m4B4eMYmP2pn+x5Sn
 spHc9jt97R00+fQcguR4e0xP9qt/mVJXPBhIIFkawZHiDMUoySqIwS2I53Rd/EhfwVWykgFuWTx
 iuKZ+trkbqI7QQQyp3RN5mygWdVjuABb5IBKyO5/siUAvReZDZga2IwSsWEvQGFK84lAulKEZMr
 wSdndVjJJp8P5FQtMPur015K6C3CBeP5CjNbBCaJie7Q==
X-Zone-Loop: e654884771db59849c85f91ff94685a0e925bcd9aca0
x-campaign-type: default
x-transaction-id: 8bb4d436-8c20-45a6-9faf-3c227b1fdd66
x-swg-uid: 01-425dbe4c-1dc1-46bd-88ca-c257d593f65f
X-Mailer: Sweego
Message-ID:
 <1790152011.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@vates.tech>
x-swg-bid: 1790152011.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Wed, 23 Sep 2026 10:26:50 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH 1/2] xennet: improve NBL batching receive path
Content-Language: en-US
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260917154131.2040-1-david.preetham@citrix.com>
 <20260917154131.2040-2-david.preetham@citrix.com>
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
In-Reply-To: <20260917154131.2040-2-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.35c.80fa20776892d3e2.1a0cd5feb4f.608f211f57527e46=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1790152010575
X-purgate-ID: tlsNG-c1860d/1790152013-CD94A87B-62939DC2/0/0
X-purgate-type: clean
X-purgate-size: 12771

---=Part.35c.80fa20776892d3e2.1a0cd5feb4f.608f211f57527e46=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 17/09/2026 17:43, david ambu wrote:
>    Raise NblBatchMax default to 32 (max 64)=2E Split batches at
>    EtherType boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per
>    batch=2E Fix __ReceiverPushPackets: move KeMemoryBarrier before Retur=
ned/
>    Indicated reads, and return early when queue is empty=2E
>=20
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> ---
>   src/xennet=2Einf        |   6 +++
>   src/xennet/adapter=2Ec  |  13 +++++
>   src/xennet/adapter=2Eh  |   8 ++++
>   src/xennet/receiver=2Ec | 108 +++++++++++++++++++++++++++++++---------=
--
>   4 files changed, 108 insertions(+), 27 deletions(-)
>=20
> diff --git a/src/xennet=2Einf b/src/xennet=2Einf
> index 55e11a2=2E=2E79730e8 100644
> --- a/src/xennet=2Einf
> +++ b/src/xennet=2Einf
> @@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    D=
efault,    0, "8"
>   HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
>   HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
>  =20
> +HKR, Ndi\Params\NblBatchMax, 			  		  ParamDesc,  0, %NblBatchMax%
> +HKR, Ndi\Params\NblBatchMax, 			  		  Type,       0, "int"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Default,    0, "32"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Min, 	      0, "1"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Max, 	      0, "64"
>   [XenNet_Inst=2EServices]
>   AddService=3Dxennet,0x02,XenNet_Service,XenNet_EventLog
>  =20
> @@ -248,6 +253,7 @@ Enabled=3D"Enabled"
>   Enabled-Rx=3D"Rx Enabled"
>   Enabled-Tx=3D"Tx Enabled"
>   Enabled-TxRx=3D"Rx & Tx Enabled"
> +NblBatchMax=3D"Max Receive Indicate NBLS"
>  =20
>   SERVICE_BOOT_START=3D0x0
>   SERVICE_SYSTEM_START=3D0x1
> diff --git a/src/xennet/adapter=2Ec b/src/xennet/adapter=2Ec
> index f79c0c8=2E=2E6e5a95a 100644
> --- a/src/xennet/adapter=2Ec
> +++ b/src/xennet/adapter=2Ec
> @@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
>       int lrov6;
>       int rss;
>       int numrssqueues;
> +    int nblbatchmax;
>   } PROPERTIES, *PPROPERTIES;
>  =20
>   typedef struct _XENNET_RSS {
> @@ -1480,6 +1481,17 @@ AdapterGetHandle(
>       return Adapter->NdisAdapterHandle;
>   }
>  =20
> +ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    )
> +{
> +    ULONG val =3D (ULONG)Adapter->Properties=2Enblbatchmax;
> +    if (val =3D=3D 0 || val > NBL_BATCH_SIZE_MAX)
> +        return NBL_BATCH_SIZE_DEFAULT;
> +    return val;
> +}
> +
>   PXENVIF_VIF_INTERFACE
>   AdapterGetVifInterface(
>       IN  PXENNET_ADAPTER     Adapter
> @@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
>       READ_PROPERTY(Adapter->Properties=2Eneed_csum_value, L"NeedChecksu=
mValue", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Erss, L"*RSS", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Enumrssqueues, L"*NumRSSQueues"=
, 8, Handle);
> +    READ_PROPERTY(Adapter->Properties=2Enblbatchmax, L"NblBatchMax", NB=
L_BATCH_SIZE_DEFAULT, Handle);
>  =20
>       NdisCloseConfiguration(Handle);
>  =20
> diff --git a/src/xennet/adapter=2Eh b/src/xennet/adapter=2Eh
> index 2ea0345=2E=2Ea54cb4d 100644
> --- a/src/xennet/adapter=2Eh
> +++ b/src/xennet/adapter=2Eh
> @@ -121,4 +121,12 @@ AdapterQueryInformation(
>       IN  PNDIS_OID_REQUEST   Request
>       );
>  =20
> +#define NBL_BATCH_SIZE_DEFAULT  32
> +#define NBL_BATCH_SIZE_MAX      64
> +
> +extern ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    );
> +
>   #endif // _XENNET_ADAPTER_H_
> diff --git a/src/xennet/receiver=2Ec b/src/xennet/receiver=2Ec
> index b4cf4f0=2E=2Ec46e6a3 100644
> --- a/src/xennet/receiver=2Ec
> +++ b/src/xennet/receiver=2Ec
> @@ -34,6 +34,7 @@
>   #include <procgrp=2Eh>
>   #include <tcpip=2Eh>
>   #include <xen=2Eh>
> +#include <ethernet=2Eh>
>  =20
>   #include "util=2Eh"
>   #include "receiver=2Eh"
> @@ -64,6 +65,7 @@ struct _XENNET_RECEIVER {
>  =20
>   typedef struct _NET_BUFFER_LIST_RESERVED {
>       PVOID   Cookie;
> +    USHORT  EtherType;
>   } NET_BUFFER_LIST_RESERVED, *PNET_BUFFER_LIST_RESERVED;
>  =20
>   C_ASSERT(sizeof (NET_BUFFER_LIST_RESERVED) <=3D RTL_FIELD_SIZE(NET_BUF=
FER_LIST, MiniportReserved));
> @@ -120,6 +122,7 @@ __ReceiverAllocateNetBufferList(
>       IN  PMDL                    Mdl,
>       IN  ULONG                   Offset,
>       IN  ULONG                   Length,
> +    IN  PXENVIF_PACKET_INFO     Info,
>       IN  PVOID                   Cookie
>       )
>   {
> @@ -156,10 +159,25 @@ __ReceiverAllocateNetBufferList(
>  =20
>       if (NetBufferList !=3D NULL) {
>           PNET_BUFFER_LIST_RESERVED   ListReserved;
> +        USHORT                      EtherType =3D 0;
> +
> +        if (Info->EthernetHeader=2ELength !=3D 0) {
> +            PUCHAR              Buffer;
> +            PETHERNET_HEADER    EthernetHeader;
> +
> +            Buffer =3D MmGetSystemAddressForMdlSafe(Mdl, NormalPagePrio=
rity | MdlMappingNoExecute);
> +            if (Buffer !=3D NULL) {
> +                EthernetHeader =3D (PETHERNET_HEADER)(Buffer + Offset +=
 Info->EthernetHeader=2EOffset);
> +                EtherType =3D ETHERNET_HEADER_IS_TAGGED(EthernetHeader)=
 ?
> +                            EthernetHeader->Tagged=2ETypeOrLength :
> +                            EthernetHeader->Untagged=2ETypeOrLength;
> +            }
> +        }
>  =20
>           ListReserved =3D (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MI=
NIPORT_RESERVED(NetBufferList);
>           ASSERT3P(ListReserved->Cookie, =3D=3D, NULL);
>           ListReserved->Cookie =3D Cookie;
> +        ListReserved->EtherType =3D EtherType;
>       }
>  =20
>       return NetBufferList;
> @@ -178,6 +196,7 @@ __ReceiverReleaseNetBufferList(
>       ListReserved =3D (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPO=
RT_RESERVED(NetBufferList);
>       Cookie =3D ListReserved->Cookie;
>       ListReserved->Cookie =3D NULL;
> +    ListReserved->EtherType =3D 0;
>  =20
>       if (Cache)
>           __ReceiverPutNetBufferList(Receiver, NetBufferList);
> @@ -240,12 +259,12 @@ __ReceiverReceivePacket(
>       NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO   csumInfo;
>  =20
>       UNREFERENCED_PARAMETER(MaximumSegmentSize);
> -    UNREFERENCED_PARAMETER(Info);
>  =20
>       NetBufferList =3D __ReceiverAllocateNetBufferList(Receiver,
>                                                       Mdl,
>                                                       Offset,
>                                                       Length,
> +                                                    Info,
>                                                       Cookie);
>       if (NetBufferList =3D=3D NULL)
>           goto fail1;
> @@ -328,9 +347,11 @@ fail1:
>       return NULL;
>   }
>  =20
> -static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
> +
> +static FORCEINLINE VOID
> +__IndicateReceiveNetBufferLists(
>       IN  PXENNET_RECEIVER    Receiver,
> -    IN  PNET_BUFFER_LIST    NetBufferLists,
> +    IN  PNET_BUFFER_LIST    Remaining,
>       IN  NDIS_PORT_NUMBER    PortNumber,
>       IN  ULONG               NumberOfNetBufferLists,
>       IN  ULONG               ReceiveFlags
> @@ -339,39 +360,70 @@ static FORCEINLINE VOID __IndicateReceiveNetBuffer=
Lists(
>       PXENNET_ADAPTER         Adapter =3D Receiver->Adapter;
>       NDIS_HANDLE             MiniportAdapterHandle =3D AdapterGetHandle=
(Adapter);
>       PXENVIF_VIF_INTERFACE   VifInterface;
> -    ULONG                   Count;
> -
> -    VifInterface =3D AdapterGetVifInterface(Receiver->Adapter);
> +    ULONG                   Count =3D 0;
> +    ULONG                   NblMaxBatch =3D AdapterGetNblMaxBatchSize(A=
dapter);
> +
> +    while (Remaining !=3D NULL) {
> +        PNET_BUFFER_LIST    BatchTail =3D Remaining;
> +        PNET_BUFFER_LIST    NextNbl;
> +        ULONG               BatchCount =3D 1;
> +        ULONG               BatchFlags;
> +        USHORT              FirstEth;
> +
> +        FirstEth =3D ((PNET_BUFFER_LIST_RESERVED)
> +                    NET_BUFFER_LIST_MINIPORT_RESERVED(Remaining))->Ethe=
rType;
> +        NextNbl =3D NET_BUFFER_LIST_NEXT_NBL(BatchTail);
> +
> +        while (NextNbl !=3D NULL && BatchCount < NblMaxBatch) {
> +            USHORT  CurEth;
> +            CurEth =3D ((PNET_BUFFER_LIST_RESERVED)
> +                      NET_BUFFER_LIST_MINIPORT_RESERVED(NextNbl))->Ethe=
rType;
> +            if (CurEth !=3D FirstEth)
> +                break;
> +            BatchTail =3D NextNbl;
> +            NextNbl =3D NET_BUFFER_LIST_NEXT_NBL(BatchTail);
> +            BatchCount++;
> +        }
>  =20
> -    Count =3D 0;
> -    while (NetBufferLists !=3D NULL) {
> -        PNET_BUFFER_LIST        Next;
> +        NET_BUFFER_LIST_NEXT_NBL(BatchTail) =3D NULL;
>  =20
> -        Next =3D NET_BUFFER_LIST_NEXT_NBL(NetBufferLists);
> -        NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) =3D NULL;
> +        BatchFlags =3D ReceiveFlags;
> +        if (FirstEth !=3D 0)
> +            BatchFlags |=3D NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
> +        else
> +            BatchFlags &=3D ~NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
>  =20
>           NdisMIndicateReceiveNetBufferLists(MiniportAdapterHandle,
> -                                           NetBufferLists,
> +                                           Remaining,
>                                              PortNumber,
> -                                           1,
> -                                           ReceiveFlags);
> +                                           BatchCount,
> +                                           BatchFlags);
>  =20
> -        if (ReceiveFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
> -            PVOID   Cookie;
> +        if (BatchFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
> +            PNET_BUFFER_LIST    Current =3D Remaining;
>  =20
> -            Cookie =3D __ReceiverReleaseNetBufferList(Receiver,
> -                                                    NetBufferLists,
> -                                                    FALSE);
> +            VifInterface =3D AdapterGetVifInterface(Receiver->Adapter);
>  =20
> -            XENVIF_VIF(ReceiverReturnPacket,
> -                       VifInterface,
> -                       Cookie);
> +            while (Current !=3D NULL) {
> +                PNET_BUFFER_LIST    Next =3D NET_BUFFER_LIST_NEXT_NBL(C=
urrent);
> +                NET_BUFFER_LIST_NEXT_NBL(Current) =3D NULL;
>  =20
> -            (VOID) InterlockedIncrement(&Receiver->Returned);
> +                PVOID Cookie =3D __ReceiverReleaseNetBufferList(Receive=
r,
> +                                                              Current,
> +                                                              FALSE);
> +
> +                XENVIF_VIF(ReceiverReturnPacket,
> +                           VifInterface,
> +                           Cookie);
> +
> +                Current =3D Next;
> +            }
> +
> +            (VOID)InterlockedAdd(&Receiver->Returned, BatchCount);
>           }
>  =20
> -        Count++;
> -        NetBufferLists =3D Next;
> +        Count +=3D BatchCount;
> +        Remaining =3D NextNbl;
>       }
>       ASSERT3U(Count, =3D=3D, NumberOfNetBufferLists);
>   }
> @@ -402,12 +454,14 @@ __ReceiverPushPackets(
>  =20
>       KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
>  =20
> -    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
> +    if (Count =3D=3D 0)
> +        return;
>  =20
> -    Returned =3D Receiver->Returned;
> +    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
>  =20
>       KeMemoryBarrier();
>  =20
> +    Returned =3D Receiver->Returned;
>       Indicated =3D Receiver->Indicated;

I wasn't sure about the purpose of the previous barriers so I went=20
digging=2E I've found that Receiver->Returned and Receiver->Indicated are=
=20
only ever added to, without a dependency between the two=2E So wouldn't=20
this be sufficient without any further barriers?

     if (Count =3D=3D 0)
         return;

     Indicated =3D InterlockedAdd(&Receiver->Indicated, Count);
     Returned =3D Receiver->Returned;

>  =20
>       Flags =3D NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |



-- 
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates =
solutions

web: https://vates=2Etech
---=Part.35c.80fa20776892d3e2.1a0cd5feb4f.608f211f57527e46=---


From win-pv-devel-bounces@lists.xenproject.org Wed Sep 23 09:53:17 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Sep 2026 09:53:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1430037.1652640 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1x9JfB-0004ob-32; Wed, 23 Sep 2026 09:53:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1430037.1652640; Wed, 23 Sep 2026 09:53:17 +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 1x9JfB-0004oT-0G; Wed, 23 Sep 2026 09:53:17 +0000
Received: by outflank-mailman (input) for mailman id 1430037;
 Wed, 23 Sep 2026 09:53:15 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <owen.smith@citrix.com>) id 1x9Jf9-0004oG-CM
 for win-pv-devel@lists.xenproject.org; Wed, 23 Sep 2026 09:53:15 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1x9Jf8-001dMe-PY
 for win-pv-devel@lists.xenproject.org; Wed, 23 Sep 2026 11:53:14 +0200
Received: from [10.42.69.10] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6ab3a188-2eae-0a2a0a5409dd-0a2a450ac696-10
 for <win-pv-devel@lists.xenproject.org>; Wed, 23 Sep 2026 11:53:14 +0200
Received: from [40.93.194.12]
 (helo=SN4PR0501CU005.outbound.protection.outlook.com)
 by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <owen.smith@citrix.com>)
 id 6ab3a189-f2d2-0a2a450a0019-285dc20ced31-3
 for <win-pv-devel@lists.xenproject.org>; Wed, 23 Sep 2026 11:53:14 +0200
Received: from SA6PR03MB7760.namprd03.prod.outlook.com (2603:10b6:806:43c::5)
 by LV5PR03MB8434.namprd03.prod.outlook.com (2603:10b6:408:35a::16)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.16; Wed, 23 Sep
 2026 09:53:11 +0000
Received: from SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38]) by SA6PR03MB7760.namprd03.prod.outlook.com
 ([fe80::4d5b:a91f:46a3:4b38%5]) with mapi id 15.21.0451.014; Wed, 23 Sep 2026
 09:53:10 +0000
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=MtZkP2M7VfNl18ilxVZqneUz8GY2Mgay0PYRKZq90mlhuL6GyyrT40fBRe4AeZXJYMr6RoIWZAAYFvHgbzxeiwM2P55Oj9+/Lwe8gz52S7LVcxQexiXfsTp+6Ivp5IPlfCDXfTKDufeRwTLXJWqi1p7YR+JABy+oL9wVQEGga/HZPh4LSh0mCpnUh+GXVzcLGQd1Wj1ArZkLFMhPLGp1YS3Y2TAAvW3CdYbhvLfZn6+YVRCRfKLgyXhWLF9qm0FwvI6BeQMqYl+RD/h4ViqnVt4PDJwSPCBcFGIJEkhKMXCuyyA7dPQmvlHTURq0BpKiQ8UhvCgIiwv3fQ1jZUBSTg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=b9WXk9+LNWb6LlcGrcOOSPCtQWdiSOHpysmsN1+e1VA=;
 b=DaG1KGtq91rTVWdVefkvr0oDbO2hHazqTB20qiSjz9rbDJI4Zmpf7JY5GanL04YGnK//ChYCZWfLMkV//dsiKiLfLziN+wkyTLLF1M2leRJ6KSdU/UvvfDLuRrvNx9/QS9NsoxzwH6ts1Tunq8YdtZmO9EjpIoKwowBIaf4WYRr+FkN9dpr1NoM0NttjPuK4DaTV9HQhj5ZQaQG/sNuP3G45p2SPAKfEIGvrbEyPOubICCsSpkh8PezeOkbYqkqoS7V3T3aYJh33brPswecuQzVGM/U1SDwyFb6SmyOc5nqGk2twjD6xmaMPyHHTSOKoFQp1l4jILhbh7ZCCy1DFzQ==
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.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=b9WXk9+LNWb6LlcGrcOOSPCtQWdiSOHpysmsN1+e1VA=;
 b=hqsrAgROANbMHZ/u/qpXp4ogrC6JRpGbkKC9AVXFlh7aayS+wLpryWlhvG5gse+L5oR6pWqRYlJzuXIzgUH4zmJgB6hC2cRHiZ3SF31SmH841jA2J1p5O2KOaUJvqJ8oCgZlOjEtminUSr1+wYmEqo97Na0iIKAMJkkw6868zjk=
From: Owen Smith <owen.smith@citrix.com>
To: Tu Dinh <ngoc-tu.dinh@vates.tech>, David ambu <david.preetham@citrix.com>,
	"win-pv-devel@lists.xenproject.org" <win-pv-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] xennet: improve NBL batching receive path
Thread-Topic: [PATCH 1/2] xennet: improve NBL batching receive path
Thread-Index: AQHdRrtcRBjz//WLtUSjudtOhbIIVLbb3RgAgAAXBww=
Date: Wed, 23 Sep 2026 09:53:10 +0000
Message-ID:
 <SA6PR03MB77602FDBE2E53247AAAFFE13FE822@SA6PR03MB7760.namprd03.prod.outlook.com>
References: <20260917154131.2040-1-david.preetham@citrix.com>
 <20260917154131.2040-2-david.preetham@citrix.com>
 <1790152011.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@vates.tech>
In-Reply-To:
 <1790152011.8631fc262581453bbf619ec5b2062170.1a0cd5fee1500072c4@vates.tech>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SA6PR03MB7760:EE_|LV5PR03MB8434:EE_
x-ms-office365-filtering-correlation-id: 16c9f4ac-42c3-4df7-f60d-08df19587a31
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam:
 BCL:0;ARA:13230040|376014|366016|23010399003|1800799024|38070700021|4143699003|10067099003|5023799004|11063799006|56012099006|22082099003|18002099003;
x-microsoft-antispam-message-info:
 Gwen7LFZouY5oN7AYkPtahG/JtrhMyenTVnxX6TXmHflWHGlnN/AA+s876rdeL96zzYshIZq2pvlS5Q/LD/Q8pZt1EeXd7OEpZqWEL6/V548cFAXbqCbK34yReA9IOjlnVYOWpa+TWiVwTdT7mMJrwJCSIE+vH8ZTMh7/ewbE9rQESyBKTpWFKdkE7nDhZUQT+mDF8YgQcmJMUrawrqeVGSs0j4HdAnwXajTAlkP44VU+a4S1hMK7S94O1vUnVw/Q0blgAkOZjvKHSXwqFSKx/DVDZxW/rM4JDKABJlakSBZbGAAoigrDM/W0nYiufghFaE69hrmo9yU1YGRdNX5+7/5e46r8bFQ2itdOOBdmcq1EqQatSbWPQDR6tny0fQ47N6ic8qE/Cqbvun/EJmweR5Yl9ReQPAR4mihK0vFgAcVQnxZWt7qTNQxMl+4TDfhp81zl35empTZFrpc+Pkeo6nL4WSVQDkOkVij/UDrfVULpnCRSfBPyCJGM/0CGmWjSJliOedyh9sdxH88WmgAqPzZigU1Ao9638dv1cl5TSq3O14lu/KHED0DnP9pQH34Rn1pRDS2NGPs+TqyrlKFC8xRdQe43nexBIOU3FbEMZ/o0qot0UJFE853dB/jn/EgCK/XkS2wia0ukiZeeK4WOySQ9sxQUdNn6SJG6TJVnAM=
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA6PR03MB7760.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(23010399003)(1800799024)(38070700021)(4143699003)(10067099003)(5023799004)(11063799006)(56012099006)(22082099003)(18002099003);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?iso-8859-1?Q?Mpdqw3TIhXfXiLRFLrYyJr3yShFgJALmY/1BVidWY1hX25RL88KpSS7Wl4?=
 =?iso-8859-1?Q?oUeLr2NQw8qM70wjNj0UsbiW2Zpw4rIvctoH59swSmHdIQ4tRSAhCzIcyN?=
 =?iso-8859-1?Q?RkD6HFwSIkYM55A+PgOu4SjbCaW6NqAFo9FfzFln/dySVCn09JhALefOIV?=
 =?iso-8859-1?Q?pJfIGXHoWrvG810et6MAi8oE2i1AZOAMgkWJKlk514A02nRBfch9S7Y7Y4?=
 =?iso-8859-1?Q?/NcENhrNR2rH/BR8o/oEhqi3Jeqf0zH2U0BkQlTMB1DVpLfVVboBn8WRqj?=
 =?iso-8859-1?Q?A6WtWUjRKxf8pAG3Udua6sBMGhfKv9QJGqjVimQUuc3JQNaV5xYKdmDv0d?=
 =?iso-8859-1?Q?oDJe8fkoJnrl2iVmdH94mZQARrVqwggh+xP5IRFhOLFkfl98LEkNObRlg4?=
 =?iso-8859-1?Q?0EZ9Hofg9kb6vsqNx4dqmHdRTwIqr3LCnhb6z64U97ZGkQ1QZC4vaE1vT9?=
 =?iso-8859-1?Q?UZ0TNA2lvWn8oZc4Wqoeq5a8v55P3ndUendB+YrQhho/Sh68pwqFSygF+O?=
 =?iso-8859-1?Q?7D/OGwzFfZAQd7HwvK44o+eIYI1vYPrP5oaPYmiiYSnkHV01ZNVBLTTa2V?=
 =?iso-8859-1?Q?hxyf1fI0kSJMgeNVB9TdZnt5iwn6sJxVaLSgqR72O1lFHXhnDiDJs5exN4?=
 =?iso-8859-1?Q?kr94qzufSZwrowwXNZd1hXsLEfA6snn0jECZeLBHt3TU4t2/c9Kmr76mdC?=
 =?iso-8859-1?Q?m87RJblqiw0UKzXBo2I5QYBQomELhsa4vEzMpV2NX9nbOo79dBOs2uOJ5v?=
 =?iso-8859-1?Q?K+qopBPUMD2HpyNJ2GBONmIcCv9zin/FeH5ZS+EwbgNLVP2Ko/WG4ecezY?=
 =?iso-8859-1?Q?dAXRgU8NzgZu2ZNVqmDIwVOMWlKkxoH828KGereD2LGscSMl6hpJctTbG9?=
 =?iso-8859-1?Q?s9645PtACJ4PwTAqeYWCk+mABYhEHZYL3dAO5fYNkksmEWi2gUAriM2Hbt?=
 =?iso-8859-1?Q?em3Tso0qu9zjSK+KLfmX+9jCZkNNp7y17Y/dvIWGZ1HAH8SCcav+NHTdRI?=
 =?iso-8859-1?Q?NhJL77KkXJTdaTvN6Uhw8QsvhThrWm7MnbglXJnUYHHtzIXyH8FTtE5hK0?=
 =?iso-8859-1?Q?ade5JXrwfLv3RSUIs1uE/p1b+kPURfFd1fLmDSW3lDyPSUdgQSr9HQsIEE?=
 =?iso-8859-1?Q?oYgExYoFcxb6EarPY6/L7zFnbllygQnkYug0MG7CRa1z5HbW0x2EXRRaNX?=
 =?iso-8859-1?Q?pZJHSD46bH1VC8lWRHHSn5zF0sLLbyXi6hGO25JxlRuC4r2N8JbP4TNF0d?=
 =?iso-8859-1?Q?m8b3UyTkeg6yZhYqvST87kKbpoJYINKQG2IONnXSSudvooyVFzFtdpSMb7?=
 =?iso-8859-1?Q?uGVXT71yf0SO6HgT69MFvqgqDqsamm8pU5g3p/6Nrg3VSL9ToVNwWppPi5?=
 =?iso-8859-1?Q?w2n55BZUh7OCzUdOxcpcIWthYgWesKCcas7aI3NJYZESPyL4uNXlWwyie4?=
 =?iso-8859-1?Q?VR1qQUcwQg+4tyMy/oceE2dIbNtUZ8sm7Qf2wbHhPYC0/8pUnQxgXH06v2?=
 =?iso-8859-1?Q?NajtLUInZ4eBPJXbP6Xhqz3/4Z3AnArnle96kHzIC8LK7h4BiWyWq9S5yb?=
 =?iso-8859-1?Q?IDRaBkIWP4ZuLe6nNSgM3oMP18Eaaq8sr+/TDudVvgIbQpxJKBk09dPE8h?=
 =?iso-8859-1?Q?Kccb5+CGnDxV4BMc0aydfJjW8c8sIS1Ml+zyfZ4l3nmgSmuDBlLaMGaXBC?=
 =?iso-8859-1?Q?s6kkBMMEtexk6E5A27yYoaLP3J4RLboUMUWFgLQwW//IPVL5GcQyDJNpYd?=
 =?iso-8859-1?Q?Gw1HyC/YuG7WLg5ZOVkiHQKIRDYxzkFnClvHlZePQ3B0G9?=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SA6PR03MB7760.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 16c9f4ac-42c3-4df7-f60d-08df19587a31
X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Sep 2026 09:53:10.7514
 (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: QbMyTFmhfKXmsIZkw3nyQiETJM4Km1J80ZgezYRYtNikXY0nFG/jKT6C11+eXxZq6A4o5qfiGHPGfAPviy30cg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV5PR03MB8434
X-purgate-ID: tlsNG-4011c0/1790157194-502F0CFC-C99850B1/0/0
X-purgate-type: clean
X-purgate-size: 1457

>>=0A=
>> -    Returned =3D Receiver->Returned;=0A=
>> +    (VOID) InterlockedAdd(&Receiver->Indicated, Count);=0A=
>>=0A=
>>       KeMemoryBarrier();=0A=
>>=0A=
>> +    Returned =3D Receiver->Returned;=0A=
>>       Indicated =3D Receiver->Indicated;=0A=
>=0A=
>I wasn't sure about the purpose of the previous barriers so I went=0A=
>digging. I've found that Receiver->Returned and Receiver->Indicated are=0A=
>only ever added to, without a dependency between the two. So wouldn't=0A=
>this be sufficient without any further barriers?=0A=
>=0A=
>     if (Count =3D=3D 0)=0A=
>         return;=0A=
>=0A=
>     Indicated =3D InterlockedAdd(&Receiver->Indicated, Count);=0A=
>     Returned =3D Receiver->Returned;=0A=
=0A=
I was also looking into this, as the InterlockedAdd operation does a full m=
emory barrier,=0A=
KeMemoryBarrier is not required. I'd put the Returned read before the Inter=
lockedAdd,=0A=
so its sampled before the implicit barrier.=0A=
=0A=
I think there is also an improvement here, and the caller, where the Queue-=
>Lock can be acquired=0A=
once - to insert the NBL, and if Push, swap out the NBL - but this should b=
e looked at as a=0A=
future change=0A=
=0A=
Owen=0A=
=0A=
>=0A=
>>=0A=
>>       Flags =3D NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |=0A=
>=0A=
>--=0A=
>Ngoc Tu Dinh | Vates XCP-ng Developer=0A=
>=0A=
>XCP-ng & Xen Orchestra - Vates solutions=0A=
=0A=
web: https://vates.tech=0A=


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 25 14:02:20 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 25 Sep 2026 14:02:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1433991.1654194 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1xA6VH-0008CH-Uu; Fri, 25 Sep 2026 14:02:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1433991.1654194; Fri, 25 Sep 2026 14:02:19 +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 1xA6VH-0008CA-SI; Fri, 25 Sep 2026 14:02:19 +0000
Received: by outflank-mailman (input) for mailman id 1433991;
 Fri, 25 Sep 2026 14:02:18 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1xA6VG-0008Bz-QQ
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 14:02:18 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1xA6VF-008mxW-Bv
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 16:02:17 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67edd-bab6-0a2a0a5309dd-0a2a4509916e-6
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:02:17 +0200
Received: from [74.125.228.140] (helo=mail-ej2-f12.google.com)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67ee9-be1a-0a2a45090019-4a7de48c999e-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:02:17 +0200
Received: by mail-ej2-f12.google.com with SMTP id
 a640c23a62f3a-c254f70553dso130151266b.0
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 07:02:17 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2ae780d2ecsm121058066b.56.2026.09.25.07.02.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 25 Sep 2026 07:02:16 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1790344937; x=1790949737; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=xZVGvgSSXQi8QTUf/m0F3iygy06ravqFuPLAiUUe308=;
        b=DYlzuX3DWqpIyFVFEzvZmekQCcz2psGL7S0CX305DzLJImPoDQ82ZnOl4nP+qq92pX
         8GHcYzLhTd/9uMT7hDAc1je92NtZp9/gr1MLqYASIP/HJXhYhII9HdNCDYeE2Uh7uagE
         wybonIiHM2CkWHZjSt3Y7FFcWbVFNh18iNuhk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1790344937; x=1790949737;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=xZVGvgSSXQi8QTUf/m0F3iygy06ravqFuPLAiUUe308=;
        b=QQc41rnCk0tvSBNxU4OIK5V4EZLBgMDphpYadVUjhjsVdUPxX8CKtXaWb0GBkMC/9j
         fOpaVUS82fFWVcyGTK8yqLZgKMXsEg4kvFFjwKlDkAKtx3JiU9SUU1TKXq37x5L6fpka
         VYmSl4OFwYMVTMEokF89R+PEYPEUr9ZrpyWB9C+cT0PLtKe+Z8KNguOQLAdMG+H1lP2q
         XtIVQ1J02cyQYXVc+tFsYss9IHSAowAf+wbMHpkPM7QUyuhCHilFmz7aMgiSqKYkiQCk
         DEN+W55iCJbayA2avHl5yKybuc5PUAXKfjUK5insg+UdrAYEFfakisc/SUhQqkt1SzYh
         vURQ==
X-Gm-Message-State: AFuF++nLx5+gFROAAJfr3Yrw65qjebvE5mKqHKb10VtNAZdwobtLkZ7/
	RpqBxVmpUasQAx9h7DekFQtIlwme6VycSBXzlF+KN6AO825UvLtJfz7jWR1nvk0pidMYz1fzVCm
	UuLlS
X-Gm-Gg: AYBFou30eVOVNxoR79z+hiAIDTRNxx/SXPSEpyQYOuYxWDqy40EIvSIWYlYSDGqQfgK
	gbmMt/1En6NQbOwn/zDVfjw3PuTvrGYyZmFIstwYRF6CWaCCD3pzLUmg5WaD6nGEZVmIRTu1YK/
	DaSoaPCSuQ5lKE01wulhEKc938FZOhXcT1KgmJayvlM9weqDtQHPzYkhOW5sFCF66VzqOTOYxE0
	Z3YrX6LhB3CNhuvMcBy18tIf7nuWJT+hs+e8vm98aR0D+3rme4qh2yTKn2VJiQbvTIlThtfOph0
	J/eLJ+jCAkp5GvKcYDxaJuBJ11MN1XR4BFHmqnquHd+XZTrSpj8j9Aaa4HZVTfQkGIgvt1kLtZs
	o6eiZDQPZHMM7LUGA+IbZREk0i2iAsVPN12MfzIr5vGNwf/1bwa9esuOtoDzGrNjihkt2Zf05eD
	85qXgO71GlYAWqwftd0CiSo+wqVOpyr/ODi/TjY5Hji5UEY/PopGE42GlzDg7wcW26pLYIUXxqO
	WFGkcxoYfZvPzgw5hZNhnxKsRdfZehKOI+aHDpvxGt1t9sH
X-Received: by 2002:a17:907:960d:b0:c26:219f:6f74 with SMTP id a640c23a62f3a-c2ac2389ac3mr507786266b.5.1790344936249;
        Fri, 25 Sep 2026 07:02:16 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>,
	"Claude Sonnet 4.6" <noreply@anthropic.com>
Subject: [PATCH] xenvif: fix TX doorbell coalescing for ALGORITHM_NONE traffic
Date: Fri, 25 Sep 2026 14:57:21 +0100
Message-ID: <20260925135723.776-2-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260925135723.776-1-david.preetham@citrix.com>
References: <20260925135723.776-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-bad1c0/1790344937-3AAD8034-E46D176E/0/0
X-purgate-type: clean
X-purgate-size: 1248

Each NBL carries a single hash value covering all its NET_BUFFERs.
All NB within the same NBL therefore map to the same TX ring, so the
ring doorbell can be deferred across NB and fired once at the NBL
boundary when More=FALSE.

TransmitterQueuePacket was overriding More=FALSE unconditionally in
the XENVIF_PACKET_HASH_ALGORITHM_NONE case, causing a ring kick on
every individual NET_BUFFER instead of once per NBL.

Removing the override lets the More flag from xennet flow through
correctly, so ALGORITHM_NONE traffic gets the same per-NBL kick
behaviour as ALGORITHM_TOEPLITZ.

Signed-off-by: david ambu <david.preetham@citrix.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 src/xenvif/transmitter.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index 8c4ee41..ad58336 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -5245,7 +5245,6 @@ TransmitterQueuePacket(
     switch (Algorithm) {
     case XENVIF_PACKET_HASH_ALGORITHM_NONE:
         Value = __TransmitterHashPacket(Transmitter, Packet);
-        More = FALSE;
         break;
 
     case XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED:
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Fri Sep 25 14:02:20 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 25 Sep 2026 14:02:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1433992.1654197 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1xA6VI-0008CU-1F; Fri, 25 Sep 2026 14:02:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1433992.1654197; Fri, 25 Sep 2026 14:02:20 +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 1xA6VH-0008CL-TW; Fri, 25 Sep 2026 14:02:19 +0000
Received: by outflank-mailman (input) for mailman id 1433992;
 Fri, 25 Sep 2026 14:02:18 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1xA6VG-0008By-QO
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 14:02:18 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1xA6VE-00G0rs-NN
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 16:02:16 +0200
Received: from [10.42.69.9] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67ed7-bab6-0a2a0a5309dd-0a2a4509a148-0
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:01:59 +0200
Received: from [74.125.228.99] (helo=mail-ed2-f35.google.com)
 by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67ed7-be1a-0a2a45090019-4a7de463b3d1-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:01:59 +0200
Received: by mail-ed2-f35.google.com with SMTP id
 4fb4d7f45d1cf-6aaeeacce15so856638a12.1
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 07:01:59 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2ae780d2ecsm121058066b.56.2026.09.25.07.01.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 25 Sep 2026 07:01:58 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1790344919; x=1790949719; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=CMlfykndSs54BNyh/Qs05fMcGmYlIp2B4QenC0TyWqM=;
        b=uM2YBhvdvlY2Z3TieirGX6mQwyvL237uIbvfaABo3sQ3TXb1/WgLU3x4uYs/3lNmbm
         ialgXwi04ErPfFCmuSbIqsO7QIh1+QzFrCdezK7w/xQQG2kmsnWnf2jzPNqUGTqpk9c3
         na/KaY1ST/2ZhSGACZCkekl+yDHkI+Zy5PSKM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1790344919; x=1790949719;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=CMlfykndSs54BNyh/Qs05fMcGmYlIp2B4QenC0TyWqM=;
        b=bxQFsIVsE1p78d0YKEb98sAGlL4F5q5q/ECli5atY+emHag+4V+BN8nQwHoHIN952y
         FN58dBBGhUdWJVGDzLUwxqQG4dm7rUbIPoeV7+kR+SCeIIDPxJAiYIF8Q9IZVhE1Unwz
         QnAEtbaL8BHHsDekfRb7yfLzNGorqKRGSNl9KW6aQFmSuwFKiy3P9lf6CSZdT0ocaPJU
         eNZKi6gX0WY6x3gmj4obKmjxnWC0R6a+S9tqPuTW2Mo29mboUdamq1213ORRy47BEVAF
         Be3LS5NOFzA81KPdJPT+Gh48zMtLWl1yhpi1+4g6oqL8Uof+lC0wuqgVUEJrzNA4scIl
         hRqA==
X-Gm-Message-State: AFuF++mLjJS6LoiA7iABvqMSji/6rMJhmq6jQ7kvokfJLEBO6w1lrYCG
	Xlov3t60+UiGlakPzDpAtA7oZr+t1Cf9RfTnrJHenx3zVGT5GgiHb6n2Nrw4p9/r9VtlTvGjhNd
	qKVmi
X-Gm-Gg: AYBFou2BbEqkInH4J0+RXUhdvxUHi72jDC4/YD6TBNXEKBl298MV2t+l4t8ibGildRb
	gueu81FgrvZny56cW+k0HJnQ0ZEXV7fi9D3WpG2t3wvPxOovxNaImIhZCRN/eX6hWZFQkqYEpWv
	144kFG73kvm0fNbgpJyGVZyXr66rmE6riyQtQq/LSCgyx1y+APopr8aZn3WStwt/7T8bSDJHAg8
	t9Cmb6F3vzJ9q1YvcY6tRkzmww9rxEsBluhcRKGH2f5p4XMylUcII/Sm+jIrMZ7Oj3B5Khtle9n
	YejBdT5z7t78jha1VoFM3dJ4070rbxsqoL+xbBww3Ox4e5Y0Qm/xs14V+Is11icRQMgra1Jjgb8
	26HlutlKPau+h6U09mwgK0BUJMR7jV/fzVlxMuJE23yDSPnCFyKTa6aAdkqocc+qtI7AvFyv2Ha
	gS7GLldT+nL80hUI/BWbUZWmOgCWuX/nAp0o1VsIX/HullQBFrcj9iQoKQ5ZquucB+1DCZ1DR27
	E5yeTqFKsfaOOwvCjzvxBtN4KnHh/AqigTuqQ==
X-Received: by 2002:a17:907:9812:b0:c26:1648:a06e with SMTP id a640c23a62f3a-c2ac253f94cmr531589666b.41.1790344918504;
        Fri, 25 Sep 2026 07:01:58 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>
Subject: [PATCH 0/2] xennet/xenvif: fix TX doorbell coalescing and improve RX NBL batching
Date: Fri, 25 Sep 2026 14:57:20 +0100
Message-ID: <20260925135723.776-1-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-bad1c0/1790344919-3A2C4034-BF6B0034/0/0
X-purgate-type: clean
X-purgate-size: 3007

These two patches address TX doorbell coalescing correctness in xenvif
and RX receive-path NBL batching efficiency in xennet.

Background
----------
NDIS passes packets to the miniport as chains of Net Buffer Lists (NBLs),
each NBL containing one or more Net Buffers (NBs). The xennet transmitter
signals xenvif's TX ring via a "More" flag: More=TRUE defers the ring
doorbell (kick), More=FALSE fires it.

The intent is to batch all NBs within one NBL with a single kick at the
NBL boundary. Each NBL carries a single hash, so all its NBs map to the
same TX ring - making per-NBL kicking both correct and sufficient.

Patch 1 - xenvif (TX fix)
--------------------------
TransmitterQueuePacket unconditionally overrode More=FALSE in the
XENVIF_PACKET_HASH_ALGORITHM_NONE case, causing a ring kick on every
individual NB instead of once per NBL. Removing the override lets the
More flag from xennet flow through correctly, giving ALGORITHM_NONE the
same per-NBL kick behaviour as ALGORITHM_TOEPLITZ.

Patch 2 - xennet (RX batching)
-------------------------------
Three improvements to the RX receive-indicate path:

  - Raise NblBatchMax default to 32 (configurable 1-64 via registry)
    so NDIS receives larger batches in a single
    NdisMIndicateReceiveNetBufferLists call, reducing per-indication
    overhead.

  - Split batches at EtherType boundaries and set
    NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per batch, enabling NDIS to
    apply protocol-layer optimisations.

  - In __ReceiverPushPackets: sample Returned before the InterlockedAdd
    so it is read prior to the implicit full memory barrier that
    InterlockedAdd provides; use the return value directly as Indicated
    and remove the now-redundant KeMemoryBarrier.

Performance (inter-host, Windows desktop VM, 10G, 3 iterations x 60s)
-----------------------------------------------------------------------

                     Without patch    With patch (32 NBL default)
Single-stream TCP     4525 Mbits/s     5550 Mbits/s   (+23%)
Single-stream UDP      372 Mbits/s      441 Mbits/s   (+19%)
8-stream TCP         11931 Mbits/s    17017 Mbits/s   (+43%)
8-stream UDP            87 Mbits/s      120 Mbits/s   (+38%)
TCP latency (psping)   0.8 ms           0.9 ms        (no regression)
ICMP latency (ping)    <1 ms            <1 ms         (no regression)

Tested at NblBatchMax = 8, 16, 32, 64. Peak throughput at 8-16;
larger values show marginal returns. Default of 32 is a conservative
mid-point. Latency is unaffected across all batch sizes.

david ambu (2):
  xenvif: fix TX doorbell coalescing for ALGORITHM_NONE traffic
  xennet: improve NBL batching receive path

 src/xennet.inf           |   6 +++
 src/xennet/adapter.c     |  13 ++++++
 src/xennet/adapter.h     |   8 ++++
 src/xennet/receiver.c    | 110 +++++++++++++++++++++++++++++++++++----
 src/xenvif/transmitter.c |   1 -
 5 files changed, 107 insertions(+), 31 deletions(-)

--
2.51.0.windows.1


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 25 14:02:25 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 25 Sep 2026 14:02:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1433993.1654203 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1xA6VN-0008Fg-1Z; Fri, 25 Sep 2026 14:02:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1433993.1654203; Fri, 25 Sep 2026 14:02:25 +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 1xA6VM-0008FX-Ut; Fri, 25 Sep 2026 14:02:24 +0000
Received: by outflank-mailman (input) for mailman id 1433993;
 Fri, 25 Sep 2026 14:02:23 +0000
Received: from mx.expurgate.net ([195.190.135.10])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <david.preetham@citrix.com>) id 1xA6VL-0008FG-P6
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 14:02:23 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1xA6VL-008muo-5n
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 16:02:23 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67ee3-2eae-0a2a0a5409dd-0a2a4501b678-8
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:02:23 +0200
Received: from [74.125.228.171] (helo=mail-ej2-f43.google.com)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from <david.preetham@citrix.com>)
 id 6ab67eee-5984-0a2a45010019-4a7de4abb1e0-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:02:23 +0200
Received: by mail-ej2-f43.google.com with SMTP id
 a640c23a62f3a-c2af3701927so63884466b.3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 07:02:22 -0700 (PDT)
Received: from mewpvdipd1063.citrite.net ([52.174.59.202])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-c2ae780d2ecsm121058066b.56.2026.09.25.07.02.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 25 Sep 2026 07:02:21 -0700 (PDT)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=citrix.com; s=google; t=1790344942; x=1790949742; darn=lists.xenproject.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=Q0w12XvgWWEa/MFlRuo47bmYsjutSmguqv2w8h+sZMA=;
        b=dGqoNIyioKil0wVtdCsnxIWLxmERmmvi+cQea+1MvISE9hB6LUlThXkArsi/cNbKmX
         4k7+HIsE5zvkr+lCLbWYXFRSKiqE6wzTQrX5Gl64Z1ebHrSA/2T9fipZ44UXHDCnQ9OC
         bosL1lahLue/uwfqwdONh0lkmqXNwmxBc1mPk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1790344942; x=1790949742;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=Q0w12XvgWWEa/MFlRuo47bmYsjutSmguqv2w8h+sZMA=;
        b=aGx3VAWcYMqA9zM7GsSIdkf8fKTicK8ij+dD9ADyH0osRSP+UtyYZm6aCTisJMgFS2
         OlU3R2xuIGQiQJ/selJm6ABu15D3Kr1ANh2pG00+a+cJJYQ2HgJ+fCulyjaLIJoxpkpI
         mUFNp9maR846gIG/sojb3jtdYbODM3FYZTEYvYLsHPjaoss0VJdHdo4hxIKy9WMXlmX+
         6LoIGtddcOpvvsAGmsLbABaEJdWhlAbzLfP/5tBI5VsMook/svSruXSOmxn5jIMyCzVo
         i4T2gyFf/Gowq4qdexu3AP0lWn690pvVsNE4Gn21vZWrakCqxPT3gbKtRkisC7kIAKJl
         D38w==
X-Gm-Message-State: AFuF++kprTqVO7i8XF98UyCbAtORBiEAI9OJYmhBU/SwlpwOSGXR1cOw
	CPRmQso51bIMUsUvRvC5EbORbp4AlfLMR1Lyfv80C97fE1w4TIuusKRrKkY+yv+RF2Hldhe72L/
	GbmsoCPQ=
X-Gm-Gg: AYBFou2to56A0PpAZktEGBj86oYNHG6+RfpgPAMlEc8YqDKRckYtb4mu/jkRB4WSzqM
	csOnvrS/VKxWt6C6aY6WKfFDRaJdGx0bTtrBv9h2XqUjYkkkQlzUMzgWi1AKLahqqM87uuSC0fH
	JxaEcpVYNdGG+4hmq0dOv3gm0pzXa3uECZMVqRAnwYDdeK+nbcPJsGB3ioDSxTfuTrAfPPqAwtc
	uEGO9B+GlkgGuHMlkHz1gZtXODl7rvzWmkp5dAdN7TMnl/BHYGPrMOX9LvoLCkdeJhc7IhhdS4e
	CAFGAUmEihps/CH7T0x7gYygF3tPHIcTkCuiAgJYWARi05c3/y4ZNgK/EnWQ+ntA4pDuSkibQKD
	1hizk5Ex3Ybudzs7LCJaVFmhJwoDjcC1FyexICiwNh8Ls/p4PIqnx9oHGzy8LrbBkZw9oeQyq6M
	kdTD/TLXJwHq6rlSGMyxscjUGJ+Ws9Yd0Zw+RftoRO9N/4SqtP1rRqkkCx8UKycsquNmHMhmzf6
	OFJxgtP5Q6scBm6p8R7m5zaCPomHeU3/lj99Q==
X-Received: by 2002:a17:906:f588:b0:c29:f5d8:9c72 with SMTP id a640c23a62f3a-c2ac226d3ffmr552458066b.33.1790344942099;
        Fri, 25 Sep 2026 07:02:22 -0700 (PDT)
From: david ambu <david.preetham@citrix.com>
To: win-pv-devel@lists.xenproject.org
Cc: david ambu <david.preetham@citrix.com>,
	"Claude Sonnet 4.6" <noreply@anthropic.com>
Subject: [PATCH] xennet: improve NBL batching receive path
Date: Fri, 25 Sep 2026 14:57:22 +0100
Message-ID: <20260925135723.776-3-david.preetham@citrix.com>
X-Mailer: git-send-email 2.51.0.windows.1
In-Reply-To: <20260925135723.776-1-david.preetham@citrix.com>
References: <20260925135723.776-1-david.preetham@citrix.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-purgate-ID: tlsNG-d62444/1790344943-1D47D757-50338C5F/0/0
X-purgate-type: clean
X-purgate-size: 11159

Raise NblBatchMax default to 32 (max 64). Split batches at EtherType
boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per batch.

In __ReceiverPushPackets, sample Returned before the InterlockedAdd
so it is read prior to the implicit full memory barrier that
InterlockedAdd provides. Use the return value of InterlockedAdd
directly as Indicated and remove the now-redundant KeMemoryBarrier.

Return early when queue is empty.

Signed-off-by: david ambu <david.preetham@citrix.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 src/xennet.inf        |   6 +++
 src/xennet/adapter.c  |  13 +++++
 src/xennet/adapter.h  |   8 +++
 src/xennet/receiver.c | 110 ++++++++++++++++++++++++++++++------------
 4 files changed, 107 insertions(+), 30 deletions(-)

diff --git a/src/xennet.inf b/src/xennet.inf
index 55e11a2..79730e8 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    Default,    0, "8"
 HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
 HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
 
+HKR, Ndi\Params\NblBatchMax, 			  		  ParamDesc,  0, %NblBatchMax%
+HKR, Ndi\Params\NblBatchMax, 			  		  Type,       0, "int"
+HKR, Ndi\Params\NblBatchMax, 			  		  Default,    0, "32"
+HKR, Ndi\Params\NblBatchMax, 			  		  Min, 	      0, "1"
+HKR, Ndi\Params\NblBatchMax, 			  		  Max, 	      0, "64"
 [XenNet_Inst.Services] 
 AddService=xennet,0x02,XenNet_Service,XenNet_EventLog
 
@@ -248,6 +253,7 @@ Enabled="Enabled"
 Enabled-Rx="Rx Enabled"
 Enabled-Tx="Tx Enabled"
 Enabled-TxRx="Rx & Tx Enabled"
+NblBatchMax="Max Receive Indicate NBLS"
 
 SERVICE_BOOT_START=0x0 
 SERVICE_SYSTEM_START=0x1 
diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index f79c0c8..6e5a95a 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
     int lrov6;
     int rss;
     int numrssqueues;
+    int nblbatchmax;
 } PROPERTIES, *PPROPERTIES;
 
 typedef struct _XENNET_RSS {
@@ -1480,6 +1481,17 @@ AdapterGetHandle(
     return Adapter->NdisAdapterHandle;
 }
 
+ULONG
+AdapterGetNblMaxBatchSize(
+    IN  PXENNET_ADAPTER     Adapter
+    )
+{
+    ULONG val = (ULONG)Adapter->Properties.nblbatchmax;
+    if (val == 0 || val > NBL_BATCH_SIZE_MAX)
+        return NBL_BATCH_SIZE_DEFAULT;
+    return val;
+}
+
 PXENVIF_VIF_INTERFACE
 AdapterGetVifInterface(
     IN  PXENNET_ADAPTER     Adapter
@@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
     READ_PROPERTY(Adapter->Properties.need_csum_value, L"NeedChecksumValue", 1, Handle);
     READ_PROPERTY(Adapter->Properties.rss, L"*RSS", 1, Handle);
     READ_PROPERTY(Adapter->Properties.numrssqueues, L"*NumRSSQueues", 8, Handle);
+    READ_PROPERTY(Adapter->Properties.nblbatchmax, L"NblBatchMax", NBL_BATCH_SIZE_DEFAULT, Handle);
 
     NdisCloseConfiguration(Handle);
 
diff --git a/src/xennet/adapter.h b/src/xennet/adapter.h
index 2ea0345..a54cb4d 100644
--- a/src/xennet/adapter.h
+++ b/src/xennet/adapter.h
@@ -121,4 +121,12 @@ AdapterQueryInformation(
     IN  PNDIS_OID_REQUEST   Request
     );
 
+#define NBL_BATCH_SIZE_DEFAULT  32
+#define NBL_BATCH_SIZE_MAX      64
+
+extern ULONG
+AdapterGetNblMaxBatchSize(
+    IN  PXENNET_ADAPTER     Adapter
+    );
+
 #endif // _XENNET_ADAPTER_H_
diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index b4cf4f0..9df4192 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -34,6 +34,7 @@
 #include <procgrp.h>
 #include <tcpip.h>
 #include <xen.h>
+#include <ethernet.h>
 
 #include "util.h"
 #include "receiver.h"
@@ -64,6 +65,7 @@ struct _XENNET_RECEIVER {
 
 typedef struct _NET_BUFFER_LIST_RESERVED {
     PVOID   Cookie;
+    USHORT  EtherType;
 } NET_BUFFER_LIST_RESERVED, *PNET_BUFFER_LIST_RESERVED;
 
 C_ASSERT(sizeof (NET_BUFFER_LIST_RESERVED) <= RTL_FIELD_SIZE(NET_BUFFER_LIST, MiniportReserved));
@@ -120,6 +122,7 @@ __ReceiverAllocateNetBufferList(
     IN  PMDL                    Mdl,
     IN  ULONG                   Offset,
     IN  ULONG                   Length,
+    IN  PXENVIF_PACKET_INFO     Info,
     IN  PVOID                   Cookie
     )
 {
@@ -156,10 +159,25 @@ __ReceiverAllocateNetBufferList(
 
     if (NetBufferList != NULL) {
         PNET_BUFFER_LIST_RESERVED   ListReserved;
+        USHORT                      EtherType = 0;
+
+        if (Info->EthernetHeader.Length != 0) {
+            PUCHAR              Buffer;
+            PETHERNET_HEADER    EthernetHeader;
+
+            Buffer = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority | MdlMappingNoExecute);
+            if (Buffer != NULL) {
+                EthernetHeader = (PETHERNET_HEADER)(Buffer + Offset + Info->EthernetHeader.Offset);
+                EtherType = ETHERNET_HEADER_IS_TAGGED(EthernetHeader) ?
+                            EthernetHeader->Tagged.TypeOrLength :
+                            EthernetHeader->Untagged.TypeOrLength;
+            }
+        }
 
         ListReserved = (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPORT_RESERVED(NetBufferList);
         ASSERT3P(ListReserved->Cookie, ==, NULL);
         ListReserved->Cookie = Cookie;
+        ListReserved->EtherType = EtherType;
     }
 
     return NetBufferList;
@@ -178,6 +196,7 @@ __ReceiverReleaseNetBufferList(
     ListReserved = (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPORT_RESERVED(NetBufferList);
     Cookie = ListReserved->Cookie;
     ListReserved->Cookie = NULL;
+    ListReserved->EtherType = 0;
 
     if (Cache)
         __ReceiverPutNetBufferList(Receiver, NetBufferList);
@@ -240,12 +259,12 @@ __ReceiverReceivePacket(
     NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO   csumInfo;
 
     UNREFERENCED_PARAMETER(MaximumSegmentSize);
-    UNREFERENCED_PARAMETER(Info);
 
     NetBufferList = __ReceiverAllocateNetBufferList(Receiver,
                                                     Mdl,
                                                     Offset,
                                                     Length,
+                                                    Info,
                                                     Cookie);
     if (NetBufferList == NULL)
         goto fail1;
@@ -328,9 +347,11 @@ fail1:
     return NULL;
 }
 
-static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
+
+static FORCEINLINE VOID
+__IndicateReceiveNetBufferLists(
     IN  PXENNET_RECEIVER    Receiver,
-    IN  PNET_BUFFER_LIST    NetBufferLists,
+    IN  PNET_BUFFER_LIST    Remaining,
     IN  NDIS_PORT_NUMBER    PortNumber,
     IN  ULONG               NumberOfNetBufferLists,
     IN  ULONG               ReceiveFlags
@@ -339,39 +360,70 @@ static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
     PXENNET_ADAPTER         Adapter = Receiver->Adapter;
     NDIS_HANDLE             MiniportAdapterHandle = AdapterGetHandle(Adapter);
     PXENVIF_VIF_INTERFACE   VifInterface;
-    ULONG                   Count;
+    ULONG                   Count = 0;
+    ULONG                   NblMaxBatch = AdapterGetNblMaxBatchSize(Adapter);
+
+    while (Remaining != NULL) {
+        PNET_BUFFER_LIST    BatchTail = Remaining;
+        PNET_BUFFER_LIST    NextNbl;
+        ULONG               BatchCount = 1;
+        ULONG               BatchFlags;
+        USHORT              FirstEth;
+
+        FirstEth = ((PNET_BUFFER_LIST_RESERVED)
+                    NET_BUFFER_LIST_MINIPORT_RESERVED(Remaining))->EtherType;
+        NextNbl = NET_BUFFER_LIST_NEXT_NBL(BatchTail);
+
+        while (NextNbl != NULL && BatchCount < NblMaxBatch) {
+            USHORT  CurEth;
+            CurEth = ((PNET_BUFFER_LIST_RESERVED)
+                      NET_BUFFER_LIST_MINIPORT_RESERVED(NextNbl))->EtherType;
+            if (CurEth != FirstEth)
+                break;
+            BatchTail = NextNbl;
+            NextNbl = NET_BUFFER_LIST_NEXT_NBL(BatchTail);
+            BatchCount++;
+        }
 
-    VifInterface = AdapterGetVifInterface(Receiver->Adapter);
+        NET_BUFFER_LIST_NEXT_NBL(BatchTail) = NULL;
 
-    Count = 0;
-    while (NetBufferLists != NULL) {
-        PNET_BUFFER_LIST        Next;
-
-        Next = NET_BUFFER_LIST_NEXT_NBL(NetBufferLists);
-        NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) = NULL;
+        BatchFlags = ReceiveFlags;
+        if (FirstEth != 0)
+            BatchFlags |= NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
+        else
+            BatchFlags &= ~NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
 
         NdisMIndicateReceiveNetBufferLists(MiniportAdapterHandle,
-                                           NetBufferLists,
+                                           Remaining,
                                            PortNumber,
-                                           1,
-                                           ReceiveFlags);
+                                           BatchCount,
+                                           BatchFlags);
+
+        if (BatchFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
+            PNET_BUFFER_LIST    Current = Remaining;
+
+            VifInterface = AdapterGetVifInterface(Receiver->Adapter);
+
+            while (Current != NULL) {
+                PNET_BUFFER_LIST    Next = NET_BUFFER_LIST_NEXT_NBL(Current);
+                NET_BUFFER_LIST_NEXT_NBL(Current) = NULL;
 
-        if (ReceiveFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
-            PVOID   Cookie;
+                PVOID Cookie = __ReceiverReleaseNetBufferList(Receiver,
+                                                              Current,
+                                                              FALSE);
 
-            Cookie = __ReceiverReleaseNetBufferList(Receiver,
-                                                    NetBufferLists,
-                                                    FALSE);
+                XENVIF_VIF(ReceiverReturnPacket,
+                           VifInterface,
+                           Cookie);
 
-            XENVIF_VIF(ReceiverReturnPacket,
-                       VifInterface,
-                       Cookie);
+                Current = Next;
+            }
 
-            (VOID) InterlockedIncrement(&Receiver->Returned);
+            (VOID)InterlockedAdd(&Receiver->Returned, BatchCount);
         }
 
-        Count++;
-        NetBufferLists = Next;
+        Count += BatchCount;
+        Remaining = NextNbl;
     }
     ASSERT3U(Count, ==, NumberOfNetBufferLists);
 }
@@ -402,13 +454,11 @@ __ReceiverPushPackets(
 
     KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
 
-    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
+    if (Count == 0)
+        return;
 
     Returned = Receiver->Returned;
-
-    KeMemoryBarrier();
-
-    Indicated = Receiver->Indicated;
+    Indicated = InterlockedAdd(&Receiver->Indicated, Count);
 
     Flags = NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |
             NDIS_RECEIVE_FLAGS_PERFECT_FILTERED;
-- 
2.51.0.windows.1



From win-pv-devel-bounces@lists.xenproject.org Fri Sep 25 14:35:30 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 25 Sep 2026 14:35:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1434021.1654216 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1xA71N-0005C4-Ll; Fri, 25 Sep 2026 14:35:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1434021.1654216; Fri, 25 Sep 2026 14:35:29 +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 1xA71N-0005Bx-Iz; Fri, 25 Sep 2026 14:35:29 +0000
Received: by outflank-mailman (input) for mailman id 1434021;
 Fri, 25 Sep 2026 14:35:27 +0000
Received: from mx.expurgate.net ([194.145.224.10])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8fe16fa00072c4@swg.vates.tech>)
 id 1xA71L-0005Br-Eh
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 14:35:27 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1xA71K-0099gP-Re
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 16:35:26 +0200
Received: from [10.42.69.7] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8fe16fa00072c4@swg.vates.tech>)
 id 6ab686a8-bab6-0a2a0a5309dd-0a2a4507d11a-22
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:35:26 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8fe16fa00072c4@swg.vates.tech>)
 id 6ab686ae-b4ea-0a2a45070019-b9ff1c22a665-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:35:26 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0d8fe16fa00072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Fri, 25 Sep 2026 14:35:25 +0000
Received: from [192.168.1.121] (88-185-151-209.subs.proxad.net
 [88.185.151.209]) (Authenticated sender: cesaire.mounah@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 0C150823F1;
 Fri, 25 Sep 2026 16:35:25 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=RG7voni0MlqSvwPoRA+wfLWZ4wKlxYn58QzAjIsgFmI=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=l03SfpyHvcqeGO3aeheGC2TKskkgv6M8mvSh+mJq4zMZ0aQs/r/BOq0Vv5xG6AYvH0ulo/m8C
 pAFG36USbKAljoNI9a4sK11dNwCWtyBBiFzgDz4cuVhomL0wgIillUUUDY87PuUUWKOwjg8bwHS
 o2DFNX2VqO3PRYUju78mCBMTlaz+trl/40TpB6fSP8XUZAWwxMRLrL1Az53DqTVIS5WxjfXtpVa
 hcvX0mHFKS76Poog6pW84rkJnkwOhIvQwxKzmyr0eyNf3xp84EiorbuXCLL5/x/UQO/t9ximdaw
 atVHl3cGVz3rbAXVVXBAjF2XKW1k3xbkwHfJvprnbDSw==
X-Zone-Loop: 243d30f5bd0877a02eef48d6425b5433c0c659cfd71a
x-campaign-type: default
x-transaction-id: 53f04073-ed09-4ccc-b612-ba29690c0076
x-swg-uid: 01-024ea8f3-f762-407a-8837-8a97575f5e65
X-Mailer: Sweego
Message-ID:
 <1790346925.8631fc262581453bbf619ec5b2062170.1a0d8fe16fa00072c4@vates.tech>
x-swg-bid: 1790346925.8631fc262581453bbf619ec5b2062170.1a0d8fe16fa00072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 25 Sep 2026 16:35:24 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] xenvif: fix TX doorbell coalescing for ALGORITHM_NONE
 traffic
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260925135723.776-1-david.preetham@citrix.com>
 <20260925135723.776-2-david.preetham@citrix.com>
Content-Language: en-US
From: Mounah Honore Cesaire <cesaire.mounah@vates.tech>
In-Reply-To: <20260925135723.776-2-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.432.79de49573109e25b.1a0d8fe1443.a5c470f06d6bdda7=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1790346925123
X-purgate-ID: tlsNG-ef75cf/1790346926-35AC0AE4-D7D952DE/0/0
X-purgate-type: clean
X-purgate-size: 1937

---=Part.432.79de49573109e25b.1a0d8fe1443.a5c470f06d6bdda7=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


On 9/25/26 4:02 PM, david ambu wrote:
> Each NBL carries a single hash value covering all its NET_BUFFERs=2E
> All NB within the same NBL therefore map to the same TX ring, so the
> ring doorbell can be deferred across NB and fired once at the NBL
> boundary when More=3DFALSE=2E
>
> TransmitterQueuePacket was overriding More=3DFALSE unconditionally in
> the XENVIF_PACKET_HASH_ALGORITHM_NONE case, causing a ring kick on
> every individual NET_BUFFER instead of once per NBL=2E
>
> Removing the override lets the More flag from xennet flow through
> correctly, so ALGORITHM_NONE traffic gets the same per-NBL kick
> behaviour as ALGORITHM_TOEPLITZ=2E
>
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> Co-Authored-By: Claude Sonnet 4=2E6 <noreply@anthropic=2Ecom>
> ---
>   src/xenvif/transmitter=2Ec | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/src/xenvif/transmitter=2Ec b/src/xenvif/transmitter=2Ec
> index 8c4ee41=2E=2Ead58336 100644
> --- a/src/xenvif/transmitter=2Ec
> +++ b/src/xenvif/transmitter=2Ec
> @@ -5245,7 +5245,6 @@ TransmitterQueuePacket(
>       switch (Algorithm) {
>       case XENVIF_PACKET_HASH_ALGORITHM_NONE:
>           Value =3D __TransmitterHashPacket(Transmitter, Packet);
> -        More =3D FALSE;
>           break;
>  =20
>       case XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED:

Reviewed-by: C=C3=A9saire Mounah <cesaire=2Emounah@vates=2Etech>

--=20
C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates=2Etech



-- 
C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen=
 Orchestra - Vates solutions

web: https://vates=2Etech
---=Part.432.79de49573109e25b.1a0d8fe1443.a5c470f06d6bdda7=---


From win-pv-devel-bounces@lists.xenproject.org Fri Sep 25 14:36:13 2026
Return-path: <win-pv-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 25 Sep 2026 14:36:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.1434022.1654220 (Exim 4.92)
	(envelope-from <win-pv-devel-bounces@lists.xenproject.org>)
	id 1xA725-0005Gc-Qp; Fri, 25 Sep 2026 14:36:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 1434022.1654220; Fri, 25 Sep 2026 14:36:13 +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 1xA725-0005GV-OE; Fri, 25 Sep 2026 14:36:13 +0000
Received: by outflank-mailman (input) for mailman id 1434022;
 Fri, 25 Sep 2026 14:36:12 +0000
Received: from mx.expurgate.net ([195.190.135.20])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8febb6800072c4@swg.vates.tech>)
 id 1xA724-0005GP-Kh
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 14:36:12 +0000
Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp
 id 1xA723-003CRq-TO
 for win-pv-devel@lists.xenproject.org; Fri, 25 Sep 2026 16:36:11 +0200
Received: from [10.42.69.1] (helo=localhost)
 by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8febb6800072c4@swg.vates.tech>)
 id 6ab686c7-bab6-0a2a0a5309dd-0a2a45018dec-46
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:36:11 +0200
Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net)
 by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1)
 (envelope-from
 <prod-mta-13.8631fc262581453bbf619ec5b2062170.1a0d8febb6800072c4@swg.vates.tech>)
 id 6ab686db-5984-0a2a45010019-b9ff1c22a697-3
 for <win-pv-devel@lists.xenproject.org>; Fri, 25 Sep 2026 16:36:11 +0200
Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr)
 (Authenticated sender:
 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e)
 by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id
 1a0d8febb6800072c4.002 for <win-pv-devel@lists.xenproject.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Fri, 25 Sep 2026 14:36:07 +0000
Received: from [192.168.1.121] (88-185-151-209.subs.proxad.net
 [88.185.151.209]) (Authenticated sender: cesaire.mounah@vates.tech)
 by mail2.vates.fr (Postfix) with ESMTPSA id 013A4823E5;
 Fri, 25 Sep 2026 16:36:06 +0200 (CEST)
X-BeenThere: win-pv-devel@lists.xenproject.org
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
Precedence: list
Sender: "win-pv-devel" <win-pv-devel-bounces@lists.xenproject.org>
Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech;
 q=dns/txt; s=selector1; bh=pnj/8/gkptczyvq1VdaxMxkI/YvYPkBBtar+tLKxYcU=;
 h=from:subject:date:message-id:to:mime-version:content-type:in-reply-to:references:feedback-id;
 b=bXZrJXqxjazB4xXrKrKQsjTxjOtTXcw2N2lsc2I9loHVRBdH5gwNCBYCfq8RRFRK2d3cIt10k
 mW2aLYdMxK5YU7RQocKz4O+YLebhF0nsSubeDcmJplF//3UaJw9w1DzmEeWWOOZLIDwE/0Mit4B
 woTi3lpHfXWTQY7RdmYekj7Svr6g/VDGBuiJHyBrq4U0MQaTHHzZ4NJN3XjyxIsSTHDQqX1LZbR
 QW0xXsBm8ZGX/q5c0KbqnLAj1JH50/P7QScplOi5Q8NMLYaCU8t+Ez7p4HSmTceM1B5QWJ84S6I
 C86+8gTuc/i+8aTraPmgVQJmcoj1eBbtMHlQWPGj9hoA==
X-Zone-Loop: fa3c282b900fb8202d34323eb3522cdf0569938b9721
x-campaign-type: default
x-transaction-id: 1f0b6765-55ae-484d-a478-1e57e11da9ff
x-swg-uid: 01-09bfb277-d06e-46af-b9f8-7d687492929f
X-Mailer: Sweego
Message-ID:
 <1790346967.8631fc262581453bbf619ec5b2062170.1a0d8febb6800072c4@vates.tech>
x-swg-bid: 1790346967.8631fc262581453bbf619ec5b2062170.1a0d8febb6800072c4
Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego
x-campaign-id: default
x-client-id: 8631fc262581453bbf619ec5b2062170
X-Originating-IP: [37.26.189.201]
Date: Fri, 25 Sep 2026 16:36:06 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH] xennet: improve NBL batching receive path
To: david ambu <david.preetham@citrix.com>, win-pv-devel@lists.xenproject.org
References: <20260925135723.776-1-david.preetham@citrix.com>
 <20260925135723.776-3-david.preetham@citrix.com>
Content-Language: en-US
From: Mounah Honore Cesaire <cesaire.mounah@vates.tech>
In-Reply-To: <20260925135723.776-3-david.preetham@citrix.com>
X-BM-Disclaimer: Yes
Content-Type: multipart/alternative; boundary="-=Part.433.a6eaae3eb90a9142.1a0d8feb827.956f879a2c873bdf=-"
X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2
X-Bm-Transport-Timestamp: 1790346967079
X-purgate-ID: tlsNG-d62444/1790346971-1D272757-D1A085F0/0/0
X-purgate-type: clean
X-purgate-size: 12815

---=Part.433.a6eaae3eb90a9142.1a0d8feb827.956f879a2c873bdf=-
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


On 9/25/26 4:02 PM, david ambu wrote:
> Raise NblBatchMax default to 32 (max 64)=2E Split batches at EtherType
> boundaries and set NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE per batch=2E
>
> In __ReceiverPushPackets, sample Returned before the InterlockedAdd
> so it is read prior to the implicit full memory barrier that
> InterlockedAdd provides=2E Use the return value of InterlockedAdd
> directly as Indicated and remove the now-redundant KeMemoryBarrier=2E
>
> Return early when queue is empty=2E
>
> Signed-off-by: david ambu <david=2Epreetham@citrix=2Ecom>
> Co-Authored-By: Claude Sonnet 4=2E6 <noreply@anthropic=2Ecom>
> ---
>   src/xennet=2Einf        |   6 +++
>   src/xennet/adapter=2Ec  |  13 +++++
>   src/xennet/adapter=2Eh  |   8 +++
>   src/xennet/receiver=2Ec | 110 ++++++++++++++++++++++++++++++----------=
--
>   4 files changed, 107 insertions(+), 30 deletions(-)
>
> diff --git a/src/xennet=2Einf b/src/xennet=2Einf
> index 55e11a2=2E=2E79730e8 100644
> --- a/src/xennet=2Einf
> +++ b/src/xennet=2Einf
> @@ -186,6 +186,11 @@ HKR, Ndi\params\*NumRSSQueues,                    D=
efault,    0, "8"
>   HKR, Ndi\params\*NumRSSQueues,                    Min,        0, "1"
>   HKR, Ndi\params\*NumRSSQueues,                    Max,        0, "8"
>  =20
> +HKR, Ndi\Params\NblBatchMax, 			  		  ParamDesc,  0, %NblBatchMax%
> +HKR, Ndi\Params\NblBatchMax, 			  		  Type,       0, "int"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Default,    0, "32"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Min, 	      0, "1"
> +HKR, Ndi\Params\NblBatchMax, 			  		  Max, 	      0, "64"
>   [XenNet_Inst=2EServices]
>   AddService=3Dxennet,0x02,XenNet_Service,XenNet_EventLog
>  =20
> @@ -248,6 +253,7 @@ Enabled=3D"Enabled"
>   Enabled-Rx=3D"Rx Enabled"
>   Enabled-Tx=3D"Tx Enabled"
>   Enabled-TxRx=3D"Rx & Tx Enabled"
> +NblBatchMax=3D"Max Receive Indicate NBLS"
>  =20
>   SERVICE_BOOT_START=3D0x0
>   SERVICE_SYSTEM_START=3D0x1
> diff --git a/src/xennet/adapter=2Ec b/src/xennet/adapter=2Ec
> index f79c0c8=2E=2E6e5a95a 100644
> --- a/src/xennet/adapter=2Ec
> +++ b/src/xennet/adapter=2Ec
> @@ -63,6 +63,7 @@ typedef struct _PROPERTIES {
>       int lrov6;
>       int rss;
>       int numrssqueues;
> +    int nblbatchmax;
>   } PROPERTIES, *PPROPERTIES;
>  =20
>   typedef struct _XENNET_RSS {
> @@ -1480,6 +1481,17 @@ AdapterGetHandle(
>       return Adapter->NdisAdapterHandle;
>   }
>  =20
> +ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    )
> +{
> +    ULONG val =3D (ULONG)Adapter->Properties=2Enblbatchmax;
> +    if (val =3D=3D 0 || val > NBL_BATCH_SIZE_MAX)
> +        return NBL_BATCH_SIZE_DEFAULT;
> +    return val;
> +}
> +
>   PXENVIF_VIF_INTERFACE
>   AdapterGetVifInterface(
>       IN  PXENNET_ADAPTER     Adapter
> @@ -2939,6 +2951,7 @@ AdapterGetAdvancedSettings(
>       READ_PROPERTY(Adapter->Properties=2Eneed_csum_value, L"NeedChecksu=
mValue", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Erss, L"*RSS", 1, Handle);
>       READ_PROPERTY(Adapter->Properties=2Enumrssqueues, L"*NumRSSQueues"=
, 8, Handle);
> +    READ_PROPERTY(Adapter->Properties=2Enblbatchmax, L"NblBatchMax", NB=
L_BATCH_SIZE_DEFAULT, Handle);
>  =20
>       NdisCloseConfiguration(Handle);
>  =20
> diff --git a/src/xennet/adapter=2Eh b/src/xennet/adapter=2Eh
> index 2ea0345=2E=2Ea54cb4d 100644
> --- a/src/xennet/adapter=2Eh
> +++ b/src/xennet/adapter=2Eh
> @@ -121,4 +121,12 @@ AdapterQueryInformation(
>       IN  PNDIS_OID_REQUEST   Request
>       );
>  =20
> +#define NBL_BATCH_SIZE_DEFAULT  32
> +#define NBL_BATCH_SIZE_MAX      64
> +
> +extern ULONG
> +AdapterGetNblMaxBatchSize(
> +    IN  PXENNET_ADAPTER     Adapter
> +    );
> +
>   #endif // _XENNET_ADAPTER_H_
> diff --git a/src/xennet/receiver=2Ec b/src/xennet/receiver=2Ec
> index b4cf4f0=2E=2E9df4192 100644
> --- a/src/xennet/receiver=2Ec
> +++ b/src/xennet/receiver=2Ec
> @@ -34,6 +34,7 @@
>   #include <procgrp=2Eh>
>   #include <tcpip=2Eh>
>   #include <xen=2Eh>
> +#include <ethernet=2Eh>
>  =20
>   #include "util=2Eh"
>   #include "receiver=2Eh"
> @@ -64,6 +65,7 @@ struct _XENNET_RECEIVER {
>  =20
>   typedef struct _NET_BUFFER_LIST_RESERVED {
>       PVOID   Cookie;
> +    USHORT  EtherType;
>   } NET_BUFFER_LIST_RESERVED, *PNET_BUFFER_LIST_RESERVED;
>  =20
>   C_ASSERT(sizeof (NET_BUFFER_LIST_RESERVED) <=3D RTL_FIELD_SIZE(NET_BUF=
FER_LIST, MiniportReserved));
> @@ -120,6 +122,7 @@ __ReceiverAllocateNetBufferList(
>       IN  PMDL                    Mdl,
>       IN  ULONG                   Offset,
>       IN  ULONG                   Length,
> +    IN  PXENVIF_PACKET_INFO     Info,
>       IN  PVOID                   Cookie
>       )
>   {
> @@ -156,10 +159,25 @@ __ReceiverAllocateNetBufferList(
>  =20
>       if (NetBufferList !=3D NULL) {
>           PNET_BUFFER_LIST_RESERVED   ListReserved;
> +        USHORT                      EtherType =3D 0;
> +
> +        if (Info->EthernetHeader=2ELength !=3D 0) {
> +            PUCHAR              Buffer;
> +            PETHERNET_HEADER    EthernetHeader;
> +
> +            Buffer =3D MmGetSystemAddressForMdlSafe(Mdl, NormalPagePrio=
rity | MdlMappingNoExecute);
> +            if (Buffer !=3D NULL) {
> +                EthernetHeader =3D (PETHERNET_HEADER)(Buffer + Offset +=
 Info->EthernetHeader=2EOffset);
> +                EtherType =3D ETHERNET_HEADER_IS_TAGGED(EthernetHeader)=
 ?
> +                            EthernetHeader->Tagged=2ETypeOrLength :
> +                            EthernetHeader->Untagged=2ETypeOrLength;
> +            }
> +        }
>  =20
>           ListReserved =3D (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MI=
NIPORT_RESERVED(NetBufferList);
>           ASSERT3P(ListReserved->Cookie, =3D=3D, NULL);
>           ListReserved->Cookie =3D Cookie;
> +        ListReserved->EtherType =3D EtherType;
>       }
>  =20
>       return NetBufferList;
> @@ -178,6 +196,7 @@ __ReceiverReleaseNetBufferList(
>       ListReserved =3D (PNET_BUFFER_LIST_RESERVED)NET_BUFFER_LIST_MINIPO=
RT_RESERVED(NetBufferList);
>       Cookie =3D ListReserved->Cookie;
>       ListReserved->Cookie =3D NULL;
> +    ListReserved->EtherType =3D 0;
>  =20
>       if (Cache)
>           __ReceiverPutNetBufferList(Receiver, NetBufferList);
> @@ -240,12 +259,12 @@ __ReceiverReceivePacket(
>       NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO   csumInfo;
>  =20
>       UNREFERENCED_PARAMETER(MaximumSegmentSize);
> -    UNREFERENCED_PARAMETER(Info);
>  =20
>       NetBufferList =3D __ReceiverAllocateNetBufferList(Receiver,
>                                                       Mdl,
>                                                       Offset,
>                                                       Length,
> +                                                    Info,
>                                                       Cookie);
>       if (NetBufferList =3D=3D NULL)
>           goto fail1;
> @@ -328,9 +347,11 @@ fail1:
>       return NULL;
>   }
>  =20
> -static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
> +
> +static FORCEINLINE VOID
> +__IndicateReceiveNetBufferLists(
>       IN  PXENNET_RECEIVER    Receiver,
> -    IN  PNET_BUFFER_LIST    NetBufferLists,
> +    IN  PNET_BUFFER_LIST    Remaining,
>       IN  NDIS_PORT_NUMBER    PortNumber,
>       IN  ULONG               NumberOfNetBufferLists,
>       IN  ULONG               ReceiveFlags
> @@ -339,39 +360,70 @@ static FORCEINLINE VOID __IndicateReceiveNetBuffer=
Lists(
>       PXENNET_ADAPTER         Adapter =3D Receiver->Adapter;
>       NDIS_HANDLE             MiniportAdapterHandle =3D AdapterGetHandle=
(Adapter);
>       PXENVIF_VIF_INTERFACE   VifInterface;
> -    ULONG                   Count;
> +    ULONG                   Count =3D 0;
> +    ULONG                   NblMaxBatch =3D AdapterGetNblMaxBatchSize(A=
dapter);
> +
> +    while (Remaining !=3D NULL) {
> +        PNET_BUFFER_LIST    BatchTail =3D Remaining;
> +        PNET_BUFFER_LIST    NextNbl;
> +        ULONG               BatchCount =3D 1;
> +        ULONG               BatchFlags;
> +        USHORT              FirstEth;
> +
> +        FirstEth =3D ((PNET_BUFFER_LIST_RESERVED)
> +                    NET_BUFFER_LIST_MINIPORT_RESERVED(Remaining))->Ethe=
rType;
> +        NextNbl =3D NET_BUFFER_LIST_NEXT_NBL(BatchTail);
> +
> +        while (NextNbl !=3D NULL && BatchCount < NblMaxBatch) {
> +            USHORT  CurEth;
> +            CurEth =3D ((PNET_BUFFER_LIST_RESERVED)
> +                      NET_BUFFER_LIST_MINIPORT_RESERVED(NextNbl))->Ethe=
rType;
> +            if (CurEth !=3D FirstEth)
> +                break;
> +            BatchTail =3D NextNbl;
> +            NextNbl =3D NET_BUFFER_LIST_NEXT_NBL(BatchTail);
> +            BatchCount++;
> +        }
>  =20
> -    VifInterface =3D AdapterGetVifInterface(Receiver->Adapter);
> +        NET_BUFFER_LIST_NEXT_NBL(BatchTail) =3D NULL;
>  =20
> -    Count =3D 0;
> -    while (NetBufferLists !=3D NULL) {
> -        PNET_BUFFER_LIST        Next;
> -
> -        Next =3D NET_BUFFER_LIST_NEXT_NBL(NetBufferLists);
> -        NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) =3D NULL;
> +        BatchFlags =3D ReceiveFlags;
> +        if (FirstEth !=3D 0)
> +            BatchFlags |=3D NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
> +        else
> +            BatchFlags &=3D ~NDIS_RECEIVE_FLAGS_SINGLE_ETHER_TYPE;
>  =20
>           NdisMIndicateReceiveNetBufferLists(MiniportAdapterHandle,
> -                                           NetBufferLists,
> +                                           Remaining,
>                                              PortNumber,
> -                                           1,
> -                                           ReceiveFlags);
> +                                           BatchCount,
> +                                           BatchFlags);
> +
> +        if (BatchFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
> +            PNET_BUFFER_LIST    Current =3D Remaining;
> +
> +            VifInterface =3D AdapterGetVifInterface(Receiver->Adapter);
> +
> +            while (Current !=3D NULL) {
> +                PNET_BUFFER_LIST    Next =3D NET_BUFFER_LIST_NEXT_NBL(C=
urrent);
> +                NET_BUFFER_LIST_NEXT_NBL(Current) =3D NULL;
>  =20
> -        if (ReceiveFlags & NDIS_RECEIVE_FLAGS_RESOURCES) {
> -            PVOID   Cookie;
> +                PVOID Cookie =3D __ReceiverReleaseNetBufferList(Receive=
r,
> +                                                              Current,
> +                                                              FALSE);
>  =20
> -            Cookie =3D __ReceiverReleaseNetBufferList(Receiver,
> -                                                    NetBufferLists,
> -                                                    FALSE);
> +                XENVIF_VIF(ReceiverReturnPacket,
> +                           VifInterface,
> +                           Cookie);
>  =20
> -            XENVIF_VIF(ReceiverReturnPacket,
> -                       VifInterface,
> -                       Cookie);
> +                Current =3D Next;
> +            }
>  =20
> -            (VOID) InterlockedIncrement(&Receiver->Returned);
> +            (VOID)InterlockedAdd(&Receiver->Returned, BatchCount);
>           }
>  =20
> -        Count++;
> -        NetBufferLists =3D Next;
> +        Count +=3D BatchCount;
> +        Remaining =3D NextNbl;
>       }
>       ASSERT3U(Count, =3D=3D, NumberOfNetBufferLists);
>   }
> @@ -402,13 +454,11 @@ __ReceiverPushPackets(
>  =20
>       KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
>  =20
> -    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
> +    if (Count =3D=3D 0)
> +        return;
>  =20
>       Returned =3D Receiver->Returned;
> -
> -    KeMemoryBarrier();
> -
> -    Indicated =3D Receiver->Indicated;
> +    Indicated =3D InterlockedAdd(&Receiver->Indicated, Count);
>  =20
>       Flags =3D NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |
>               NDIS_RECEIVE_FLAGS_PERFECT_FILTERED;

Reviewed-by: C=C3=A9saire Mounah <cesaire=2Emounah@vates=2Etech>

--=20
C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates=2Etech



-- 
C=C3=A9saire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen=
 Orchestra - Vates solutions

web: https://vates=2Etech
---=Part.433.a6eaae3eb90a9142.1a0d8feb827.956f879a2c873bdf=---


