On Wed 02 Aug 2017 12:57:04 PM CEST, Manos Pitsidianakis wrote: >> At the moment I think throttle_groups_lock isn't strictly needed >> because incref/decref callers hold the QEMU global mutex anyway. >> >> But code accessing throttle_groups still has to be disciplined. >> Since throttle_groups_lock exists, please use it consistently in all >> code paths. >> >> Alternatively you could remove the lock and document that >> throttle_groups is protected by the global mutex. What we can't do >> is sometimes use throttle_groups_lock and sometimes not use it. > > If we use throttle_groups_lock in throttle_group_obj_init() then we > must give it up in throttle_group_incref() and retake it in > throttle_group_obj_init(). Maybe indeed it's better to drop > throttle_groups_lock altogether, since the ThrottleGroup refcounting > always happens in a QMP or startup/cleanup context.
I checked the code and I also don't see any manipulation of the group list outside the global mutex, so you can remove throttle_groups_lock, but please document very clearly that all these calls can only happen when they are protected by the global mutex. Berto