On 14/06/2017 16:20, Roman Kagan wrote: > On Wed, Jun 14, 2017 at 01:19:21PM +0200, Paolo Bonzini wrote: >> On 06/06/2017 20:19, Roman Kagan wrote: >>> +typedef struct MsgHandler { >>> + struct rcu_head rcu; >>> + QLIST_ENTRY(MsgHandler) le; >>> + uint32_t conn_id; >>> + HvMsgHandler handler; >>> + void *data; >>> +} MsgHandler; >>> + >>> +static QLIST_HEAD(, MsgHandler) msg_handlers; >>> +static QemuMutex msg_handlers_mutex; >> >> Maybe use the same mutex for event and message handlers? > > Are there other benefits in it beside saving 40 bytes?
It's generally simpler if one module only uses one mutex, you don't have to think of the interactions. Since everything is RCU-protected on the read-side, it should not matter for performance. Paolo