Skip to contentSkip to conversation

libxl: add option for discard support to xl disk configuration

PATCH In review Olaf Hering 3 participants 9 messages May 19, 2014 – Jun 17, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 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.

v6:
adjust wording of Descrption in xl-disk-configuration.txt
v5:
replace option discard=0|1 with boolean discard/no-discard
adjust wording in xl-disk-configuration.txt and blkif.h
call libxl_defbool_setdefault directly
adjust linewarapping in device_disk_add
v4:
rebase ontop of commit 6ec48cf4 (direct_io_safe)
rebase ontop of fixup commit for 6ec48cf4 (direct_io_safe)
add testcases to tools/libxl/check-xl-disk-parse
v3:
enable discard unconditionally by always writing discard-enable=1 to xenstore fix typos in xl-disk-configuration.txt
update description in blkif.h, property should be ignored if unsupported v2:
rename xenstore property from discard_enable to discard-enable update description in xl-disk-configuration.txt
use libxl_defbool as type for discard_enable
update check-xl-disk-parse to use "<default>"
add LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE to libxl.h

---

Please rerun bison/flex due to changes to .l files Also note the change to the .idl file

 docs/misc/xl-disk-configuration.txt | 17 ++++++++
 tools/libxl/check-xl-disk-parse     | 80 +++++++++++++++++++++++++++++++++----
 tools/libxl/libxl.c                 |  3 ++
 tools/libxl/libxl.h                 |  5 +++
 tools/libxl/libxl_types.idl         |  1 +
 tools/libxl/libxlu_disk.c           |  1 +
 tools/libxl/libxlu_disk_l.l         |  2 +
 xen/include/public/io/blkif.h       | 10 +++++
 8 files changed, 112 insertions(+), 7 deletions(-)
docs/misc/xl-disk-configuration.txt +17 -0
index 11fee9a..41ff55e 100644
@@ -217,6 +217,23 @@ If in the future the bug is fixed properly this option will then be
 silently ignored.
 
 
+discard / no-discard
+---------------
+
+Description:           Request that backend 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
 ============================================
tools/libxl/check-xl-disk-parse +73 -7

126 lines not on this page · raw message

tools/libxl/libxl.c +3 -0
index d59ce0c..4ea7abb 100644
@@ -2209,6 +2209,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
             flexarray_append(back, "direct-io-safe");
             flexarray_append(back, "1");
         }
+        flexarray_append_pair(back, "discard-enable",
+                              libxl_defbool_val(disk->discard_enable) ?
+                              "1" : "0");
 
         flexarray_append(front, "backend-id");
         flexarray_append(front, libxl__sprintf(gc, "%d", disk->backend_domid));
tools/libxl/libxl.h +5 -0
index 84f9c0e..c7aa817 100644
@@ -102,6 +102,11 @@
 #define LIBXL_HAVE_DEVICE_DISK_DIRECT_IO_SAFE 1
 
 /*
+ * The libxl_device_disk has the discard_enable field.
+ */
+#define LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE 1
+
+/*
  * libxl ABI compatibility
  *
  * The only guarantee which libxl makes regarding ABI compatibility
tools/libxl/libxl_types.idl +1 -0
index 8944686..52f1aa9 100644
@@ -417,6 +417,7 @@ libxl_device_disk = Struct("device_disk", [
     ("readwrite", integer),
     ("is_cdrom", integer),
     ("direct_io_safe", bool),
+    ("discard_enable", libxl_defbool),
     ])
 
 libxl_device_nic = Struct("device_nic", [
tools/libxl/libxlu_disk.c +1 -0
index 18fe386..752a2c7 100644
@@ -79,6 +79,7 @@ int xlu_disk_parse(XLU_Config *cfg,
         if (!disk->pdev_path || !strcmp(disk->pdev_path, ""))
             disk->format = LIBXL_DISK_FORMAT_EMPTY;
     }
+    libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
 
     if (!disk->vdev) {
         xlu__disk_err(&dpc,0, "no vdev specified");
tools/libxl/libxlu_disk_l.l +2 -0
index ba8577c..1a5deb5 100644
@@ -174,6 +174,8 @@ backendtype=[^,]*,? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
 direct-io-safe,? { DPC->disk->direct_io_safe = 1; }
+discard,?	{ libxl_defbool_set(&DPC->disk->discard_enable, true); }
+no-discard,?	{ libxl_defbool_set(&DPC->disk->discard_enable, false); }
 
  /* the target magic parameter, eats the rest of the string */
 
xen/include/public/io/blkif.h +10 -0
index 1e7cea9..6baf7fb 100644
@@ -197,6 +197,16 @@
  *
  *------------------------- Backend Device Properties -------------------------
  *
+ * discard-enable
+ *      Values:         0/1 (boolean)
+ *      Default Value:  1
+ *
+ *      This optional property, set by the toolstack, instructs the backend
+ *      to offer discard to the frontend. If the property is missing the
+ *      backend should offer discard if the backing storage actually supports
+ *      it. This optional property, set by the toolstack, requests that the
+ *      backend offer, or not offer, discard to the frontend.
+ *
  * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
Acked-by on v6 1/1
#1 lore raw

Olaf Hering writes ("[PATCH v6] libxl: add option for discard support to xl disk configuration"):

Quoted 8 lines

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.

(I made a tiny edit to the doc file as I committed, removing a spurious comma.)

Thanks,
Ian.

#2 lore raw
Quoted 10 lines · Ian Jackson

Olaf Hering writes ("[PATCH v6] libxl: add option for discard support to xl disk configuration"):

Quoted 8 lines

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.

Quoted 5 lines

(I made a tiny edit to the doc file as I committed, removing a spurious comma.)

The patch changes .l and .idl files. Did I place the comment incorrectly, did you overlook the comment or should my patch contain also the updates to generated files?

Perhaps the required steps for the commiter should be written down somewhere, so that patch submissions for templates fits in your workflow.

Olaf

#3 lore raw

Olaf Hering writes ("Re: [PATCH v6] libxl: add option for discard support to xl disk configuration"):

Quoted 3 lines

The patch changes .l and .idl files. Did I place the comment incorrectly, did you overlook the comment or should my patch contain also the updates to generated files?

I overlooked it, sorry. I see that Ian Campbell and I disagree about where this message should go, so this is not your fault. I have done it now (see below).

Thanks for your vigilance!

My preference is that it should go in the commit message before the Signed-off-by and definitely before any "--" or "---". I actually read the commit message of every commit I apply. Rerunning autoconf or flex/bison in any case involves modifying the commit with git-commit --amend, after git-am, so it's no hardship to remove the

In this case git removed your comment along with the "---", and then I reviewed the commit with "git show".

Quoted 3 lines

Perhaps the required steps for the commiter should be written down somewhere, so that patch submissions for templates fits in your workflow.

I agree that the process could be improved. I think Ian C and I should agree on the right location for these annotations and then it should be written down somewhere.

Thanks,
Ian.

commit 4f3c0c93bcfae4e0834e64a22db823abbe9a83a6

Author: Ian Jackson <[email protected]>
Date:   Mon May 19 15:17:03 2014 +0100

libxl: Rerun flex/bison for xl discard support

In 417e6b70 I overlooked the requirement to rerun bison/flex. Do that now. The changes are exactly those which are the result of 417e6b70.

