On 01/24/2018 05:16 AM, Paolo Bonzini wrote: > On 22/01/2018 13:14, Vladimir Sementsov-Ogievskiy wrote: >>> so, accessing the bitmap needs mutex lock? >>> >>> Then what do you mean under accessing the bitmap? Any touch of >>> BdrvDirtyBitmap fields? Then "reading the list" will require bitmap >>> mutex too. >>> Or accessing the bitmap is accessing any field except >>> BdrvDirtyBitmap.list? Then in (2), what do you mean? For example >>> query-block will go through >>> the list, but it touches other fields too, so it should lock mutex. > > The bitmap mutex is internal to block/dirty-bitmap.c. > >> and one more question: >> >> What about qmp transactions? Should we lock mutex during the whole >> transaction? > > Transactions hold the BQL, but you don't need to lock the bitmap mutex. > > Paolo >
I would further add that attempting to lock all of the bitmap mutexes during a transaction might cause complications if you try to perform two actions on the same bitmap, and it deadlocks. With the BQL held we're probably okay, but worst-case scenario locking and unlocking per-each action is probably sufficient, I'd think.