[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v8 21/21] replay: recording of the user inpu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH v8 21/21] replay: recording of the user input |
Date: |
Fri, 30 Jan 2015 12:23:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 22/01/2015 09:53, Pavel Dovgalyuk wrote:
> +void replay_input_event(QemuConsole *src, InputEvent *evt)
> +{
> + if (replay_mode == REPLAY_MODE_PLAY) {
> + /* Nothing */
> + } else if (replay_mode == REPLAY_MODE_RECORD) {
> + replay_add_input_event(evt);
Does replay_add_input_event ultimately call qemu_input_event_send_impl?
> + } else {
> + qemu_input_event_send_impl(src, evt);
> + }
> +}
> +
Perhaps make this and replay_input_sync_event return a bool and in the
caller do:
if (replay_input_event(src, evt)) {
qemu_input_event_send_impl(src, evt):
}
> + if (replay_mode != REPLAY_MODE_PLAY) {
> + evt = qemu_input_event_new_key(key, down);
> + if (QTAILQ_EMPTY(&kbd_queue)) {
> + qemu_input_event_send(src, evt);
> + qemu_input_event_sync();
> + if (replay_mode != REPLAY_MODE_RECORD) {
> + qapi_free_InputEvent(evt);
> + }
This is wrong. You have different lifetimes for different modes. Please
make a copy of the event in the implementation of record mode.
Also, you do not need the "if" for replay mode. The functions would
just do nothing.
> + } else {
> + if (replay_mode != REPLAY_MODE_NONE) {
> + fprintf(stderr, "Input queue is not supported "
> + "in record/replay mode\n");
> + exit(1);
Why? For record mode should just work since qemu_input_event_send is
called in qemu_input_queue_process.
Replay mode can just do nothing, by returning early from
qemu_input_queue_event/qemu_input_queue_sync.
Paolo
> + }
> + qemu_input_queue_event(&kbd_queue, src, evt);
> + qemu_input_queue_sync(&kbd_queue);
> + }
> }
- Re: [Qemu-devel] [RFC PATCH v8 16/21] replay: bottom halves, (continued)
- [Qemu-devel] [RFC PATCH v8 17/21] replay: replay aio requests, Pavel Dovgalyuk, 2015/01/22
- [Qemu-devel] [RFC PATCH v8 18/21] replay: thread pool, Pavel Dovgalyuk, 2015/01/22
- [Qemu-devel] [RFC PATCH v8 19/21] replay: initialization and deinitialization, Pavel Dovgalyuk, 2015/01/22
- [Qemu-devel] [RFC PATCH v8 20/21] replay: command line options, Pavel Dovgalyuk, 2015/01/22
- [Qemu-devel] [RFC PATCH v8 21/21] replay: recording of the user input, Pavel Dovgalyuk, 2015/01/22
- Re: [Qemu-devel] [RFC PATCH v8 21/21] replay: recording of the user input,
Paolo Bonzini <=
- Re: [Qemu-devel] [RFC PATCH v8 00/21] Deterministic replay core, Pavel Dovgaluk, 2015/01/28
- Message not available