tools/libxl/libxlu_disk_l.c +364 -340
index c97f0b2..2c6e8e3 100644
@@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 27
-#define YY_END_OF_BUFFER 28
+#define YY_NUM_RULES 29
+#define YY_END_OF_BUFFER 30
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -370,92 +370,96 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_acclist[470] =
+static yyconst flex_int16_t yy_acclist[490] =
     {   0,
-       26,   26,   28,   24,   25,   27, 8193,   24,   25,   27,
-    16385, 8193,   24,   27,16385,   24,   25,   27,   25,   27,
-       24,   25,   27,   24,   25,   27,   24,   25,   27,   24,
-       25,   27,   24,   25,   27,   24,   25,   27,   24,   25,
-       27,   24,   25,   27,   24,   25,   27,   24,   25,   27,
-       24,   25,   27,   24,   25,   27,   24,   25,   27,   24,
-       25,   27,   24,   25,   27,   26,   27,   27,   24,   24,
-     8193,   24, 8193,   24,16385, 8193,   24, 8193,   24,   24,
-     8215,   24,16407,   24,   24,   24,   24,   24,   24,   24,
-       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
-
-       24,   24,   24,   26, 8193,   24, 8193,   24, 8193, 8215,
-       24, 8215,   24, 8215,   14,   24,   24,   24,   24,   24,
-       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
-       24,   24,   24,   24, 8215,   24, 8215,   24, 8215,   14,
-       24,   19, 8215,   24,16407,   24,   24,   24,   24,   24,
-       24,   24,   24, 8208, 8215,   24,16400,16407,   22, 8215,
-       24,16407,   24, 8207, 8215,   24,16399,16407,   24,   24,
-     8210, 8215,   24,16402,16407,   24,   24,   24,   24,   19,
-     8215,   24,   19, 8215,   24,   19,   24,   19, 8215,   24,
-        3,   24,   24,   24,   21, 8215,   24,16407,   24,   24,
-
-     8208, 8215,   24, 8208, 8215,   24, 8208,   24, 8208, 8215,
-       22, 8215,   24,   22, 8215,   24,   22,   24,   22, 8215,
-     8207, 8215,   24, 8207, 8215,   24, 8207,   24, 8207, 8215,
-       24, 8210, 8215,   24, 8210, 8215,   24, 8210,   24, 8210,
-     8215,   24,   24,   10,   24,   19, 8215,   24,   19, 8215,
-       24,   19, 8215,   19,   24,   19,   24,    3,   24,   24,
-       24,   21, 8215,   24,   21, 8215,   24,   21,   24,   21,
-     8215,   24,   20, 8215,   24,16407, 8208, 8215,   24, 8208,
-     8215,   24, 8208, 8215, 8208,   24, 8208,   22, 8215,   24,
-       22, 8215,   24,   22, 8215,   22,   24,   22, 8207, 8215,
-
-       24, 8207, 8215,   24, 8207, 8215, 8207,   24, 8207,   24,
-     8210, 8215,   24, 8210, 8215,   24, 8210, 8215, 8210,   24,
-     8210,   24,   24,   10,   14,   10,    7,   24,   24,   24,
-       21, 8215,   24,   21, 8215,   24,   21, 8215,   21,   24,
-       21,    2,   20, 8215,   24,   20, 8215,   24,   20,   24,
-       20, 8215,   11,   24,   13,   10,   10,   14,    7,   14,
-        7,    8,   24,    6,   24,    2,   14,    2,   20, 8215,
-       24,   20, 8215,   24,   20, 8215,   20,   24,   20,   11,
-       14,   11,   17, 8215,   24,16407,   13,   14,   13,    7,
-        7,   14,    8,   14,    8,   24,    6,   14,    6,    6,
-
-       14,    6,   14,   24,    2,    2,   14,   11,   11,   14,
-       17, 8215,   24,   17, 8215,   24,   17,   24,   17, 8215,
-       13,   14,    8,    8,   14,   24,    6,    6,   14,    6,
-        6,   24,   17, 8215,   24,   17, 8215,   24,   17, 8215,
-       17,   24,   17,   24,    6,    6,   24,    9,    6,    5,
-        6,   24,    9,   14,    9,    4,    6,    5,    6,   24,
-        9,    9,   14,    4,    6,   12,   24,   12,   24
+       28,   28,   30,   26,   27,   29, 8193,   26,   27,   29,
+    16385, 8193,   26,   29,16385,   26,   27,   29,   27,   29,
+       26,   27,   29,   26,   27,   29,   26,   27,   29,   26,
+       27,   29,   26,   27,   29,   26,   27,   29,   26,   27,
+       29,   26,   27,   29,   26,   27,   29,   26,   27,   29,
+       26,   27,   29,   26,   27,   29,   26,   27,   29,   26,
+       27,   29,   26,   27,   29,   28,   29,   29,   26,   26,
+     8193,   26, 8193,   26,16385, 8193,   26, 8193,   26,   26,
+     8217,   26,16409,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+
+       26,   26,   26,   26,   28, 8193,   26, 8193,   26, 8193,
+     8217,   26, 8217,   26, 8217,   16,   26,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26, 8217,   26, 8217,
+       26, 8217,   16,   26,   21, 8217,   26,16409,   26,   26,
+       26,   26,   26,   26,   26,   26,   26, 8210, 8217,   26,
+    16402,16409,   26,   24, 8217,   26,16409,   26, 8209, 8217,
+       26,16401,16409,   26,   26, 8212, 8217,   26,16404,16409,
+       26,   26,   26,   26,   21, 8217,   26,   21, 8217,   26,
+       21,   26,   21, 8217,   26,    3,   26,   26,   26,   26,
+
+       23, 8217,   26,16409,   26,   26, 8210, 8217,   26, 8210,
+     8217,   26, 8210,   26, 8210, 8217,   26,   24, 8217,   26,
+       24, 8217,   26,   24,   26,   24, 8217, 8209, 8217,   26,
+     8209, 8217,   26, 8209,   26, 8209, 8217,   26, 8212, 8217,
+       26, 8212, 8217,   26, 8212,   26, 8212, 8217,   26,   26,
+       10,   26,   21, 8217,   26,   21, 8217,   26,   21, 8217,
+       21,   26,   21,   26,    3,   26,   26,   26,   26,   23,
+     8217,   26,   23, 8217,   26,   23,   26,   23, 8217,   26,
+       22, 8217,   26,16409, 8210, 8217,   26, 8210, 8217,   26,
+     8210, 8217, 8210,   26, 8210,   26,   24, 8217,   26,   24,
+
+     8217,   26,   24, 8217,   24,   26,   24, 8209, 8217,   26,
+     8209, 8217,   26, 8209, 8217, 8209,   26, 8209,   26, 8212,
+     8217,   26, 8212, 8217,   26, 8212, 8217, 8212,   26, 8212,
+       26,   26,   10,   16,   10,    7,   26,   26,   26,   13,
+       26,   23, 8217,   26,   23, 8217,   26,   23, 8217,   23,
+       26,   23,    2,   22, 8217,   26,   22, 8217,   26,   22,
+       26,   22, 8217,   26,   11,   26,   15,   10,   10,   16,
+        7,   16,    7,    8,   26,    6,   26,   13,   26,    2,
+       16,    2,   22, 8217,   26,   22, 8217,   26,   22, 8217,
+       22,   26,   22,   26,   11,   16,   11,   19, 8217,   26,
+
+    16409,   15,   16,   15,    7,    7,   16,    8,   16,    8,
+       26,    6,   16,    6,    6,   16,    6,   16,   26,    2,
+        2,   16,   26,   11,   11,   16,   19, 8217,   26,   19,
+     8217,   26,   19,   26,   19, 8217,   15,   16,    8,    8,
+       16,   26,    6,    6,   16,    6,    6,   26,   14,   26,
+       19, 8217,   26,   19, 8217,   26,   19, 8217,   19,   26,
+       19,   26,    6,    6,   26,   14,   26,    9,    6,    5,
+        6,   26,    9,   16,    9,    4,    6,    5,    6,   26,
+        9,    9,   16,    4,    6,   12,   26,   12,   26
     } ;
 
