fb53ca5547
libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch qemu-xen-upstream-qdisk-cache-unsafe.patch - libxl: introduce an option for disabling the non-O_DIRECT workaround recognize direct-io-safe in domU.cfg diskspec libxl.introduce-an-option-to-disable-the-non-O_DIRECT-workaround.patch - fate#316071: add discard support for file backed storage (qdisk) update patch to allow more values in overloaded ->readwrite member - bnc#826717 - VUL-0: CVE-2013-3495: XSA-59: xen: Intel VT-d Interrupt Remapping engines can be evaded by native NMI interrupts 537b5e50-VT-d-apply-quirks-at-device-setup-time-rather-than-only-at-boot.patch 537b5e79-VT-d-extend-error-report-masking-workaround-to-newer-chipsets.patch - Upstream patches from Jan 53709b77-Nested-VMX-load-current_vmcs-only-when-it-exists.patch 53732f4f-x86-MCE-bypass-uninitialized-vcpu-in-vMCE-injection.patch 537b5ede-move-domain-to-cpupool0-before-destroying-it.patch - Update README.SuSE with information on the toolstack change - fate#316071: add discard support for file backed storage (qdisk) update to recognize option discard/no-discard instead of discard=0,1 to match upstream change OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=316
131 lines
5.5 KiB
Diff
131 lines
5.5 KiB
Diff
References: FATE#316071
|
|
Subject: libxl: add option for discard support to xl disk configuration
|
|
|
|
Handle new boolean option discard/no-discard for disk configuration. It
|
|
is supposed to disable discard support if file based backing storage was
|
|
intentionally created non-sparse to avoid fragmentation of the file.
|
|
|
|
The option intended for the backend driver. A new boolean property
|
|
"discard-enable" is written to the backend node. An upcoming patch for
|
|
qemu will make use of this property. The kernel blkback driver may be
|
|
updated as well to disable discard for phy based backing storage.
|
|
|
|
This change does not break ABI. Instead of adding a new member
|
|
discard_enable to struct libxl_device_disk the existing readwrite member
|
|
is reused.
|
|
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
|
---
|
|
docs/misc/xl-disk-configuration.txt | 17 +++++++++++++++++
|
|
tools/libxl/libxl.c | 2 ++
|
|
tools/libxl/libxl.h | 12 ++++++++++++
|
|
tools/libxl/libxlu_disk.c | 3 +++
|
|
tools/libxl/libxlu_disk_i.h | 2 +-
|
|
tools/libxl/libxlu_disk_l.l | 2 ++
|
|
6 files changed, 37 insertions(+), 1 deletion(-)
|
|
|
|
Index: xen-4.4.0-testing/docs/misc/xl-disk-configuration.txt
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/docs/misc/xl-disk-configuration.txt
|
|
+++ xen-4.4.0-testing/docs/misc/xl-disk-configuration.txt
|
|
@@ -179,6 +179,23 @@ These scripts are normally called "block
|
|
|
|
|
|
|
|
+discard / no-discard
|
|
+---------------
|
|
+
|
|
+Description: Request backend to advertise discard support to frontend
|
|
+Supported values: discard
|
|
+ no-discard
|
|
+Mandatory: No
|
|
+Default value: discard
|
|
+
|
|
+An advisory setting for the backend driver, specifying whether, to
|
|
+advertise discard support (TRIM, UNMAP) to the frontend. The real
|
|
+benefit of this option is to be able to force it off rather than on. It
|
|
+can be used to disable "hole punching" for file based backends which
|
|
+were intentionally created non-sparse to avoid fragmentation of the
|
|
+file.
|
|
+
|
|
+
|
|
============================================
|
|
DEPRECATED PARAMETERS, PREFIXES AND SYNTAXES
|
|
============================================
|
|
Index: xen-4.4.0-testing/tools/libxl/libxl.c
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/tools/libxl/libxl.c
|
|
+++ xen-4.4.0-testing/tools/libxl/libxl.c
|
|
@@ -2480,6 +2480,8 @@ static void device_disk_add(libxl__egc *
|
|
flexarray_append(back, disk->readwrite ? "w" : "r");
|
|
flexarray_append(back, "device-type");
|
|
flexarray_append(back, disk->is_cdrom ? "cdrom" : "disk");
|
|
+ if ((disk->readwrite & ~LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MASK) == LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MAGIC)
|
|
+ flexarray_append_pair(back, "discard-enable", "0");
|
|
|
|
flexarray_append(front, "backend-id");
|
|
flexarray_append(front, libxl__sprintf(gc, "%d", disk->backend_domid));
|
|
Index: xen-4.4.0-testing/tools/libxl/libxl.h
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/tools/libxl/libxl.h
|
|
+++ xen-4.4.0-testing/tools/libxl/libxl.h
|
|
@@ -95,6 +95,18 @@
|
|
#define LIBXL_HAVE_BUILDINFO_EVENT_CHANNELS 1
|
|
|
|
/*
|
|
+ * The libxl_device_disk lacks discard_enable field, disabling discard
|
|
+ * is supported without breaking the ABI. This is done by overloading
|
|
+ * struct libxl_device_disk->readwrite:
|
|
+ * readwrite == 0: disk is readonly, no discard
|
|
+ * readwrite == 1: disk is readwrite, backend driver may enable discard
|
|
+ * readwrite == MAGIC: disk is readwrite, backend driver should not offer
|
|
+ * discard to the frontend driver.
|
|
+ */
|
|
+#define LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MAGIC 0x00000060U
|
|
+#define LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MASK 0xffffff0fU
|
|
+
|
|
+/*
|
|
* libxl ABI compatibility
|
|
*
|
|
* The only guarantee which libxl makes regarding ABI compatibility
|
|
Index: xen-4.4.0-testing/tools/libxl/libxlu_disk.c
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/tools/libxl/libxlu_disk.c
|
|
+++ xen-4.4.0-testing/tools/libxl/libxlu_disk.c
|
|
@@ -80,6 +80,9 @@ int xlu_disk_parse(XLU_Config *cfg,
|
|
disk->format = LIBXL_DISK_FORMAT_EMPTY;
|
|
}
|
|
|
|
+ if (disk->readwrite && dpc.disable_discard)
|
|
+ disk->readwrite = (disk->readwrite & LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MASK) | LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_DISABLE_MAGIC;
|
|
+
|
|
if (!disk->vdev) {
|
|
xlu__disk_err(&dpc,0, "no vdev specified");
|
|
goto x_err;
|
|
Index: xen-4.4.0-testing/tools/libxl/libxlu_disk_i.h
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/tools/libxl/libxlu_disk_i.h
|
|
+++ xen-4.4.0-testing/tools/libxl/libxlu_disk_i.h
|
|
@@ -10,7 +10,7 @@ typedef struct {
|
|
void *scanner;
|
|
YY_BUFFER_STATE buf;
|
|
libxl_device_disk *disk;
|
|
- int access_set, had_depr_prefix;
|
|
+ int access_set, disable_discard, had_depr_prefix;
|
|
const char *spec;
|
|
} DiskParseContext;
|
|
|
|
Index: xen-4.4.0-testing/tools/libxl/libxlu_disk_l.l
|
|
===================================================================
|
|
--- xen-4.4.0-testing.orig/tools/libxl/libxlu_disk_l.l
|
|
+++ xen-4.4.0-testing/tools/libxl/libxlu_disk_l.l
|
|
@@ -173,6 +173,8 @@ backendtype=[^,]*,? { STRIP(','); setbac
|
|
|
|
vdev=[^,]*,? { STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
|
|
script=[^,]*,? { STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
|
|
+discard,? { DPC->disable_discard = 0; }
|
|
+no-discard,? { DPC->disable_discard = 1; }
|
|
|
|
/* the target magic parameter, eats the rest of the string */
|
|
|