Eric Blake <ebl...@redhat.com> writes: > On 06/27/2018 07:07 AM, Peter Xu wrote: > >>>> Worse than that - broadcasting to all monitors is categorically broken. >>>> Different monitors make use the same "id" formatting scheme, so if you >>>> broadcast COMMAND_DROPPED to a different monitor you might have clashing >>>> "id" and thus incorrectly tell a client its command was dropped when in >>>> fact it was processed. You'd have to be fairly unlucky in timing, but >>>> it could happen. >>> >>> Right. Must fix bug. >> > >> >> My current plan is that I can touch up scripts/qapi/events.py and >> related stuff to allow QMPEventFuncEmit to take a monitor parameter, >> then we pass in NULL when we want to send the event to all monitors. >> >> Would that work? > > Makes sense to me. Also, right now, ALL callers of qapi_event_send_* > pass &error_abort as their final parameter. If you're refactoring > everything anyways, you could get rid of that parameter on the > presumption that it doesn't buy us anything.
Let me try to turn presumption into fact :) The generated qapi_event_send_FOO() can detect the following error conditions: * Visitor fails. But the QObject output visitor can't actually fail. Since the errp parameter is part of the abstract visitor interface, we can't eliminate it. We can pass &error_abort. * emit() function fails. Can't happen, either. Let's eliminate the unused errp parameter of QMPEventFuncEmit. If we can eliminate the somewhat silly indirection through qmp_event_get_func_emit(), even better.