On Tue, 13 Aug 2019 11:15:34 +0200, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > On 09/08/19 17:59, Adalbert Lazăr wrote: > > +If `now` is 1, the command reply is enabled/disabled (according to > > +`enable`) starting with the current command. For example, `enable=0` > > +and `now=1` means that the reply is disabled for this command too, > > +while `enable=0` and `now=0` means that a reply will be send for this > > +command, but not for the next ones (until enabled back with another > > +*KVMI_CONTROL_CMD_RESPONSE*). > > + > > +This command is used by the introspection tool to disable the replies > > +for commands returning an error code only (eg. *KVMI_SET_REGISTERS*) > > +when an error is less likely to happen. For example, the following > > +commands can be used to reply to an event with a single `write()` call: > > + > > + KVMI_CONTROL_CMD_RESPONSE enable=0 now=1 > > + KVMI_SET_REGISTERS vcpu=N > > + KVMI_EVENT_REPLY vcpu=N > > + KVMI_CONTROL_CMD_RESPONSE enable=1 now=0 > > I don't understand the usage. Is there any case where you want now == 1 > actually? Can you just say that KVMI_CONTROL_CMD_RESPONSE never has a > reply, or to make now==enable? The enable=1 now=1 is for pause VM: KVMI_CONTROL_CMD_RESPONSE enable=0 now=1 KVMI_PAUSE_VCPU 0 KVMI_PAUSE_VCPU 1 ... KVMI_CONTROL_CMD_RESPONSE enable=1 now=1 We wait for a reply to make sure the vCPUs were stopped without waiting for their pause events. We can get around from userspace, if you like: KVMI_CONTROL_CMD_RESPONSE enable=0 now=1 KVMI_PAUSE_VCPU 0 KVMI_PAUSE_VCPU 1 ... KVMI_PAUSE_VCPU N-2 KVMI_CONTROL_CMD_RESPONSE enable=1 now=0 KVMI_PAUSE_VCPU N-1 > > > + if (err) > > + kvmi_warn(ikvm, "Error code %d discarded for message id %d\n", > > + err, msg->id); > > + > > Would it make sense to even close the socket if there is an error? > > Paolo Sure.