Skip to content
Snippets Groups Projects
  1. Oct 28, 2021
  2. Oct 27, 2021
    • Richard Henderson's avatar
      Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20211027' into staging · c52d69e7
      Richard Henderson authored
      
      9pfs: performance fix and cleanup
      
      * First patch fixes suboptimal I/O performance on guest due to previously
        incorrect block size being transmitted to 9p client.
      
      * Subsequent patches are cleanup ones intended to reduce code complexity.
      
      * remotes/cschoenebeck/tags/pull-9p-20211027:
        9pfs: use P9Array in v9fs_walk()
        9pfs: make V9fsPath usable via P9Array API
        9pfs: make V9fsString usable via P9Array API
        fsdev/p9array.h: check scalar type in P9ARRAY_NEW()
        9pfs: introduce P9Array
        9pfs: simplify blksize_to_iounit()
        9pfs: deduplicate iounit code
        9pfs: fix wrong I/O block size in Rgetattr
      
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      c52d69e7
    • Richard Henderson's avatar
      Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-10-27' into staging · 5c49c6c2
      Richard Henderson authored
      
      QAPI patches patches for 2021-10-27
      
      # gpg: Signature made Wed 27 Oct 2021 08:21:54 AM PDT
      # gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
      # gpg:                issuer "armbru@redhat.com"
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
      
      * remotes/armbru/tags/pull-qapi-2021-10-27:
        qapi: Implement deprecated-input={reject,crash} for enum values
        qapi: Move compat policy from QObject to generic visitor
        qapi: Add feature flags to enum members
        qapi: Enable enum member introspection to show more than name
        qapi: Improve input_type_enum()'s error message
      
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      5c49c6c2
    • Markus Armbruster's avatar
      qapi: Implement deprecated-input={reject,crash} for enum values · aa237044
      Markus Armbruster authored
      
      This copies the code implementing the policy from qapi/qmp-dispatch.c
      to qapi/qobject-input-visitor.c.  Tolerable, but if we acquire more
      copies, we should look into factoring them out.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Tested-by: default avatarPeter Krempa <pkrempa@redhat.com>
      Acked-by: default avatarPeter Krempa <pkrempa@redhat.com>
      Message-Id: <20211025042405.3762351-5-armbru@redhat.com>
      aa237044
    • Markus Armbruster's avatar
      qapi: Move compat policy from QObject to generic visitor · ed29bb28
      Markus Armbruster authored
      
      The next commit needs to access compat policy from the generic visitor
      core.  Move it there from qobject input and output visitor.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20211025042405.3762351-4-armbru@redhat.com>
      ed29bb28
    • Markus Armbruster's avatar
      qapi: Add feature flags to enum members · b6c18755
      Markus Armbruster authored
      
      This is quite similar to commit 84ab0086 "qapi: Add feature flags to
      struct members", only for enums instead of structs.
      
      Special feature flag 'deprecated' is silently ignored there.  This is
      okay only because it will be implemented shortly.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20211025042405.3762351-3-armbru@redhat.com>
      Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
      b6c18755
    • Markus Armbruster's avatar
      qapi: Enable enum member introspection to show more than name · 75ecee72
      Markus Armbruster authored
      
      The next commit will add feature flags to enum members.  There's a
      problem, though: query-qmp-schema shows an enum type's members as an
      array of member names (SchemaInfoEnum member @values).  If it showed
      an array of objects with a name member, we could simply add more
      members to these objects.  Since it's just strings, we can't.
      
      I can see three ways to correct this design mistake:
      
      1. Do it the way we should have done it, plus compatibility goo.
      
         We want a ['SchemaInfoEnumMember'] member in SchemaInfoEnum.  Since
         changing @values would be a compatibility break, add a new member
         @members instead.
      
         @values is now redundant.  In my testing, output of
         qemu-system-x86_64's query-qmp-schema grows by 11% (18.5KiB).
      
         We can deprecate @values now and drop it later.  This will break
         outmoded clients.  Well-behaved clients such as libvirt are
         expected to break cleanly.
      
      2. Like 1, but omit "boring" elements of @member, and empty @member.
      
         @values does not become redundant.  @members augments it.  Somewhat
         cumbersome, but output of query-qmp-schema grows only as we make
         enum members non-boring.
      
         There is nothing to deprecate here.
      
      3. Versioned query-qmp-schema.
      
         query-qmp-schema provides either @values or @members.  The QMP
         client can select which version it wants.  There is no redundant
         output.
      
         We can deprecate old versions and eventually drop them.  This will
         break outmoded clients.  Breaking cleanly is easier than for 1.
      
         While 1 and 2 operate within the common rules for compatible
         evolution apply (section "Compatibility considerations" in
         docs/devel/qapi-code-gen.rst), 3 bypasses them.  Attractive when
         operating within the rules is just too awkward.  Not the case here.
      
      This commit implements 1.  Libvirt developers prefer it.
      
      Deprecate @values in favour of @members.  Since query-qmp-schema
      compatibility is pretty fundamental for management applications, an
      extended grace period is advised.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Tested-by: default avatarPeter Krempa <pkrempa@redhat.com>
      Acked-by: default avatarPeter Krempa <pkrempa@redhat.com>
      Message-Id: <20211025042405.3762351-2-armbru@redhat.com>
      Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
      75ecee72
    • Markus Armbruster's avatar
      qapi: Improve input_type_enum()'s error message · ea29331b
      Markus Armbruster authored
      The error message claims the parameter is invalid:
      
          $ qemu-system-x86_64 -object qom-type=nonexistent
          qemu-system-x86_64: -object qom-type=nonexistent: Invalid parameter 'nonexistent'
      
      What's wrong is actually the *value* 'nonexistent'.  Improve the
      message to
      
          qemu-system-x86_64: -object qom-type=nonexistent: Parameter 'qom-type' does not accept value 'nonexistent'
      
      Fixes: https://gitlab.com/qemu-project/qemu/-/issues/608
      
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20211020180231.434071-1-armbru@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      ea29331b
    • Christian Schoenebeck's avatar
      9pfs: use P9Array in v9fs_walk() · 7e985780
      Christian Schoenebeck authored
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Message-Id: <90c65d1c1ca11c1b434bb981b1fc7966f7711c8f.1633097129.git.qemu_oss@crudebyte.com>
      7e985780
    • Christian Schoenebeck's avatar
      9pfs: make V9fsPath usable via P9Array API · cc82fde9
      Christian Schoenebeck authored
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Message-Id: <79a0ddf8375f6c95f0565ef155a1bf1e9387664f.1633097129.git.qemu_oss@crudebyte.com>
      cc82fde9
    • Christian Schoenebeck's avatar
      9pfs: make V9fsString usable via P9Array API · 42bdeb04
      Christian Schoenebeck authored
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Message-Id: <ce9f7a0a63585dc27f4545c485109efbec1251da.1633097129.git.qemu_oss@crudebyte.com>
      42bdeb04
    • Christian Schoenebeck's avatar
      fsdev/p9array.h: check scalar type in P9ARRAY_NEW() · c0451f0b
      Christian Schoenebeck authored
      
      Make sure at compile time that the scalar type of the array
      requested to be created via P9ARRAY_NEW() matches the scalar
      type of the passed auto reference variable (unique pointer).
      
      Suggested-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Message-Id: <c1965e2a096835dc9e1d4d659dfb15d96755cbe0.1633097129.git.qemu_oss@crudebyte.com>
      c0451f0b
    • Christian Schoenebeck's avatar
      9pfs: introduce P9Array · 30e702ab
      Christian Schoenebeck authored
      
      Implements deep auto free of arrays while retaining common C-style
      squared bracket access. Main purpose of this API is to get rid of
      error prone individual array deallocation pathes in user code, i.e.
      turning something like this:
      
        void doSomething(size_t n) {
            Foo *foos = malloc(n * sizeof(Foo));
            for (...) {
                foos[i].s = malloc(...);
                if (...) {
                    goto out;
                }
            }
        out:
            if (...) {
                for (...) {
                    /* deep deallocation */
                    free(foos[i].s);
                }
                /* array deallocation */
                free(foos);
            }
        }
      
      into something more simple and safer like:
      
        void doSomething(size_t n) {
            P9ARRAY_REF(Foo) foos = NULL;
            P9ARRAY_NEW(Foo, foos, n);
            for (...) {
                foos[i].s = malloc(...);
                if (...) {
                    return; /* array auto freed here */
                }
            }
            /* array auto freed here */
        }
      
      Unlike GArray, P9Array does not require special macros, function
      calls or struct member dereferencing to access the individual array
      elements:
      
        C-array = P9Array:   vs.  GArray:
      
        for (...) {           |   for (...) {
            ... = arr[i].m;   |       ... = g_array_index(arr, Foo, i).m;
            arr[i].m = ... ;  |       g_array_index(arr, Foo, i).m = ... ;
        }                     |   }
      
      So existing C-style array code can be retained with only very little
      changes; basically limited to replacing array allocation call and of
      course removing individual array deallocation pathes.
      
      In this initial version P9Array only supports the concept of unique
      pointers, i.e. it does not support reference counting. The array (and
      all dynamically allocated memory of individual array elements) is auto
      freed once execution leaves the scope of the reference variable (unique
      pointer) associated with the array.
      
      Internally a flex array struct is used in combination with macros
      spanned over a continuous memory space for both the array's meta data
      (private) and the actual C-array user data (public):
      
        struct P9Array##scalar_type {
          size_t len;            /* private, hidden from user code */
          scalar_type first[];   /* public, directly exposed to user code */
        };
      
      Which has the advantage that the compiler automatically takes care
      about correct padding, alignment and overall size for all scalar data
      types on all systems and that the user space exposed pointer can
      directly be translated back and forth between user space C-array
      pointer and internal P9Array struct whenever needed, in a type-safe
      manner.
      
      This header file is released under MIT license, to allow this file
      being used in other C-projects as well. The common QEMU license
      GPL2+ might have construed a conflict for other projects.
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Message-Id: <a954ef47b5ac26085a16c5c2aec8695374e0424d.1633097129.git.qemu_oss@crudebyte.com>
      30e702ab
    • Christian Schoenebeck's avatar
      9pfs: simplify blksize_to_iounit() · 04a7f9e5
      Christian Schoenebeck authored
      
      Use QEMU_ALIGN_DOWN() macro to reduce code and to make it
      more human readable.
      
      Suggested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <b84eb324d2ebdcc6f9c442c97b5b4d01eecb4f43.1632758315.git.qemu_oss@crudebyte.com>
      04a7f9e5
    • Christian Schoenebeck's avatar
      9pfs: deduplicate iounit code · b565bccb
      Christian Schoenebeck authored
      
      Remove redundant code that translates host fileystem's block
      size into 9p client (guest side) block size.
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Message-Id: <129bb71d5119e61d335f1e3107e472e4beea223a.1632758315.git.qemu_oss@crudebyte.com>
      b565bccb
    • Christian Schoenebeck's avatar
      9pfs: fix wrong I/O block size in Rgetattr · 669ced09
      Christian Schoenebeck authored
      
      When client sent a 9p Tgetattr request then the wrong I/O block
      size value was returned by 9p server; instead of host file
      system's I/O block size it should rather return an I/O block
      size according to 9p session's 'msize' value, because the value
      returned to client should be an "optimum" block size for I/O
      (i.e. to maximize performance), it should not reflect the actual
      physical block size of the underlying storage media.
      
      The I/O block size of a host filesystem is typically 4k, so the
      value returned was far too low for good 9p I/O performance.
      
      This patch adds stat_to_iounit() with a similar approach as the
      existing get_iounit() function.
      
      Signed-off-by: default avatarChristian Schoenebeck <qemu_oss@crudebyte.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Message-Id: <E1mT2Js-0000DW-OH@lizzy.crudebyte.com>
      669ced09
  3. Oct 26, 2021
  4. Oct 25, 2021
  5. Oct 23, 2021
  6. Oct 22, 2021
Loading