-static yyconst flex_int16_t yy_accept[271] =
+static yyconst flex_int16_t yy_accept[287] =
     {   0,
         1,    1,    1,    2,    3,    4,    7,   12,   16,   19,
        21,   24,   27,   30,   33,   36,   39,   42,   45,   48,
        51,   54,   57,   60,   63,   66,   68,   69,   70,   71,
        73,   76,   78,   79,   80,   81,   84,   84,   85,   86,
        87,   88,   89,   90,   91,   92,   93,   94,   95,   96,
-       97,   98,   99,  100,  101,  102,  103,  104,  105,  107,
-      109,  110,  112,  114,  115,  116,  117,  118,  119,  120,
+       97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
+      108,  110,  111,  113,  115,  116,  117,  118,  119,  120,
       121,  122,  123,  124,  125,  126,  127,  128,  129,  130,
-      131,  132,  133,  134,  135,  137,  139,  140,  141,  142,
-      146,  147,  148,  149,  150,  151,  152,  153,  154,  159,
-
-      163,  164,  169,  170,  171,  176,  177,  178,  179,  180,
-      183,  186,  188,  190,  191,  193,  194,  195,  199,  200,
-      201,  204,  207,  209,  211,  214,  217,  219,  221,  224,
-      227,  229,  231,  232,  235,  238,  240,  242,  243,  244,
-      245,  246,  249,  252,  254,  256,  257,  258,  260,  261,
-      262,  265,  268,  270,  272,  273,  277,  280,  283,  285,
-      287,  288,  291,  294,  296,  298,  299,  302,  305,  307,
-      309,  310,  311,  314,  317,  319,  321,  322,  323,  324,
-      326,  327,  328,  329,  330,  331,  334,  337,  339,  341,
-      342,  343,  346,  349,  351,  353,  354,  355,  356,  357,
-
-      359,  361,  362,  363,  364,  365,  366,  368,  369,  372,
-      375,  377,  379,  380,  382,  383,  387,  389,  390,  391,
-      393,  395,  396,  397,  399,  400,  402,  404,  405,  406,
-      408,  409,  411,  414,  417,  419,  421,  423,  424,  426,
-      427,  428,  430,  431,  432,  433,  436,  439,  441,  443,
-      444,  445,  446,  447,  448,  449,  450,  452,  453,  455,
-      456,  458,  460,  461,  462,  464,  466,  468,  470,  470
+      131,  132,  133,  134,  135,  136,  137,  138,  140,  142,
+      143,  144,  145,  149,  150,  151,  152,  153,  154,  155,
+
+      156,  157,  158,  163,  164,  168,  169,  174,  175,  176,
+      181,  182,  183,  184,  185,  188,  191,  193,  195,  196,
+      198,  199,  200,  201,  205,  206,  207,  210,  213,  215,
+      217,  218,  221,  224,  226,  228,  231,  234,  236,  238,
+      239,  242,  245,  247,  249,  250,  251,  252,  253,  256,
+      259,  261,  263,  264,  265,  267,  268,  269,  270,  273,
+      276,  278,  280,  281,  285,  288,  291,  293,  295,  296,
+      297,  300,  303,  305,  307,  308,  311,  314,  316,  318,
+      319,  320,  323,  326,  328,  330,  331,  332,  333,  335,
+      336,  337,  338,  339,  340,  342,  345,  348,  350,  352,
+
+      353,  354,  357,  360,  362,  364,  365,  366,  367,  368,
+      369,  371,  373,  374,  375,  376,  377,  378,  380,  382,
+      383,  386,  389,  391,  393,  394,  395,  397,  398,  402,
+      404,  405,  406,  408,  410,  411,  412,  414,  415,  417,
+      419,  420,  421,  423,  424,  425,  427,  430,  433,  435,
+      437,  439,  440,  442,  443,  444,  446,  447,  448,  449,
+      451,  454,  457,  459,  461,  462,  463,  464,  465,  466,
+      468,  469,  470,  472,  473,  475,  476,  478,  480,  481,
+      482,  484,  486,  488,  490,  490
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -498,252 +502,262 @@ static yyconst flex_int32_t yy_meta[34] =
         1,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[329] =
+static yyconst flex_int16_t yy_base[345] =
     {   0,
-        0,    0,  673,  657,  648,  616,   32,   35,  691,  691,
-       44,   62,   30,   41,   50,   51,  598,   64,   47,   66,
-       67,  586,   68,  582,   72,    0,  691,  584,  691,   87,
-       91,    0,    0,  100,  574,  109,    0,   74,   95,   87,
-       71,   96,   97,  105,  110,  112,  113,   40,  116,  119,
-      115,  120,  121,  124,  125,  127,  126,    0,  151,    0,
-        0,  153,    0,    0,  572,  128,  135,  139,  137,  136,
-      153,  156,  154,  148,  161,  162,  165,  166,  167,  170,
-      169,  178,  179,  171,  189,    0,    0,  691,  172,  202,
-      187,  174,  184,  202,  205,  558,  198,  206,  228,  237,
-
-      211,  246,  210,  215,  255,  216,  251,  234,  199,  263,
-        0,  265,    0,  252,  266,  261,  263,  292,  269,  270,
-      278,    0,  280,    0,  299,    0,  301,    0,  303,    0,
-      310,    0,  280,  312,    0,  314,    0,  301,  310,  556,
-      243,  321,    0,    0,    0,    0,  275,  691,  312,  322,
-      331,    0,  333,    0,  334,  344,  347,    0,    0,    0,
-        0,  351,    0,    0,    0,    0,  354,    0,    0,    0,
-        0,  352,  361,    0,    0,    0,    0,  318,  357,  548,
-      691,  540,  359,  362,  388,  370,    0,    0,    0,    0,
-      532,  372,    0,  374,    0,  520,  323,  381,  492,  691,
-
-      485,  691,  476,  349,  382,  369,  468,  691,  395,    0,
-        0,    0,    0,  449,  691,  406,  448,    0,  447,  691,
-      446,  691,  391,  444,  691,  399,  273,  395,  442,  691,
-      438,  691,  414,    0,  416,    0,    0,  398,  691,  412,
-      376,  691,  401,  417,  406,  426,    0,    0,    0,    0,
-      422,  423,  429,  426,  337,  433,  295,  423,  218,  691,
-       83,  691,  425,   38,  691,  691,  436,  691,  691,  455,
-      459,  462,  466,  470,  474,  478,  482,  486,  490,  494,
+        0,    0,  714,  713,  715,  700,   32,   35,  718,  718,
+       44,   62,   30,   41,   50,   51,  690,   64,   66,   40,
+       68,  674,   69,  662,   72,    0,  718,  640,  718,   90,
+       93,    0,    0,  102,  622,  111,    0,   74,   77,   88,
+       81,   97,   99,  107,  111,  113,  114,   44,  119,  120,
+      127,  115,  125,  126,  128,  129,  130,  132,    0,  143,
+        0,    0,  156,    0,    0,  616,  143,  153,  152,  140,
+      141,  157,  156,  163,  164,  159,  165,  167,  172,  195,
+      175,  169,  176,  182,  181,  195,  183,  203,    0,    0,
+      718,  192,  220,  199,  205,  200,  206,  606,  209,  602,
+
+      216,  220,  246,  218,  255,  227,  264,  251,  231,  276,
+      222,  260,  233,  234,  279,    0,  283,    0,  279,  286,
+      281,  242,  283,  310,  265,  287,  295,    0,  313,    0,
+      292,  320,    0,  322,    0,  324,    0,  331,    0,  320,
+      333,    0,  335,    0,  293,  322,  604,  291,  343,    0,
+        0,    0,    0,  335,  718,  340,  348,  346,  357,    0,
+      359,    0,  298,  368,  371,    0,    0,    0,    0,  352,
+      375,    0,    0,    0,    0,  378,    0,    0,    0,    0,
+      376,  385,    0,    0,    0,    0,  347,  381,  596,  718,
+      588,  383,  386,  384,  394,  396,    0,    0,    0,    0,
+
+      580,  404,    0,  406,    0,  393,  572,  333,  413,  564,
+      718,  556,  718,  544,  391,  407,  401,  718,  516,  718,
+      418,    0,    0,    0,    0,  405,  509,  718,  432,  500,
+        0,  492,  718,  474,  718,  413,  473,  718,  426,  424,
+      240,  472,  718,  461,  425,  718,  440,    0,  442,    0,
+        0,  379,  718,  438,  351,  718,  427,  422,  434,  451,
+      454,    0,    0,    0,    0,  450,  449,  452,  455,  718,
+      305,  457,  186,  454,  139,  718,   79,  718,  457,   38,
+      718,  718,  462,  718,  718,  479,  483,  486,  490,  494,
       498,  502,  506,  510,  514,  518,  522,  526,  530,  534,
-      538,  542,  546,  550,  554,  558,  562,  566,  570,  574,
 
+      538,  542,  546,  550,  554,  558,  562,  566,  570,  574,
       578,  582,  586,  590,  594,  598,  602,  606,  610,  614,
       618,  622,  626,  630,  634,  638,  642,  646,  650,  654,
-      658,  662,  666,  670,  674,  678,  682,  686
+      658,  662,  666,  670,  674,  678,  682,  686,  690,  694,
+      698,  702,  706,  710
     } ;
 
-static yyconst flex_int16_t yy_def[329] =
+static yyconst flex_int16_t yy_def[345] =
     {   0,
-      269,    1,  270,  270,  269,  271,  272,  272,  269,  269,
-      273,  273,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,  274,  269,  271,  269,  275,
-      272,  276,  276,  277,   12,  271,  278,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,  274,  275,  276,
-      276,  279,  280,  280,  269,   12,   12,   12,   12,   12,
+      285,    1,  286,  286,  285,  287,  288,  288,  285,  285,
+      289,  289,   12,   12,   12,   12,   12,   12,   12,   12,
+       12,   12,   12,   12,   12,  290,  285,  287,  285,  291,
+      288,  292,  292,  293,   12,  287,  294,   12,   12,   12,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,  279,  280,  280,  269,   12,  281,
-       12,   12,   12,   12,   12,   12,   12,   12,  282,  283,
-
-       12,  284,   12,   12,  285,   12,   12,   12,   12,  286,
-      287,  281,  287,   12,   12,   12,   12,  288,   12,   12,
-      289,  290,  282,  290,  291,  292,  283,  292,  293,  294,
-      284,  294,   12,  295,  296,  285,  296,   12,   12,  297,
-       12,  286,  287,  287,  298,  298,   12,  269,   12,   12,
-      299,  300,  288,  300,   12,  301,  289,  290,  290,  302,
-      302,  291,  292,  292,  303,  303,  293,  294,  294,  304,
-      304,   12,  295,  296,  296,  305,  305,   12,   12,  306,
-      269,  307,   12,   12,  277,  299,  300,  300,  308,  308,
-      309,  310,  311,  301,  311,  312,   12,  313,  306,  269,
-
-      314,  269,  315,   12,  316,  185,  317,  269,  310,  311,
-      311,  318,  318,  319,  269,  320,  321,  321,  314,  269,
-      322,  269,   12,  323,  269,  323,  323,  185,  317,  269,
-      319,  269,  324,  325,  320,  325,  321,  322,  269,   12,
-      323,  269,  323,  323,  185,  324,  325,  325,  326,  326,
-       12,  323,  323,  185,  327,  323,  323,  185,  328,  269,
-      323,  269,  185,  328,  269,  269,  185,  269,    0,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269
+       12,   12,   12,   12,   12,   12,   12,   12,  290,  291,
+      292,  292,  295,  296,  296,  285,   12,   12,   12,   12,
+       12,   12,   12,   12,   12,   12,   12,   12,   12,  293,
+       12,   12,   12,   12,   12,   12,   12,  295,  296,  296,
+      285,   12,  297,   12,   12,   12,   12,   12,   12,   12,
+
+       12,   12,  298,   80,  299,   12,  300,   12,   12,  301,
+       12,   12,   12,   12,  302,  303,  297,  303,   12,   12,
+       12,   12,   12,  304,   12,   12,  305,  306,  298,  306,
+       80,  307,  308,  299,  308,  309,  310,  300,  310,   12,
+      311,  312,  301,  312,   12,   12,  313,   12,  302,  303,
+      303,  314,  314,   12,  285,   12,   12,   12,  315,  316,
+      304,  316,   12,  317,  305,  306,  306,  318,  318,   80,
+      307,  308,  308,  319,  319,  309,  310,  310,  320,  320,
+       12,  311,  312,  312,  321,  321,   12,   12,  322,  285,
+      323,   12,   12,   80,   12,  315,  316,  316,  324,  324,
+
+      325,  326,  327,  317,  327,   80,  328,   12,  329,  322,
+      285,  330,  285,  331,   12,  332,   80,  285,  333,  285,
+      326,  327,  327,  334,  334,   80,  335,  285,  336,  337,
+      337,  330,  285,  338,  285,   12,  339,  285,  339,  339,
+       80,  333,  285,   80,  335,  285,  340,  341,  336,  341,
+      337,  338,  285,   12,  339,  285,  339,  339,   80,   80,
+      340,  341,  341,  342,  342,   12,  339,  339,   80,  285,
+      343,  339,  339,   80,  344,  285,  339,  285,   80,  344,
+      285,  285,   80,  285,    0,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285
     } ;
 
-static yyconst flex_int16_t yy_nxt[725] =
+static yyconst flex_int16_t yy_nxt[752] =
     {   0,
         6,    7,    8,    9,    6,    6,    6,    6,   10,   11,
        12,   13,   14,   15,   16,   17,   17,   18,   17,   17,
        17,   17,   19,   17,   20,   21,   22,   23,   24,   17,
        25,   17,   17,   31,   31,   32,   31,   31,   32,   35,
-       33,  260,   41,   33,   28,   28,   28,   29,   34,   35,
-       35,   36,   37,   75,   42,   38,   35,   50,   43,   35,
+       33,  276,   41,   33,   28,   28,   28,   29,   34,   35,
+       35,   36,   37,   35,   42,   38,   52,   77,   43,   35,
        35,   39,   28,   28,   28,   29,   34,   44,   46,   36,
-       37,   40,   45,   35,   47,   35,   35,   35,   52,   54,
-       35,   35,   51,   35,   56,   66,  266,   48,   57,   28,
-       60,   49,   31,   31,   32,   61,   35,   69,   68,   33,
-
-       28,   28,   28,   29,   35,   35,   35,   28,   37,   62,
-       62,   62,   63,   62,   35,   72,   62,   64,   67,   35,
-       50,   35,   35,   71,   35,   35,   70,   76,   35,   35,
-       35,   77,   73,   35,   35,   35,   35,   35,   80,   74,
-       84,   89,   90,   79,   35,   35,   35,   78,   35,   82,
-       81,   83,   80,   28,   60,   28,   86,   35,   91,   61,
-       92,   87,   35,   35,   93,   35,   94,   95,   77,   96,
-       35,   35,   99,  100,   35,   35,   35,  102,   35,   35,
-       35,   35,   97,   35,  104,  105,  103,   35,   35,   98,
-      106,   28,   86,   35,  107,  115,   35,   87,  101,  109,
-
-      114,  108,  110,  110,   62,  111,  110,   35,   35,  110,
-      113,   35,  118,  117,   35,   35,  116,   80,  102,   35,
-       35,  265,  105,   77,   35,   35,  141,  120,  121,  121,
-       62,  122,  121,  138,  133,  121,  124,  125,  125,   62,
-      126,  125,  140,   35,  125,  128,  129,  129,   62,  130,
-      129,  182,   35,  129,  132,  134,  134,   62,  135,  134,
-       35,   35,  134,  137,  139,   28,  143,   28,  145,  148,
-       35,  144,   35,  146,  147,   35,  242,  156,   35,   35,
-       28,  158,   28,  160,   35,  149,  159,  183,  161,   35,
-      244,  150,  151,  151,   62,  152,  151,  155,  262,  151,
-
-      154,   28,  163,   28,  165,   28,  168,  164,  172,  166,
-       35,  169,   28,  170,   28,  174,   28,  176,  171,   35,
-      175,   35,  177,   28,  143,  184,  185,   35,  178,  144,
-      216,   35,   35,   28,  187,   28,  189,  197,  179,  188,
-      260,  190,  191,   35,  192,  192,   62,  193,  192,   28,
-      158,  192,  195,   28,  163,  159,   28,  168,   35,  164,
-      196,   35,  169,   28,  174,  198,   35,  203,   35,  175,
-      205,   35,   28,  187,   28,  210,   28,  212,  188,  225,
-      211,  223,  213,   65,  218,  225,   34,  204,   28,   28,
-       28,   29,  228,  226,  227,   28,   37,   28,  210,  245,
-
-       35,  222,  242,  211,  225,  206,  233,  233,   62,  234,
-      233,  243,   34,  233,  236,  240,   28,  247,   28,  249,
-      225,   35,  248,   34,  250,  251,  225,  252,   28,  247,
-      255,   35,  225,  254,  248,  258,  225,  263,  267,  268,
-       34,  215,   34,   34,  253,  208,  256,  242,  257,  239,
-      202,  237,  232,   34,  261,   26,   26,   26,   26,   28,
-       28,   28,   30,   30,   30,   30,   35,   35,   35,   35,
-       58,  230,   58,   58,   59,   59,   59,   59,   61,  222,
-       61,   61,   34,   34,   34,   34,   65,   65,  220,   65,
-       85,   85,   85,   85,   87,  181,   87,   87,  112,  112,
-
-      112,  112,  123,  123,  123,  123,  127,  127,  127,  127,
-      131,  131,  131,  131,  136,  136,  136,  136,  142,  142,
-      142,  142,  144,  215,  144,  144,  153,  153,  153,  153,
-      157,  157,  157,  157,  159,  208,  159,  159,  162,  162,
-      162,  162,  164,  202,  164,  164,  167,  167,  167,  167,
-      169,  200,  169,  169,  173,  173,  173,  173,  175,  181,
-      175,  175,  180,  180,  180,  180,  146,  119,  146,  146,
-      186,  186,  186,  186,  188,   88,  188,  188,  194,  194,
-      194,  194,  161,   35,  161,  161,  166,   29,  166,  166,
-      171,   55,  171,  171,  177,   53,  177,  177,  199,  199,
-
-      199,  199,  201,  201,  201,  201,  190,   35,  190,  190,
-      207,  207,  207,  207,  209,  209,  209,  209,  211,   29,
-      211,  211,  214,  214,  214,  214,  217,  217,  217,  217,
-      219,  219,  219,  219,  221,  221,  221,  221,  224,  224,
-      224,  224,  229,  229,  229,  229,  213,  269,  213,  213,
-      231,  231,  231,  231,  235,  235,  235,  235,  218,   27,
-      218,  218,  238,  238,  238,  238,  241,  241,  241,  241,
-      246,  246,  246,  246,  248,   27,  248,  248,  250,  269,
-      250,  250,  259,  259,  259,  259,  264,  264,  264,  264,
-        5,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269
+       37,   40,   45,   35,   47,   35,   50,   35,   35,   53,
+       55,   35,  282,   35,   57,   67,   35,   48,   58,   51,
+       35,   49,   28,   61,   31,   31,   32,   35,   62,   69,
+
+       68,   33,   28,   28,   28,   29,   35,   70,   35,   28,
+       37,   63,   63,   63,   64,   63,   35,   74,   63,   65,
+       35,   50,   35,   35,   35,   72,   73,   71,   35,   35,
+       78,   80,   79,   75,   35,   35,   35,   35,   35,   35,
+       76,   35,  281,   87,   83,   28,   61,   81,   82,   35,
+       35,   62,   35,   85,   84,   86,   92,   83,   28,   89,
+       93,   35,   35,   95,   90,   35,   35,   98,   35,   96,
+       97,   94,   35,   35,   35,   79,   35,   99,   35,  103,
+      100,   35,  105,  107,   35,   35,  101,  109,  110,  278,
+       35,   35,   35,  111,  102,   28,   28,   28,   29,  108,
+
+      106,   35,   28,   37,   35,   28,   89,  104,   35,   35,
+      112,   90,  119,  113,   35,   35,  124,  122,   35,  114,
+      115,  115,   63,  116,  115,   35,  120,  115,  118,   35,
+       34,   35,  121,   83,  107,  131,   35,   79,  110,  145,
+       35,  147,   35,   35,  259,  126,  127,  127,   63,  128,
+      127,   35,   34,  127,  130,  132,  132,   63,  133,  132,
+       35,  148,  132,  135,  136,  136,   63,  137,  136,   35,
+      157,  136,  139,  146,   35,  140,  141,  141,   63,  142,
+      141,   28,  150,  141,  144,   28,  152,  151,   35,  155,
+       35,  153,   35,  163,  164,   35,   35,   28,  166,  191,
+
+       35,  154,   35,  167,   34,  156,  201,   35,  276,  158,
+      159,  159,   63,  160,  159,   28,  168,  159,  162,  170,
+      187,  169,   28,  172,   28,  174,   28,  177,  173,   35,
+      175,   35,  178,   28,  179,   28,  183,   28,  185,  180,
+      229,  184,   35,  186,   35,   28,  150,  192,  181,   35,
+      188,  151,  194,  193,  238,   35,   35,   35,  195,   28,
+      197,   28,  199,  206,   34,  198,  208,  200,  202,  202,
+       63,  203,  202,   28,  166,  202,  205,   28,  172,  167,
+       28,  177,  235,  173,  207,   35,  178,   28,  183,  209,
+       35,  214,   35,  184,  216,   35,   34,  218,   28,  197,
+
+       35,  217,  226,   35,  198,   34,   28,  222,   28,  224,
+      238,  215,  223,   34,  225,   66,  231,   34,  239,  240,
+       28,  222,   35,  236,  241,  238,  223,  256,  228,  256,
+      238,  244,  247,  247,   63,  248,  247,  254,  257,  247,
+      250,  258,   28,  262,   28,  264,   34,   35,  263,  268,
+      265,  266,  238,  267,  270,  238,   28,  262,  271,   35,
+      238,  269,  263,   34,  274,  284,   34,   34,  279,   34,
+      283,  273,  272,  260,   34,  220,  256,  253,  277,   26,
+       26,   26,   26,   28,   28,   28,   30,   30,   30,   30,
+       35,   35,   35,   35,   59,  213,   59,   59,   60,   60,
+
+       60,   60,   62,  251,   62,   62,   34,   34,   34,   34,
+       66,   66,  246,   66,   88,   88,   88,   88,   90,  243,
+       90,   90,  117,  117,  117,  117,  129,  129,  129,  129,
+      134,  134,  134,  134,  138,  138,  138,  138,  143,  143,
+      143,  143,  149,  149,  149,  149,  151,  235,  151,  151,
+      161,  161,  161,  161,  165,  165,  165,  165,  167,  233,
+      167,  167,  171,  171,  171,  171,  173,  190,  173,  173,
+      176,  176,  176,  176,  178,  228,  178,  178,  182,  182,
+      182,  182,  184,  220,  184,  184,  189,  189,  189,  189,
+      153,  213,  153,  153,  196,  196,  196,  196,  198,  211,
+
+      198,  198,  204,  204,  204,  204,  169,  190,  169,  169,
+      175,  125,  175,  175,  180,  123,  180,  180,  186,   91,
+      186,  186,  210,  210,  210,  210,  212,  212,  212,  212,
+      200,   35,  200,  200,  219,  219,  219,  219,  221,  221,
+      221,  221,  223,   29,  223,  223,  227,  227,  227,  227,
+      230,  230,  230,  230,  232,  232,  232,  232,  234,  234,
+      234,  234,  237,  237,  237,  237,  242,  242,  242,  242,
+      225,   56,  225,  225,  245,  245,  245,  245,  249,  249,
+      249,  249,  231,   54,  231,  231,  252,  252,  252,  252,
+      255,  255,  255,  255,  261,  261,  261,  261,  263,   35,
+
+      263,  263,  265,   29,  265,  265,  275,  275,  275,  275,
+      280,  280,  280,  280,  285,   27,   27,    5,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285
     } ;
 
-static yyconst flex_int16_t yy_chk[725] =
+static yyconst flex_int16_t yy_chk[752] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    7,    7,    7,    8,    8,    8,   13,
-        7,  264,   13,    8,   11,   11,   11,   11,   11,   48,
-       14,   11,   11,   48,   14,   11,   19,   19,   14,   15,
+        7,  280,   13,    8,   11,   11,   11,   11,   11,   20,
+       14,   11,   11,   48,   14,   11,   20,   48,   14,   15,
        16,   11,   12,   12,   12,   12,   12,   14,   16,   12,
-       12,   12,   15,   18,   16,   20,   21,   23,   21,   23,
-       41,   25,   20,   38,   25,   38,  261,   18,   25,   30,
-       30,   18,   31,   31,   31,   30,   40,   41,   40,   31,
-
-       34,   34,   34,   34,   39,   42,   43,   34,   34,   36,
-       36,   36,   36,   36,   44,   44,   36,   36,   39,   45,
-       45,   46,   47,   43,   51,   49,   42,   49,   50,   52,
-       53,   50,   46,   54,   55,   57,   56,   66,   57,   47,
-       56,   66,   67,   52,   67,   70,   69,   51,   68,   55,
-       54,   55,   53,   59,   59,   62,   62,   74,   68,   59,
-       69,   62,   71,   73,   70,   72,   71,   73,   72,   74,
-       75,   76,   77,   78,   77,   78,   79,   80,   81,   80,
-       84,   89,   75,   92,   82,   82,   81,   82,   83,   76,
-       82,   85,   85,   93,   83,   92,   91,   85,   79,   89,
-
-       91,   84,   90,   90,   90,   90,   90,   97,  109,   90,
-       90,   94,   95,   94,   95,   98,   93,  101,  101,  103,
-      101,  259,  104,   98,  104,  106,  109,   97,   99,   99,
-       99,   99,   99,  106,  103,   99,   99,  100,  100,  100,
-      100,  100,  108,  108,  100,  100,  102,  102,  102,  102,
-      102,  141,  141,  102,  102,  105,  105,  105,  105,  105,
-      107,  114,  105,  105,  107,  110,  110,  112,  112,  115,
-      116,  110,  117,  112,  114,  115,  227,  120,  119,  120,
-      121,  121,  123,  123,  147,  116,  121,  147,  123,  133,
-      227,  117,  118,  118,  118,  118,  118,  119,  257,  118,
-
-      118,  125,  125,  127,  127,  129,  129,  125,  133,  127,
-      138,  129,  131,  131,  134,  134,  136,  136,  131,  139,
-      134,  149,  136,  142,  142,  149,  150,  178,  138,  142,
-      197,  150,  197,  151,  151,  153,  153,  178,  139,  151,
-      255,  153,  155,  155,  156,  156,  156,  156,  156,  157,
-      157,  156,  156,  162,  162,  157,  167,  167,  204,  162,
-      172,  172,  167,  173,  173,  179,  179,  183,  183,  173,
-      184,  184,  186,  186,  192,  192,  194,  194,  186,  241,
-      192,  204,  194,  198,  198,  205,  206,  183,  185,  185,
-      185,  185,  206,  205,  205,  185,  185,  209,  209,  228,
-
-      223,  238,  226,  209,  243,  185,  216,  216,  216,  216,
-      216,  226,  228,  216,  216,  223,  233,  233,  235,  235,
-      244,  240,  233,  245,  235,  240,  252,  243,  246,  246,
-      251,  251,  253,  245,  246,  254,  256,  258,  263,  267,
-      258,  231,  263,  254,  244,  229,  252,  224,  253,  221,
-      219,  217,  214,  267,  256,  270,  270,  270,  270,  271,
-      271,  271,  272,  272,  272,  272,  273,  273,  273,  273,
-      274,  207,  274,  274,  275,  275,  275,  275,  276,  203,
-      276,  276,  277,  277,  277,  277,  278,  278,  201,  278,
-      279,  279,  279,  279,  280,  199,  280,  280,  281,  281,
-
-      281,  281,  282,  282,  282,  282,  283,  283,  283,  283,
-      284,  284,  284,  284,  285,  285,  285,  285,  286,  286,
-      286,  286,  287,  196,  287,  287,  288,  288,  288,  288,
-      289,  289,  289,  289,  290,  191,  290,  290,  291,  291,
-      291,  291,  292,  182,  292,  292,  293,  293,  293,  293,
-      294,  180,  294,  294,  295,  295,  295,  295,  296,  140,
-      296,  296,  297,  297,  297,  297,  298,   96,  298,  298,
-      299,  299,  299,  299,  300,   65,  300,  300,  301,  301,
-      301,  301,  302,   35,  302,  302,  303,   28,  303,  303,
-      304,   24,  304,  304,  305,   22,  305,  305,  306,  306,
-
-      306,  306,  307,  307,  307,  307,  308,   17,  308,  308,
-      309,  309,  309,  309,  310,  310,  310,  310,  311,    6,
-      311,  311,  312,  312,  312,  312,  313,  313,  313,  313,
-      314,  314,  314,  314,  315,  315,  315,  315,  316,  316,
-      316,  316,  317,  317,  317,  317,  318,    5,  318,  318,
-      319,  319,  319,  319,  320,  320,  320,  320,  321,    4,
+       12,   12,   15,   18,   16,   19,   19,   21,   23,   21,
+       23,   25,  277,   38,   25,   38,   39,   18,   25,   19,
+       41,   18,   30,   30,   31,   31,   31,   40,   30,   40,
+
+       39,   31,   34,   34,   34,   34,   42,   41,   43,   34,
+       34,   36,   36,   36,   36,   36,   44,   44,   36,   36,
+       45,   45,   46,   47,   52,   43,   43,   42,   49,   50,
+       49,   51,   50,   46,   53,   54,   51,   55,   56,   57,
+       47,   58,  275,   57,   58,   60,   60,   52,   53,   70,
+       71,   60,   67,   56,   55,   56,   67,   54,   63,   63,
+       68,   69,   68,   70,   63,   73,   72,   73,   76,   71,
+       72,   69,   74,   75,   77,   74,   78,   75,   82,   79,
+       76,   79,   81,   83,   81,   83,   77,   85,   85,  273,
+       85,   84,   87,   85,   78,   80,   80,   80,   80,   84,
+
+       82,   92,   80,   80,   86,   88,   88,   80,   94,   96,
+       86,   88,   94,   87,   95,   97,   99,   97,   99,   92,
+       93,   93,   93,   93,   93,  101,   95,   93,   93,  102,
+      104,  111,   96,  106,  106,  104,  106,  102,  109,  111,
+      109,  113,  113,  114,  241,  101,  103,  103,  103,  103,
+      103,  122,  241,  103,  103,  105,  105,  105,  105,  105,
+      108,  114,  105,  105,  107,  107,  107,  107,  107,  112,
+      122,  107,  107,  112,  125,  108,  110,  110,  110,  110,
+      110,  115,  115,  110,  110,  117,  117,  115,  119,  120,
+      121,  117,  123,  125,  126,  120,  126,  127,  127,  148,
+
+      148,  119,  145,  127,  131,  121,  163,  163,  271,  123,
+      124,  124,  124,  124,  124,  129,  129,  124,  124,  131,
+      145,  129,  132,  132,  134,  134,  136,  136,  132,  140,
+      134,  146,  136,  138,  138,  141,  141,  143,  143,  138,
+      208,  141,  208,  143,  154,  149,  149,  154,  140,  156,
+      146,  149,  157,  156,  255,  158,  187,  157,  158,  159,
+      159,  161,  161,  170,  170,  159,  187,  161,  164,  164,
+      164,  164,  164,  165,  165,  164,  164,  171,  171,  165,
+      176,  176,  252,  171,  181,  181,  176,  182,  182,  188,
+      188,  192,  192,  182,  193,  193,  194,  195,  196,  196,
+
+      215,  194,  206,  195,  196,  206,  202,  202,  204,  204,
+      216,  192,  202,  217,  204,  209,  209,  226,  216,  216,
+      221,  221,  236,  215,  217,  258,  221,  240,  245,  239,
+      257,  226,  229,  229,  229,  229,  229,  236,  239,  229,
+      229,  240,  247,  247,  249,  249,  259,  254,  247,  258,
+      249,  254,  267,  257,  260,  268,  261,  261,  266,  266,
+      272,  259,  261,  260,  269,  283,  274,  269,  274,  279,
+      279,  268,  267,  244,  283,  242,  237,  234,  272,  286,
+      286,  286,  286,  287,  287,  287,  288,  288,  288,  288,
+      289,  289,  289,  289,  290,  232,  290,  290,  291,  291,
+
+      291,  291,  292,  230,  292,  292,  293,  293,  293,  293,
+      294,  294,  227,  294,  295,  295,  295,  295,  296,  219,
+      296,  296,  297,  297,  297,  297,  298,  298,  298,  298,
+      299,  299,  299,  299,  300,  300,  300,  300,  301,  301,
+      301,  301,  302,  302,  302,  302,  303,  214,  303,  303,
+      304,  304,  304,  304,  305,  305,  305,  305,  306,  212,
+      306,  306,  307,  307,  307,  307,  308,  210,  308,  308,
+      309,  309,  309,  309,  310,  207,  310,  310,  311,  311,
+      311,  311,  312,  201,  312,  312,  313,  313,  313,  313,
+      314,  191,  314,  314,  315,  315,  315,  315,  316,  189,
+
+      316,  316,  317,  317,  317,  317,  318,  147,  318,  318,
+      319,  100,  319,  319,  320,   98,  320,  320,  321,   66,
       321,  321,  322,  322,  322,  322,  323,  323,  323,  323,
-      324,  324,  324,  324,  325,    3,  325,  325,  326,    0,
-      326,  326,  327,  327,  327,  327,  328,  328,  328,  328,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,
-      269,  269,  269,  269
+      324,   35,  324,  324,  325,  325,  325,  325,  326,  326,
+      326,  326,  327,   28,  327,  327,  328,  328,  328,  328,
+      329,  329,  329,  329,  330,  330,  330,  330,  331,  331,
+      331,  331,  332,  332,  332,  332,  333,  333,  333,  333,
+      334,   24,  334,  334,  335,  335,  335,  335,  336,  336,
+      336,  336,  337,   22,  337,  337,  338,  338,  338,  338,
+      339,  339,  339,  339,  340,  340,  340,  340,  341,   17,
+
+      341,  341,  342,    6,  342,  342,  343,  343,  343,  343,
+      344,  344,  344,  344,    5,    4,    3,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+      285
     } ;
 
 #define YY_TRAILING_MASK 0x2000
