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

[win-pv-devel] [PATCH 3/5] Add override for MaxRingPageOrder



From: Owen Smith <owen.smith@xxxxxxxxxx>

Allow a Windows admin to limit the ring page count without
affecting any other VMs on the host. The override can be used
to restrict blkback's generous 16 page ring to a smaller value.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/driver.c |  3 ++-
 src/xenvbd/driver.h |  1 +
 src/xenvbd/ring.c   | 12 ++++++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c
index e7a3d3a..59b380c 100644
--- a/src/xenvbd/driver.c
+++ b/src/xenvbd/driver.c
@@ -266,7 +266,8 @@ __DriverInitializeOverrides(
               { "discard-enable", FeatureDiscardEnable },
               { "discard-secure", FeatureDiscardSecure },
               { "discard-alignment", FeatureDiscardAlignment },
-              { "discard-granularity", FeatureDiscardGranularity }
+              { "discard-granularity", FeatureDiscardGranularity },
+              { "max-ring-page-order", FeatureMaxRingPageOrder }
           };
 
     for (Index = 0; Index < ARRAYSIZE(Mapping); Index++) {
diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h
index 940968e..d99c09a 100644
--- a/src/xenvbd/driver.h
+++ b/src/xenvbd/driver.h
@@ -79,6 +79,7 @@ typedef enum _XENVBD_FEATURE {
     FeatureDiscardSecure,
     FeatureDiscardAlignment,
     FeatureDiscardGranularity,
+    FeatureMaxRingPageOrder,
 
     // Add any new features before this enum
     NumberOfFeatures
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 77eee54..033975b 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -1711,9 +1711,17 @@ RingConnect(
                           "max-ring-page-order",
                           &Buffer);
     if (NT_SUCCESS(status)) {
+        ULONG           MaxOrder;
+
+        if (DriverGetFeatureOverride(FeatureMaxRingPageOrder,
+                                     &MaxOrder)) {
+            MaxOrder = min(MaxOrder, XENVBD_MAX_RING_PAGE_ORDER);
+        } else {
+            MaxOrder = XENVBD_MAX_RING_PAGE_ORDER;
+        }
+
         Ring->Order = strtoul(Buffer, NULL, 10);
-        if (Ring->Order > XENVBD_MAX_RING_PAGE_ORDER)
-            Ring->Order = XENVBD_MAX_RING_PAGE_ORDER;
+        Ring->Order = min(Ring->Order, MaxOrder);
 
         XENBUS_STORE(Free,
                      &Ring->StoreInterface,
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

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