From: Paolo Bonzini <pbonzini@redhat.com>
To: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>, qemu-devel@nongnu.org
Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org,
igor.rubinov@gmail.com, mark.burton@greensocs.com,
real@ispras.ru, batuzovk@ispras.ru,
maria.klimushenkova@ispras.ru, stefanha@redhat.com,
kwolf@redhat.com, hines@cert.org, alex.bennee@linaro.org,
fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [PATCH v4 1/5] replay: character devices
Date: Thu, 10 Mar 2016 13:24:13 +0100 [thread overview]
Message-ID: <56E1676D.9000703@redhat.com> (raw)
In-Reply-To: <20160310115557.4812.55284.stgit@PASHA-ISP>
On 10/03/2016 12:55, Pavel Dovgalyuk wrote:
> gdbstub which also acts as a backend is not recorded to allow controlling
> the replaying through gdb.
Perhaps the monitor too?
Overall the patch is nice and can definitely go in 2.6, but there are a
couple changes to do...
> @@ -245,6 +246,9 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len)
> qemu_chr_fe_write_log(s, buf, ret);
> }
>
> + if (s->replay) {
> + replay_data_int(&ret);
> + }
I think this is wrong. The logic should be
if (replaying) {
read event(&ret);
assert(ret <= len);
len = ret;
}
qemu_mutex_lock(&s->chr_write_lock);
ret = s->chr_write(s, buf, len);
if (ret > 0) {
qemu_chr_fe_write_log(s, buf, ret);
}
qemu_mutex_unlock(&s->chr_write_lock);
if (recording) {
write event(ret);
}
> qemu_mutex_unlock(&s->chr_write_lock);
> return ret;
> }
> @@ -318,9 +322,19 @@ int qemu_chr_fe_read_all(CharDriverState *s, uint8_t *buf, int len)
>
> int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg)
> {
> - if (!s->chr_ioctl)
> - return -ENOTSUP;
> - return s->chr_ioctl(s, cmd, arg);
> + int res;
> + if (!s->chr_ioctl) {
> + res = -ENOTSUP;
> + } else {
> + res = s->chr_ioctl(s, cmd, arg);
> + if (s->replay) {
> + fprintf(stderr,
> + "Replay: ioctl is not supported for serial devices yet\n");
> + exit(1);
Is it possible to print this warning just once per device and return
-ENOTSUP instead?
> +void replay_register_char_driver(CharDriverState *chr)
> +{
> + if (replay_mode == REPLAY_MODE_NONE) {
> + return;
> + }
> + char_drivers = g_realloc(char_drivers,
> + sizeof(*char_drivers) * (drivers_count + 1));
> + char_drivers[drivers_count++] = chr;
> +}
You need a way to unregister character drivers when they are
hot-unplugged, or at least you should block chardev-del if in record and
replay mode.
> + /* for int data */
> + EVENT_DATA_INT,
I think you should call the event EVENT_CHAR_WRITE (and perhaps rename
REPLAY_ASYNC_EVENT_CHAR to REPLAY_ASYNC_EVENT_CHAR_READ). And as
mentioned above, I think the load and save cases should be separated in
qemu-char.c, so I'd prefer to have a separate function to read and write
the event as well.
Thanks,
Paolo
next prev parent reply other threads:[~2016-03-10 12:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 11:55 [Qemu-devel] [PATCH v4 0/5] Deterministic replay extensions Pavel Dovgalyuk
2016-03-10 11:55 ` [Qemu-devel] [PATCH v4 1/5] replay: character devices Pavel Dovgalyuk
2016-03-10 12:24 ` Paolo Bonzini [this message]
2016-03-11 6:19 ` Pavel Dovgalyuk
2016-03-11 10:06 ` Paolo Bonzini
2016-03-10 11:56 ` [Qemu-devel] [PATCH v4 2/5] icount: remove obsolete warp call Pavel Dovgalyuk
2016-03-10 12:11 ` Paolo Bonzini
2016-03-10 11:56 ` [Qemu-devel] [PATCH v4 3/5] icount: decouple warp calls Pavel Dovgalyuk
2016-03-10 12:10 ` Paolo Bonzini
2016-03-10 13:19 ` Pavel Dovgalyuk
2016-03-10 13:39 ` Paolo Bonzini
2016-03-10 11:56 ` [Qemu-devel] [PATCH v4 4/5] block: add flush callback Pavel Dovgalyuk
2016-03-10 11:56 ` [Qemu-devel] [PATCH v4 5/5] replay: introduce block devices record/replay Pavel Dovgalyuk
2016-03-11 13:58 ` Stefan Hajnoczi
2016-03-14 5:52 ` Pavel Dovgalyuk
2016-03-11 13:59 ` Stefan Hajnoczi
2016-03-14 5:53 ` Pavel Dovgalyuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E1676D.9000703@redhat.com \
--to=pbonzini@redhat.com \
--cc=Pavel.Dovgaluk@ispras.ru \
--cc=alex.bennee@linaro.org \
--cc=batuzovk@ispras.ru \
--cc=edgar.iglesias@xilinx.com \
--cc=fred.konrad@greensocs.com \
--cc=hines@cert.org \
--cc=igor.rubinov@gmail.com \
--cc=kwolf@redhat.com \
--cc=maria.klimushenkova@ispras.ru \
--cc=mark.burton@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=real@ispras.ru \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).