@@ -900,7 +914,7 @@ static int vdev_and_devtype(DiskParseContext *dpc, char *str) {
 #define DPC ((DiskParseContext*)yyextra)
 
 
-#line 904 "libxlu_disk_l.c"
+#line 918 "libxlu_disk_l.c"
 
 #define INITIAL 0
 #define LEXERR 1
@@ -1141,7 +1155,7 @@ YY_DECL
 
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1145 "libxlu_disk_l.c"
+#line 1159 "libxlu_disk_l.c"
 
 	if ( !yyg->yy_init )
 		{
@@ -1205,14 +1219,14 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 270 )
+				if ( yy_current_state >= 286 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			*yyg->yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_current_state != 269 );
+		while ( yy_current_state != 285 );
 
 yy_find_action:
 		yy_current_state = *--yyg->yy_state_ptr;
@@ -1328,34 +1342,44 @@ YY_RULE_SETUP
 #line 176 "libxlu_disk_l.l"
 { DPC->disk->direct_io_safe = 1; }
 	YY_BREAK
-/* the target magic parameter, eats the rest of the string */
 case 13:
 YY_RULE_SETUP
-#line 180 "libxlu_disk_l.l"
+#line 177 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->discard_enable, true); }
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 178 "libxlu_disk_l.l"
+{ libxl_defbool_set(&DPC->disk->discard_enable, false); }
+	YY_BREAK
+/* the target magic parameter, eats the rest of the string */
+case 15:
+YY_RULE_SETUP
+#line 182 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
 	YY_BREAK
 /* unknown parameters */
-case 14:
-/* rule 14 can match eol */
+case 16:
+/* rule 16 can match eol */
 YY_RULE_SETUP
-#line 184 "libxlu_disk_l.l"
+#line 186 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown parameter"); }
 	YY_BREAK
 /* deprecated prefixes */
 /* the "/.*" in these patterns ensures that they count as if they
    * matched the whole string, so these patterns take precedence */
-case 15:
+case 17:
 YY_RULE_SETUP
-#line 191 "libxlu_disk_l.l"
+#line 193 "libxlu_disk_l.l"
 {
                     STRIP(':');
                     DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
                     setformat(DPC, yytext);
                  }
 	YY_BREAK
-case 16:
+case 18:
 YY_RULE_SETUP
-#line 197 "libxlu_disk_l.l"
+#line 199 "libxlu_disk_l.l"
 {
                     char *newscript;
                     STRIP(':');
@@ -1369,65 +1393,65 @@ YY_RULE_SETUP
                     free(newscript);
                 }
 	YY_BREAK
-case 17:
+case 19:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 210 "libxlu_disk_l.l"
+#line 212 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 18:
+case 20:
 YY_RULE_SETUP
-#line 211 "libxlu_disk_l.l"
+#line 213 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 19:
+case 21:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 212 "libxlu_disk_l.l"
+#line 214 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 20:
+case 22:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 6;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 213 "libxlu_disk_l.l"
+#line 215 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 21:
+case 23:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 214 "libxlu_disk_l.l"
+#line 216 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 22:
+case 24:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 215 "libxlu_disk_l.l"
+#line 217 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 23:
-/* rule 23 can match eol */
+case 25:
+/* rule 25 can match eol */
 YY_RULE_SETUP
-#line 217 "libxlu_disk_l.l"
+#line 219 "libxlu_disk_l.l"
 {
 		  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
 		  return 0;
 		}
 	YY_BREAK
 /* positional parameters */
-case 24:
-/* rule 24 can match eol */
+case 26:
+/* rule 26 can match eol */
 YY_RULE_SETUP
-#line 224 "libxlu_disk_l.l"
+#line 226 "libxlu_disk_l.l"
 {
     STRIP(',');
 
@@ -1454,27 +1478,27 @@ YY_RULE_SETUP
     }
 }
 	YY_BREAK
