Skip to content
Snippets Groups Projects
  1. Dec 19, 2020
  2. Jul 21, 2020
    • Markus Armbruster's avatar
      qom: Make info qom-tree sort children more efficiently · 0dde9fd1
      Markus Armbruster authored
      
      Commit e8c9e658 "qom: Make "info qom-tree" show children sorted"
      sorts children the simple, stupid, quadratic way.  I thought the
      number of children would be small enough for this not to matter.  I
      was wrong: there are outliers with several hundred children, e.g ARM
      machines nuri and smdkc210 each have a node with 513 children.
      
      While n^2 sorting isn't noticeable in normal, human usage even for
      n=513, it can be quite noticeable in certain automated tests.  In
      particular, the sort made device-introspect-test even slower.  Commit
      3e7b80f8 "tests: improve performance of device-introspect-test" just
      fixed that by cutting back its excessive use of "info qom-tree".
      Sorting more efficiently makes sense regardless, so do it.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200714160202.3121879-6-armbru@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      0dde9fd1
    • Markus Armbruster's avatar
      qom: Change object_get_canonical_path_component() not to malloc · 7a309cc9
      Markus Armbruster authored
      
      object_get_canonical_path_component() returns a malloced copy of a
      property name on success, null on failure.
      
      19 of its 25 callers immediately free the returned copy.
      
      Change object_get_canonical_path_component() to return the property
      name directly.  Since modifying the name would be wrong, adjust the
      return type to const char *.
      
      Drop the free from the 19 callers become simpler, add the g_strdup()
      to the other six.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200714160202.3121879-4-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
      7a309cc9
  3. Jul 17, 2020
    • Markus Armbruster's avatar
      qom: Plug memory leak in "info qom-tree" · ab2d185d
      Markus Armbruster authored
      
      Commit e8c9e658 "qom: Make "info qom-tree" show children sorted"
      created a memory leak, because I didn't realize
      object_get_canonical_path_component()'s value needs to be freed.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -S -monitor stdio
          QEMU 5.0.50 monitor - type 'help' for more information
          (qemu) info qom-tree
      
      This leaks some 4500 path components, 12-13 characters on average,
      i.e. roughly 100kBytes depending on the allocator.  A couple of
      hundred "info qom-tree" here, a couple of hundred there, and soon
      enough we're talking about real memory.
      
      Plug the leak.
      
      Fixes: e8c9e658
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reported-by: Reviewed-by: Li Qiang <liq3ea@gmail.com> [sent same patch]
      Message-Id: <20200714160202.3121879-3-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      ab2d185d
  4. Jul 10, 2020
    • Markus Armbruster's avatar
      qom: Put name parameter before value / visitor parameter · 5325cc34
      Markus Armbruster authored
      
      The object_property_set_FOO() setters take property name and value in
      an unusual order:
      
          void object_property_set_FOO(Object *obj, FOO_TYPE value,
                                       const char *name, Error **errp)
      
      Having to pass value before name feels grating.  Swap them.
      
      Same for object_property_set(), object_property_get(), and
      object_property_parse().
      
      Convert callers with this Coccinelle script:
      
          @@
          identifier fun = {
              object_property_get, object_property_parse, object_property_set_str,
              object_property_set_link, object_property_set_bool,
              object_property_set_int, object_property_set_uint, object_property_set,
              object_property_set_qobject
          };
          expression obj, v, name, errp;
          @@
          -    fun(obj, v, name, errp)
          +    fun(obj, name, v, errp)
      
      Chokes on hw/arm/musicpal.c's lcd_refresh() with the unhelpful error
      message "no position information".  Convert that one manually.
      
      Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by
      ARMSSE being used both as typedef and function-like macro there.
      Convert manually.
      
      Fails to convert hw/rx/rx-gdbsim.c, because Coccinelle gets confused
      by RXCPU being used both as typedef and function-like macro there.
      Convert manually.  The other files using RXCPU that way don't need
      conversion.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-27-armbru@redhat.com>
      [Straightforwad conflict with commit 2336172d "audio: set default
      value for pcspk.iobase property" resolved]
      5325cc34
  5. Jun 17, 2020
    • David Hildenbrand's avatar
      hmp: Make json format optional for qom-set · 2d9e3dd9
      David Hildenbrand authored
      
      Commit 7d2ef6dc ("hmp: Simplify qom-set") switched to the json
      parser, making it possible to specify complex types. However, with this
      change it is no longer possible to specify proper sizes (e.g., 2G, 128M),
      turning the interface harder to use for properties that consume sizes.
      
      Let's switch back to the previous handling and allow to specify passing
      json via the "-j" parameter.
      
      Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Daniel P. Berrangé" <berrange@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200610075153.33892-1-david@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      2d9e3dd9
    • Pan Nengyuan's avatar
      qom-hmp-cmds: fix a memleak in hmp_qom_get · 246da7db
      Pan Nengyuan authored
      
      'obj' forgot to free at the end of hmp_qom_get(). Fix that.
      
      The leak stack:
      Direct leak of 40 byte(s) in 1 object(s) allocated from:
          #0 0x7f4e3a779ae8 in __interceptor_malloc (/lib64/libasan.so.5+0xefae8)
          #1 0x7f4e398f91d5 in g_malloc (/lib64/libglib-2.0.so.0+0x531d5)
          #2 0x55c9fd9a3999 in qstring_from_substr /build/qemu/src/qobject/qstring.c:45
          #3 0x55c9fd894bd3 in qobject_output_type_str /build/qemu/src/qapi/qobject-output-visitor.c:175
          #4 0x55c9fd894bd3 in qobject_output_type_str /build/qemu/src/qapi/qobject-output-visitor.c:168
          #5 0x55c9fd88b34d in visit_type_str /build/qemu/src/qapi/qapi-visit-core.c:308
          #6 0x55c9fd59aa6b in property_get_str /build/qemu/src/qom/object.c:2064
          #7 0x55c9fd5adb8a in object_property_get_qobject /build/qemu/src/qom/qom-qobject.c:38
          #8 0x55c9fd4a029d in hmp_qom_get /build/qemu/src/qom/qom-hmp-cmds.c:66
      
      Fixes: 89cf4fe3
      Reported-by: default avatarEuler Robot <euler.robot@huawei.com>
      Signed-off-by: default avatarPan Nengyuan <pannengyuan@huawei.com>
      Message-Id: <20200603070338.7922-1-pannengyuan@huawei.com>
      Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
      Tested-by: default avatarLi Qiang <liq3ea@gmail.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      246da7db
  6. Jun 15, 2020
  7. Jun 01, 2020
  8. Dec 18, 2019
  9. Jul 02, 2019
Loading