[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 00/11] Defer completion and ring destruction until backend grant release


  • To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Tue, 10 Nov 2026 11:07:43 +0000
  • Accept-language: en-GB, en-US
  • 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
  • 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=ECZBJnToGsqyZmBJ2Lba8siIvkk0SthIg/OlOW56Go0=; b=hVtfgISqRoEweNy0hQb0TDXOB9WIPgw6mcIRyMryJtuBrkBofKUS35LVXCIjy2CuUD3pRSU+4k6wmFQNK45vgTZk88G3iw6yeL4E6ONixRHsg9nVmVIWaAkz79CKEYnF8GFmHsDcI+yrO9tE8va5/PvxwDRenBBIr3Igxw/Q1d+w7ki7l3Eykf5FUbkBK0yr/pD4M9hrntIRemkcleRQyRNMgO5qYTLu4DMyh5kV13MO1wiVU0c/kH1Ucg2PdvJak0gfi7PxTLBpffca5Y5GtSBQLwLxycJaxQf2VPxGmZJ7ur2J5t/MqXHMHmZC5ncYVQ6zAFCXTaiiI1ByrhD7bw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R55r0P/lG6Pp2aGKG7qSjdbciBtYEgyrG4igwWpLZzseUEhrLCPNWnm9k7sEWx5OzUwOFBImY/YDHwu1jCGJpW83c8iZmldg6cMB/nBP63lJ7sLXtKUYvsTNNSV9Bj8n2BTC11UiHje0TJS+GHyc6fVkjwZCfMUblXk22in0DW+8mK4qZUcb7Jew98x+bECgNhaOWwtRPfKlMKNXugP5YcejRXPiwLl0e/uDrVHEDgaqTAHIUULgRxS/l1A7AkLblTf9Yf13NNXYJQgq7RXOnnX//aJTYxb8yPd1XKr8iPqxAV6ywcEfKYH8dMR9AlqXPkL9ox7TIGvpzlhDyRxvrA==
  • 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"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Delivery-date: Tue, 10 Nov 2026 11:07:51 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdarw6EblYexKvoUC0qmVS6nLsoLcnMAO5
  • Thread-topic: [PATCH v3 00/11] Defer completion and ring destruction until backend grant release

These patches look broadly good. AI has suggested a few potential issues;
* RingD0ToD3 can block until a 0x9F bugcheck is triggered - this looks 
intentional here
* BlkifRingDisconnect could get into a state where grants are reused 
incorrectly - Linux
  blkback stopping threads on Closing prevents this
* BlkifRingTryPutRequest / GranterTryPut could race with backend clearing 
flags, leading to
  the SRB completion being delayed - adding a small retry loop here, similar to 
the previous
  revoke, could avoid this in most cases (I dont know how often this would 
happen, this would
  need further investigation, and can be a later patch)
* BlkifRingReclaim stops at the first failure, even when later requests could 
be reclaimed - improving
  this could be a later patch

In general, the 11 xenvbd and 1 xenbus patches: Reviewed-by: Owen Smith 
<owen.smith@xxxxxxxxxx>

________________________________________
From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> on behalf of Tu 
Dinh <ngoc-tu.dinh@xxxxxxxxxx>
Sent: 02 November 2026 11:20 AM
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Tu Dinh
Subject: [PATCH v3 00/11] Defer completion and ring destruction until backend 
grant release

When a backend is accessing a grant entry, it'll set the GTF_reading|
GTF_writing bits on that entry. RevokeForeignAccess will fail as long as
these bits are still set.

WinPV drivers assume that you can ignore RevokeForeignAccess failures
after a certain number of retries. This is unfortunately not the case,
as backends can still access the grants and corrupt things. We've
observed data corruption that we suspect as being caused by this issue.

This series converts RevokeForeignAccess into a fallible call named
TryRevokeForeignAccess, and fixes the problem by deferring request
completion and ring destruction until after the corresponding grants
have been released by the backend.

It has undergone testing using a harness for suspending I/O handling at
critical points, and showed no deadlock or data corruption when the
associated issues in tapdisk are fixed.

This is the first series of fix for a class of similar issues. Further
fixes will be needed in other drivers using the grant interface (esp.
XenVif, XenIface); there are also other issues that have not been
discussed in this series.

Changes in v3:
* Try harder to release existing grants before deferring a request
* Add yet another fix to defer faking submitted requests until
  disconnect

Changes in V2:
* Rename RevokeForeignAccess in GNTTAB V5 to TryRevokeForeignAccess
* Fix a deadlock during RingD0ToD3 (see the "ring: Defer destruction
  until backend grant release" commit for more details)
* Add a fix for a C6387 warning in BlkifRing

Tu Dinh (11):
  ring: Fix warning C6387: 'BlkifRing' could be '0'
  granter: Correct the accounting of Current
  Use GNTTAB_INTERFACE_V5
  frontend: Initialize the granter before the ring
  granter: Split GranterTryPut to its own function
  granter: Decouple cache lifetime from Connected
  granter: Introduce GranterD0ToD3/D3ToD0
  ring: Introduce RingD3ToD0/RingD0ToD3
  ring: Defer destruction until backend grant release
  ring: Defer request completion until backend grant release
  ring: Defer faking submitted requests until disconnect

 include/gnttab_interface.h | 116 ++++--
 src/xenvbd.inf             |   6 +-
 src/xenvbd/frontend.c      |  63 ++--
 src/xenvbd/frontend.h      |   4 +-
 src/xenvbd/granter.c       | 177 +++++++--
 src/xenvbd/granter.h       |  17 +-
 src/xenvbd/ring.c          | 737 ++++++++++++++++++++++++++++++-------
 src/xenvbd/ring.h          |  13 +
 8 files changed, 887 insertions(+), 246 deletions(-)

--
2.56.0.windows.4


--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.