-case 25:
+case 27:
 YY_RULE_SETUP
-#line 250 "libxlu_disk_l.l"
+#line 252 "libxlu_disk_l.l"
 {
     BEGIN(LEXERR);
     yymore();
 }
 	YY_BREAK
-case 26:
+case 28:
 YY_RULE_SETUP
-#line 254 "libxlu_disk_l.l"
+#line 256 "libxlu_disk_l.l"
 {
     xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0;
 }
 	YY_BREAK
-case 27:
+case 29:
 YY_RULE_SETUP
-#line 257 "libxlu_disk_l.l"
+#line 259 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1478 "libxlu_disk_l.c"
+#line 1502 "libxlu_disk_l.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(LEXERR):
 				yyterminate();
@@ -1738,7 +1762,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 270 )
+			if ( yy_current_state >= 286 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1762,11 +1786,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 270 )
+		if ( yy_current_state >= 286 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 269);
+	yy_is_jam = (yy_current_state == 285);
 	if ( ! yy_is_jam )
 		*yyg->yy_state_ptr++ = yy_current_state;
 
@@ -2566,4 +2590,4 @@ void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 257 "libxlu_disk_l.l"
+#line 259 "libxlu_disk_l.l"
tools/libxl/libxlu_disk_l.h +1 -1
index 59ce7cf..08f60e5 100644
@@ -344,7 +344,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner);
 #undef YY_DECL
 #endif
 
