qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 3b6ca4: qdev: Change Property::offset field t


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 3b6ca4: qdev: Change Property::offset field to ptrdiff_t t...
Date: Fri, 20 Nov 2015 03:30:06 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 3b6ca4022d150ad273d4cd9556c2f4873389f965
      
https://github.com/qemu/qemu/commit/3b6ca4022d150ad273d4cd9556c2f4873389f965
  Author: Ildar Isaev <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M include/hw/qdev-core.h

  Log Message:
  -----------
  qdev: Change Property::offset field to ptrdiff_t type

Property::offset field is calculated as a diff between two pointers:

  arrayprop->prop.offset = eltptr - (void *)dev;

If offset is declared as int, this subtraction can cause type overflow,
thus leading to failure of the subsequent assertion:

  assert(qdev_get_prop_ptr(dev, &arrayprop->prop) == eltptr);

So ptrdiff_t should be used instead.

Signed-off-by: Ildar Isaev <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: a00c94824126901168bca5b89147f9e334a49e87
      
https://github.com/qemu/qemu/commit/a00c94824126901168bca5b89147f9e334a49e87
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M include/qom/object.h
    M qom/object.c
    M tests/check-qom-proplist.c

  Log Message:
  -----------
  qom: Introduce ObjectPropertyIterator struct for iteration

Some users of QOM need to be able to iterate over properties
defined against an object instance. Currently they are just
directly using the QTAIL macros against the object properties
data structure.

This is bad because it exposes them to changes in the data
structure used to store properties, as well as changes in
functionality such as ability to register properties against
the class.

This provides an ObjectPropertyIterator struct which will
insulate the callers from the particular data structure
used to store properties. It can be used thus

  ObjectProperty *prop;
  ObjectPropertyIterator *iter;

  iter = object_property_iter_init(obj);
  while ((prop = object_property_iter_next(iter))) {
      ... do something with prop ...
  }
  object_property_iter_free(iter);

Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
[AF: Fixed examples, style cleanups]
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 1b30c094dcb69273b7661897c067906f81e5b967
      
https://github.com/qemu/qemu/commit/1b30c094dcb69273b7661897c067906f81e5b967
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M qmp.c

  Log Message:
  -----------
  qmp: Convert QMP code to use object property iterators

Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 2465bc564d39d9b62fa21b3e84313be3b32dbc16
      
https://github.com/qemu/qemu/commit/2465bc564d39d9b62fa21b3e84313be3b32dbc16
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Convert machine help code to use object property iterators

Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 9a842f7d3ce421b39c7edbfe2c47efeac5db6c28
      
https://github.com/qemu/qemu/commit/9a842f7d3ce421b39c7edbfe2c47efeac5db6c28
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M hw/ppc/spapr_drc.c

  Log Message:
  -----------
  ppc: Convert spapr code to use object property iterators

Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 456fb0bfe0b27c54d316be7fe3b362247f732656
      
https://github.com/qemu/qemu/commit/456fb0bfe0b27c54d316be7fe3b362247f732656
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M net/filter.c

  Log Message:
  -----------
  net: Convert net filter code to use object property iterators

Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.

Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 8c4d156c187c84b574d287bd4b9ddf9a6975de7c
      
https://github.com/qemu/qemu/commit/8c4d156c187c84b574d287bd4b9ddf9a6975de7c
  Author: Daniel P. Berrange <address@hidden>
  Date:   2015-11-18 (Wed, 18 Nov 2015)

  Changed paths:
    M tests/check-qom-proplist.c

  Log Message:
  -----------
  qom: Add a test case for complex property finalization

Devices have some quite complex object child/link relationships
which place some requirements on the object_property_del_all()
function to consider that properties can be modified while
being iterated over.

This extends the QOM property test case to replicate the
device like structure and expose any potential bugs in the
object_property_del_all() function.

Signed-off-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: b604a854e843505007c59d68112c654556102a20
      
