On 19/10/2017 15:13, Stefan Hajnoczi wrote: > Up to you. I don't remember the details of out_lock usage well enough > to know whether using the lock for the queues is good or bad.
out_lock is called like that because it's only writes that can be done from multiple threads (at both the chardev and monitor level). IOThreads in particular want to generate QMP events. out_lock protects the monitor's own output buffer, while the character device layer has its own locking (chr_write_lock). chr_write_lock protects calls to the chr_write method of the Chardev object and writes to the character device's logfd. Renaming out_lock and reusing it is just fine if the lock is only held for short periods of time. But maybe it's simpler to just introduce another lock, since the out_lock rules are very simple. Paolo