-#line 257 "libxlu_disk_l.l"
+#line 259 "libxlu_disk_l.l"
 
 #line 350 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
#4 lore raw
Quoted 7 lines · Ian Jackson
Quoted 3 lines

Perhaps the required steps for the commiter should be written down somewhere, so that patch submissions for templates fits in your workflow.

I agree that the process could be improved. I think Ian C and I should agree on the right location for these annotations and then it should be written down somewhere.

I admit, I have not read the following wiki pages, but that would probable the place to document this:

http://wiki.xen.org/wiki/Submitting_Xen_Patches
http://wiki.xen.org/wiki/Submitting_Xen_Patches_with_Git

Olaf

#5 lore raw
In reply to Ian Jackson
Quoted 10 lines · Ian Jackson

Olaf Hering writes ("[PATCH v6] libxl: add option for discard support to xl disk configuration"):

Quoted 8 lines

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.

Quoted 5 lines

(I made a tiny edit to the doc file as I committed, removing a spurious comma.)

I'm seeing an abort with this change while running under libvirt, although I think it is independent of the toolstack. It corresponds to

        flexarray_append_pair(back, "discard-enable",
                              libxl_defbool_val(disk->discard_enable) ?
                              "1" : "0");

in device_disk_add(). There is a missing libxl_defbool_setdefault in libxl somewhere and disk->discard_enable is therefore not set to a concrete value.

