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

Re: [win-pv-devel] [PATCH] Add registry overrides for features (v2)



Hello.

What is difference between this patch
 "HKLM\System\CCS\Services\XenVbd\Parameters" "feature-discard" 0
  will prevent the frontend issuing BLKIF_OP_DISCARDs

and patch 76ac7c5 ?
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\xenvbd\Parameters]
"InterceptTrim"=dword:00000000

Thanks, Martin Cerveny

On Fri, 3 Feb 2017, Paul Durrant wrote:

-----Original Message-----
From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
Behalf Of Paul Durrant
Sent: 03 February 2017 12:42
To: Owen Smith <owen.smith@xxxxxxxxxx>; win-pv-
devel@xxxxxxxxxxxxxxxxxxxx
Cc: Owen Smith <owen.smith@xxxxxxxxxx>
Subject: Re: [win-pv-devel] [PATCH] Add registry overrides for features (v2)

-----Original Message-----
From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx]
On
Behalf Of owen.smith@xxxxxxxxxx
Sent: 03 February 2017 12:39
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Owen Smith <owen.smith@xxxxxxxxxx>
Subject: [win-pv-devel] [PATCH] Add registry overrides for features (v2)

From: Owen Smith <owen.smith@xxxxxxxxxx>

* Add a REG_DWORD to XenVbd's Parameters key, with names based
  on the features, as per xenstore value, and set to 0 to
  override use of that feature.

Changes over v1:
* removed check on DriverGerParametersKey() return value, as its
  guaranteed to be valid (failure to get the key results in
  DriverEntry failing)

For example,
 "HKLM\System\CCS\Services\XenVbd\Parameters" "feature-barrier" 0
  will prevent the frontend issuing BLKIF_OP_WRITE_BARRIERs
 "HKLM\System\CCS\Services\XenVbd\Parameters" "feature-discard" 0
  will prevent the frontend issuing BLKIF_OP_DISCARDs

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

LGTM.

Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>


Now that it has built I'm also going to cherry-pick this back onto staging-8.2 
as it should be very useful.

 Paul

---
 src/xenvbd/driver.c   | 16 ++++++++++++++++
 src/xenvbd/driver.h   |  5 +++++
 src/xenvbd/frontend.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c
index 114c740..1f713c4 100644
--- a/src/xenvbd/driver.c
+++ b/src/xenvbd/driver.c
@@ -82,6 +82,22 @@ __DriverParseOption(
     RegistryFreeSzValue(Option);
 }

+static FORCEINLINE HANDLE
+__DriverGetParametersKey(
+    VOID
+    )
+{
+    return Driver.ParametersKey;
+}
+
+HANDLE
+DriverGetParametersKey(
+    VOID
+    )
+{
+    return __DriverGetParametersKey();
+}
+
 NTSTATUS
 DriverDispatchPnp(
     IN  PDEVICE_OBJECT  DeviceObject,
diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h
index cf55330..e7730a9 100644
--- a/src/xenvbd/driver.h
+++ b/src/xenvbd/driver.h
@@ -57,6 +57,11 @@ typedef struct _XENVBD_PARAMETERS {

 extern XENVBD_PARAMETERS    DriverParameters;

+extern HANDLE
+DriverGetParametersKey(
+    VOID
+    );
+
 extern NTSTATUS
 DriverDispatchPnp(
     IN  PDEVICE_OBJECT  DeviceObject,
diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
index 11e9121..e65a3b0 100644
--- a/src/xenvbd/frontend.c
+++ b/src/xenvbd/frontend.c
@@ -30,6 +30,7 @@
  */

 #include "frontend.h"
+#include "registry.h"
 #include "driver.h"
 #include "fdo.h"
 #include "pdoinquiry.h"
@@ -621,6 +622,7 @@ FrontendReadFeature(
 {
     NTSTATUS        status;
     PCHAR           Buffer;
+    ULONG           Override;
     BOOLEAN         Old = *Value;

     status = XENBUS_STORE(Read,
@@ -637,6 +639,15 @@ FrontendReadFeature(
                     Frontend->Store,
                     Buffer);

+    // check registry for disable-override
+    status = RegistryQueryDwordValue(DriverGetParametersKey(),
+                                    Name,
+                                    &Override);
+    if (NT_SUCCESS(status)) {
+        if (Override == 0)
+            *Value = FALSE;
+    }
+
     return Old != *Value;
 }

@@ -644,11 +655,13 @@ static FORCEINLINE BOOLEAN
 FrontendReadValue32(
     IN  PXENVBD_FRONTEND            Frontend,
     IN  PCHAR                       Name,
+    IN  BOOLEAN                     AllowOverride,
     IN  PULONG                      Value
     )
 {
     NTSTATUS        status;
     PCHAR           Buffer;
+    ULONG           Override;
     ULONG           Old = *Value;

     status = XENBUS_STORE(Read,
@@ -665,6 +678,16 @@ FrontendReadValue32(
                     Frontend->Store,
                     Buffer);

+    // check registry for disable-override
+    if (AllowOverride) {
+        status = RegistryQueryDwordValue(DriverGetParametersKey(),
+                                        Name,
+                                        &Override);
+        if (NT_SUCCESS(status)) {
+            *Value = Override;
+        }
+    }
+
     return Old != *Value;
 }

@@ -727,12 +750,15 @@ __ReadDiskInfo(

     Changed |= FrontendReadValue32(Frontend,
                                   "info",
+                                  FALSE,
                                   &Frontend->DiskInfo.DiskInfo);
     Changed |= FrontendReadValue32(Frontend,
                                   "sector-size",
+                                  FALSE,
                                   &Frontend->DiskInfo.SectorSize);
     Changed |= FrontendReadValue32(Frontend,
                                   "physical-sector-size",
+                                  FALSE,
                                   &Frontend->DiskInfo.PhysSectorSize);
     Changed |= FrontendReadValue64(Frontend,
                                   "sectors",
@@ -780,6 +806,7 @@ FrontendReadFeatures(
                                    &Frontend->Caps.Removable);
     Changed |= FrontendReadValue32(Frontend,
                                    "feature-max-indirect-segments",
+                                   TRUE,
                                    &Frontend->Features.Indirect);
     Changed |= FrontendReadFeature(Frontend,
                                    "feature-persistent",
@@ -821,9 +848,11 @@ FrontendReadDiskInfo(
                                    &Frontend->DiskInfo.DiscardSecure);
     Changed |= FrontendReadValue32(Frontend,
                                    "discard-alignment",
+                                   TRUE,
                                    &Frontend->DiskInfo.DiscardAlignment);
     Changed |= FrontendReadValue32(Frontend,
                                    "discard-granularity",
+                                   TRUE,
                                    &Frontend->DiskInfo.DiscardGranularity);

     if (!Changed)
--
2.8.3


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


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