https://github.com/qemu/qemu/commit/b604a854e843505007c59d68112c654556102a20
  Author: Pavel Fedin <address@hidden>
  Date:   2015-11-19 (Thu, 19 Nov 2015)

  Changed paths:
    M include/qom/object.h
    M qom/object.c

  Log Message:
  -----------
  qom: Replace object property list with GHashTable

ARM GICv3 systems with large number of CPUs create lots of IRQ pins. Since
every pin is represented as a property, number of these properties becomes
very large. Every property add first makes sure there's no duplicates.
Traversing the list becomes very slow, therefore QEMU initialization takes
significant time (several seconds for e. g. 16 CPUs).

This patch replaces list with GHashTable, making lookup very fast. The only
drawback is that object_child_foreach() and object_child_foreach_recursive()
cannot add or remove properties during traversal, since GHashTableIter does
not have modify-safe version. However, the code seems not to modify objects
via these functions.

Signed-off-by: Pavel Fedin <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
[AF: Fixed object_property_del_{all,child}() issues;
     g_hash_table_contains() -> g_hash_table_lookup(), suggested by Daniel]
Reviewed-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 8438a13543a281e3e61542cc0763bf1b05169016
      
https://github.com/qemu/qemu/commit/8438a13543a281e3e61542cc0763bf1b05169016
  Author: Andreas Färber <address@hidden>
  Date:   2015-11-19 (Thu, 19 Nov 2015)

  Changed paths:
    M qom/object.c

  Log Message:
  -----------
  qom: Clean up assertions to display values on failure

Instead of using g_assert() for integer comparisons, use
g_assert_cmpint() so that we can see the respective values.

While at it, fix one stray indentation.

Reviewed-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 9f4aa7cef2214137db192b252f1d4fc1799d05c7
      
https://github.com/qemu/qemu/commit/9f4aa7cef2214137db192b252f1d4fc1799d05c7
  Author: Andreas Färber <address@hidden>
  Date:   2015-11-19 (Thu, 19 Nov 2015)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: Add check-qom-{interface,proplist} to QOM

Add the QOM unit tests to the QOM maintenance area so that maintainers
get CC'ed on changes and to document QOM test coverage.

Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>


  Commit: 28c3e6ee72a34d3c2c44ef508b599fa460b273bb
      
https://github.com/qemu/qemu/commit/28c3e6ee72a34d3c2c44ef508b599fa460b273bb
  Author: Peter Maydell <address@hidden>
  Date:   2015-11-19 (Thu, 19 Nov 2015)

  Changed paths:
    M MAINTAINERS
    M hw/ppc/spapr_drc.c
    M include/hw/qdev-core.h
    M include/qom/object.h
    M net/filter.c
    M qmp.c
    M qom/object.c
    M tests/check-qom-proplist.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' 
into staging

QOM infrastructure fixes and device conversions

* Fix for properties on objects > 4 GiB
* Performance improvements for QOM property handling
* Assertion cleanups
* MAINTAINERS additions

# gpg: Signature made Thu 19 Nov 2015 14:32:16 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <address@hidden>"
# gpg:                 aka "Andreas Färber <address@hidden>"

* remotes/afaerber/tags/qom-devices-for-peter:
  MAINTAINERS: Add check-qom-{interface,proplist} to QOM
  qom: Clean up assertions to display values on failure
  qom: Replace object property list with GHashTable
  qom: Add a test case for complex property finalization
  net: Convert net filter code to use object property iterators
  ppc: Convert spapr code to use object property iterators
  vl: Convert machine help code to use object property iterators
  qmp: Convert QMP code to use object property iterators
  qom: Introduce ObjectPropertyIterator struct for iteration
  qdev: Change Property::offset field to ptrdiff_t type

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/348c32709fdb...28c3e6ee72a3

reply via email to

[Prev in Thread] Current Thread [Next in Thread]