The one added by this patch in xlu_disk_parse is not sufficient because one is not obliged to use that function to parse disks. Although I also think it is wrong for it to be done there -- it should be done in the core libxl library somewhere, libxl__device_disk_setdefault most likely.

The other alternative is that the xs key should simply be omitted unless the defbool is set to a specific value.

I don't know what the intended semantics are to say which is the correct option.

Ian.

(gdb) bt

#0  0x00007ffff5a9f475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff5aa26f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff5a98621 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007fffeeb2820e in libxl_defbool_val (db=...) at libxl.c:271
#4  0x00007fffeeb2c54c in device_disk_add (egc=egc@entry=0x7ffff4080400, domid=domid@entry=6, disk=0x555555844700, aodev=0x55555583ccb0, get_vdev=get_vdev@entry=0, get_vdev_user=get_vdev_user@entry=0x0)
    at libxl.c:2222
#5  0x00007fffeeb2c760 in libxl__device_disk_add (egc=egc@entry=0x7ffff4080400, domid=domid@entry=6, disk=<optimized out>, aodev=<optimized out>) at libxl.c:2277
#6  0x00007fffeeb46721 in libxl__add_disks (egc=egc@entry=0x7ffff4080400, ao=ao@entry=0x5555558312e0, domid=domid@entry=6, d_config=d_config@entry=0x7ffff4080580, multidev=multidev@entry=0x55555583e8c0)
    at libxl_device.c:543
#7  0x00007fffeeb353d2 in domcreate_rebuild_done (egc=egc@entry=0x7ffff4080400, dcs=dcs@entry=0x55555583db90, ret=<optimized out>) at libxl_create.c:1039
#8  0x00007fffeeb37a82 in domcreate_bootloader_done (egc=0x7ffff4080400, bl=0x55555583dc50, rc=<optimized out>) at libxl_create.c:877
#9  0x00007fffeeb566a8 in bootloader_local_detached_cb (egc=0x7ffff4080400, dls=0x55555583dc78, rc=0) at libxl_bootloader.c:281

