On Mon 26 Jun 2017 06:58:32 PM CEST, Manos Pitsidianakis wrote: > On Mon, Jun 26, 2017 at 03:52:34PM +0100, Stefan Hajnoczi wrote: >>On Fri, Jun 23, 2017 at 03:46:56PM +0300, Manos Pitsidianakis wrote: >>> +static bool throttle_group_exists(const char *name) >>> +{ >>> + ThrottleGroup *iter; >>> + bool ret = false; >>> + >>> + qemu_mutex_lock(&throttle_groups_lock); >> >>Not sure if this lock or the throttle_groups list are necessary.
As Manos says accesses to the throttle_groups list need to be locked. What I don't like at first sight is the code duplication in throttle_group_incref() and throttle_group_obj_complete(). >>Have you seen iothread.c:qmp_query_iothreads()? All objects are put >>into a container (the parent object), so you can just iterate over its >>children. There's no need for a separate list because QOM already has >>all the objects. I haven't looked into this yet but it could be a solution. Berto