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

[PATCH] Set SkipBytes to 0 for contiguous allocations


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Tue, 13 Oct 2026 13:57:50 +0200
  • 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"
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Delivery-date: Tue, 13 Oct 2026 11:58:04 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

MmAllocatePagesForMdlEx requires that for contiguous allocations, if
MM_ALLOCATE_REQUIRE_CONTIGUOUS_CHUNKS is set and SkipBytes is nonzero,
then SkipBytes must be a power of two. Setting SkipBytes here is
unnecessary as contiguous allocations are still possible with SkipBytes
set to 0 anyway.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
To be applied to XenCons, XenHid, XenIface and XenNet as well.
---
 src/common/util.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/common/util.h b/src/common/util.h
index 36f71f9..9709a10 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -201,13 +201,12 @@ __AllocatePages(

     LowAddress.QuadPart = 0ull;
     HighAddress.QuadPart = ~0ull;
+    SkipBytes.QuadPart = 0ull;
     TotalBytes = (SIZE_T)PAGE_SIZE * Count;

     if (Contiguous) {
-        SkipBytes.QuadPart = TotalBytes;
         Flags = MM_ALLOCATE_REQUIRE_CONTIGUOUS_CHUNKS;
     } else {
-        SkipBytes.QuadPart = 0ull;
         Flags = MM_ALLOCATE_FULLY_REQUIRED;
     }

--
2.55.0.windows.3


--
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®.