#10 0x00007fffeeb26a7e in local_device_detach_cb (egc=egc@entry=0x7ffff4080400, aodev=aodev@entry=0x55555583dce8) at libxl.c:2832
#11 0x00007fffeeb2d303 in libxl__device_disk_local_initiate_detach (egc=egc@entry=0x7ffff4080400, dls=dls@entry=0x55555583dc78) at libxl.c:2807
#12 0x00007fffeeb567e5 in bootloader_callback (egc=egc@entry=0x7ffff4080400, bl=bl@entry=0x55555583dc50, rc=rc@entry=0) at libxl_bootloader.c:265
#13 0x00007fffeeb57ce0 in libxl__bootloader_run (egc=egc@entry=0x7ffff4080400, bl=bl@entry=0x55555583dc50) at libxl_bootloader.c:392
#14 0x00007fffeeb38133 in initiate_domain_create (dcs=0x55555583db90, egc=0x7ffff4080400) at libxl_create.c:815
#15 do_domain_create (ctx=0x5555558446c0, d_config=<optimized out>, domid=0x7fffffffffff, restore_fd=restore_fd@entry=-1, checkpointed_stream=checkpointed_stream@entry=0, ao_how=<optimized out>,

    aop_console_how=0x0) at libxl_create.c:1368

#16 0x00007fffeeb3828b in libxl_domain_create_new (ctx=<optimized out>, d_config=<optimized out>, domid=<optimized out>, ao_how=<optimized out>, aop_console_how=<optimized out>) at libxl_create.c:1391 #17 0x00007fffeed90af1 in libxlDomainStart () from /usr/local/lib/libvirt/connection-driver/libvirt_driver_libxl.so
#18 0x00007fffeed92be6 in libxlDomainCreateXML () from /usr/local/lib/libvirt/connection-driver/libvirt_driver_libxl.so
#19 0x00007ffff69c2bb0 in virDomainCreateXML () from /usr/local/lib/libvirt.so.0
#20 0x00005555555774b8 in remoteDispatchDomainCreateXML ()
#21 0x00005555555773de in remoteDispatchDomainCreateXMLHelper ()
#22 0x00005555555c193f in virNetServerProgramDispatchCall ()
#23 0x00005555555c14a1 in virNetServerProgramDispatch ()
#24 0x00005555555b9270 in virNetServerProcessMsg ()
#25 0x00005555555b9355 in virNetServerHandleJob ()
#26 0x00007ffff690866f in virThreadPoolWorker () from /usr/local/lib/libvirt.so.0
#27 0x00007ffff6908006 in virThreadHelper () from /usr/local/lib/libvirt.so.0
#28 0x00007ffff641bb50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#29 0x00007ffff5b490ed in clone () from /lib/x86_64-linux-gnu/libc.so.6
#30 0x0000000000000000 in ?? ()

#6 lore raw
Quoted 5 lines · Ian Campbell

I'm seeing an abort with this change while running under libvirt, although I think it is independent of the toolstack. It corresponds to

        flexarray_append_pair(back, "discard-enable",
                              libxl_defbool_val(disk->discard_enable) ?
                              "1" : "0");
Quoted 8 lines

in device_disk_add(). There is a missing libxl_defbool_setdefault in libxl somewhere and disk->discard_enable is therefore not set to a concrete value.

The one added by this patch in xlu_disk_parse is not sufficient because one is not obliged to use that function to parse disks. Although I also think it is wrong for it to be done there -- it should be done in the core libxl library somewhere, libxl__device_disk_setdefault most likely.

If the value is set via device_disk_add -> libxl__device_disk_setdefault then the parsed value will be overwritten. Are you perhps thinking of something like "if (!default(val)) set_default(val, 0|1);" in libxl__device_disk_setdefault?

Quoted 2 lines

The other alternative is that the xs key should simply be omitted unless the defbool is set to a specific value.

It was done that way in my initial implementation. IanJ suggested to set a default, which is now done in xlu_disk_parse. As you found out, this does not cover all cases. libxl__device_disk_add, libxl_domain_create_new and libxl_domain_create_restore are public interfaces which will end up in device_disk_add.

This untested change may be the way to fix the crash:

tools/libxl/libxl.c +3 -0
index b115df8..24d9ac7 100644
@@ -2292,6 +2292,9 @@ int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
     int rc;
 
+    if (!libxl_defbool_is_default(disk->discard_enable))
+        libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
+
     rc = libxl__resolve_domid(gc, disk->backend_domname, &disk->backend_domid);
     if (rc < 0) return rc;
 
tools/libxl/libxlu_disk.c +0 -1
index 752a2c7..18fe386 100644
@@ -79,7 +79,6 @@ int xlu_disk_parse(XLU_Config *cfg,
         if (!disk->pdev_path || !strcmp(disk->pdev_path, ""))
             disk->format = LIBXL_DISK_FORMAT_EMPTY;
     }
-    libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
 
     if (!disk->vdev) {
         xlu__disk_err(&dpc,0, "no vdev specified");

Olaf

#7 lore raw
Quoted 16 lines · Olaf Hering
Quoted 5 lines · Ian Campbell

I'm seeing an abort with this change while running under libvirt, although I think it is independent of the toolstack. It corresponds to

        flexarray_append_pair(back, "discard-enable",
                              libxl_defbool_val(disk->discard_enable) ?
                              "1" : "0");
Quoted 8 lines

in device_disk_add(). There is a missing libxl_defbool_setdefault in libxl somewhere and disk->discard_enable is therefore not set to a concrete value.

The one added by this patch in xlu_disk_parse is not sufficient because one is not obliged to use that function to parse disks. Although I also think it is wrong for it to be done there -- it should be done in the core libxl library somewhere, libxl__device_disk_setdefault most likely.

Quoted 4 lines

If the value is set via device_disk_add -> libxl__device_disk_setdefault then the parsed value will be overwritten. Are you perhps thinking of something like "if (!default(val)) set_default(val, 0|1);" in libxl__device_disk_setdefault?

This is exactly what libxl_defbool_setdefault does/is for.

Quoted 5 lines
Quoted 2 lines

The other alternative is that the xs key should simply be omitted unless the defbool is set to a specific value.

It was done that way in my initial implementation. IanJ suggested to set a default, which is now done in xlu_disk_parse.

OK.

Quoted 12 lines

As you found out, this
does not cover all cases. libxl__device_disk_add, libxl_domain_create_new and libxl_domain_create_restore are public interfaces which will end up in device_disk_add.

This untested change may be the way to fix the crash:

tools/libxl/libxl.c +0 -0
index b115df8..24d9ac7 100644

tools/libxl/libxl.c int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk) · line 2296

Quoted 5 lines
tools/libxl/libxl.c +2 -0
@@ -2292,6 +2292,9 @@ int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
     int rc;
 
+    if (!libxl_defbool_is_default(disk->discard_enable))
+        libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);

No need for the condition here, setdefault already incorporates it.

I think with that changed this is probably the right fix.

Quoted 19 lines
tools/libxl/libxl.c +1 -0
+
     rc = libxl__resolve_domid(gc, disk->backend_domname, &disk->backend_domid);
     if (rc < 0) return rc;
 
tools/libxl/libxlu_disk.c +0 -1
index 752a2c7..18fe386 100644
@@ -79,7 +79,6 @@ int xlu_disk_parse(XLU_Config *cfg,
         if (!disk->pdev_path || !strcmp(disk->pdev_path, ""))
             disk->format = LIBXL_DISK_FORMAT_EMPTY;
     }
-    libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
 
     if (!disk->vdev) {
         xlu__disk_err(&dpc,0, "no vdev specified");

Olaf

#8 lore raw
Quoted 11 lines · Ian Campbell

tools/libxl/libxl.c int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk) · line 2296

Quoted 7 lines · Olaf Hering

+++ b/tools/libxl/libxl.c

tools/libxl/libxl.c +2 -0
@@ -2292,6 +2292,9 @@ int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
     int rc;
 
+    if (!libxl_defbool_is_default(disk->discard_enable))
+        libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);

No need for the condition here, setdefault already incorporates it.

I think with that changed this is probably the right fix.

I sent an fix: 'libxl: properly set default of discard_enable'.

Olaf