From: Paolo Bonzini <pbonzini@redhat.com>
To: Claudio Fontana <cfontana@suse.de>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
qemu-devel@nongnu.org, "Pavel Dovgalyuk" <dovgaluk@ispras.ru>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [RFC v1 4/4] replay: do not build if TCG is not available
Date: Fri, 9 Oct 2020 18:01:09 +0200 [thread overview]
Message-ID: <4f4b4f12-0fdb-9c20-da3d-af222a69265e@redhat.com> (raw)
In-Reply-To: <20201009152108.16120-5-cfontana@suse.de>
On 09/10/20 17:21, Claudio Fontana wrote:
> replay requires icount, which needs TCG.
>
> stub the needed functions in stub/,
> including errors for hmp and qmp commands.
>
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
Looks plausible, though probably I'd put it in replay/stubs.c and use
if_false to link it.
Paolo
> ---
> migration/savevm.c | 11 +++--
> replay/meson.build | 2 +-
> stubs/replay.c | 99 ++++++++++++++++++++++++++++++++++++++
> tests/qtest/qmp-cmd-test.c | 3 ++
> 4 files changed, 110 insertions(+), 5 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index d2e141f7b1..d9181ca520 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -63,6 +63,7 @@
> #include "migration/colo.h"
> #include "qemu/bitmap.h"
> #include "net/announce.h"
> +#include "sysemu/tcg.h"
>
> const unsigned int postcopy_ram_discard_version = 0;
>
> @@ -2674,10 +2675,12 @@ int save_snapshot(const char *name, Error **errp)
> return ret;
> }
>
> - if (!replay_can_snapshot()) {
> - error_setg(errp, "Record/replay does not allow making snapshot "
> - "right now. Try once more later.");
> - return ret;
> + if (tcg_enabled()) {
> + if (!replay_can_snapshot()) {
> + error_setg(errp, "Record/replay does not allow making snapshot "
> + "right now. Try once more later.");
> + return ret;
> + }
> }
>
> if (!bdrv_all_can_snapshot(&bs)) {
> diff --git a/replay/meson.build b/replay/meson.build
> index f91163fb1e..cb3207740a 100644
> --- a/replay/meson.build
> +++ b/replay/meson.build
> @@ -1,4 +1,4 @@
> -softmmu_ss.add(files(
> +softmmu_ss.add(when: 'CONFIG_TCG', if_true: files(
> 'replay.c',
> 'replay-internal.c',
> 'replay-events.c',
> diff --git a/stubs/replay.c b/stubs/replay.c
> index 45ebe77fb9..ff35daf198 100644
> --- a/stubs/replay.c
> +++ b/stubs/replay.c
> @@ -103,3 +103,102 @@ bool replay_reverse_continue(void)
> {
> return false;
> }
> +
> +void replay_add_blocker(Error *reason)
> +{
> +}
> +void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t size)
> +{
> +}
> +void replay_audio_out(size_t *played)
> +{
> +}
> +void replay_bh_schedule_event(QEMUBH *bh)
> +{
> +}
> +void replay_breakpoint(void)
> +{
> +}
> +bool replay_can_snapshot(void)
> +{
> + return false;
> +}
> +void replay_configure(struct QemuOpts *opts)
> +{
> +}
> +void replay_flush_events(void)
> +{
> +}
> +void replay_gdb_attached(void)
> +{
> +}
> +void replay_input_event(QemuConsole *src, InputEvent *evt)
> +{
> +}
> +void replay_input_sync_event(void)
> +{
> +}
> +void replay_net_packet_event(ReplayNetState *rns, unsigned flags,
> + const struct iovec *iov, int iovcnt)
> +{
> +}
> +ReplayNetState *replay_register_net(NetFilterState *nfs)
> +{
> + return NULL;
> +}
> +bool replay_running_debug(void)
> +{
> + return false;
> +}
> +void replay_shutdown_request(ShutdownCause cause)
> +{
> +}
> +void replay_start(void)
> +{
> +}
> +void replay_unregister_net(ReplayNetState *rns)
> +{
> +}
> +void replay_vmstate_init(void)
> +{
> +}
> +
> +#include "monitor/monitor.h"
> +#include "monitor/hmp.h"
> +#include "qapi/qapi-commands-replay.h"
> +#include "qapi/error.h"
> +#include "qemu/error-report.h"
> +
> +void hmp_info_replay(Monitor *mon, const QDict *qdict)
> +{
> + error_report("replay support not available\n");
> +}
> +void hmp_replay_break(Monitor *mon, const QDict *qdict)
> +{
> + error_report("replay support not available\n");
> +}
> +void hmp_replay_delete_break(Monitor *mon, const QDict *qdict)
> +{
> + error_report("replay support not available\n");
> +}
> +void hmp_replay_seek(Monitor *mon, const QDict *qdict)
> +{
> + error_report("replay support not available\n");
> +}
> +ReplayInfo *qmp_query_replay(Error **errp)
> +{
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, "replay support not available");
> + return NULL;
> +}
> +void qmp_replay_break(int64_t icount, Error **errp)
> +{
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, "replay support not available");
> +}
> +void qmp_replay_delete_break(Error **errp)
> +{
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, "replay support not available");
> +}
> +void qmp_replay_seek(int64_t icount, Error **errp)
> +{
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, "replay support not available");
> +}
> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
> index 8a4c570e83..1c7186e53c 100644
> --- a/tests/qtest/qmp-cmd-test.c
> +++ b/tests/qtest/qmp-cmd-test.c
> @@ -31,6 +31,9 @@ static int query_error_class(const char *cmd)
> #ifndef CONFIG_SPICE
> { "query-spice", ERROR_CLASS_COMMAND_NOT_FOUND },
> #endif
> +#ifndef CONFIG_TCG
> + { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND },
> +#endif
> #ifndef CONFIG_VNC
> { "query-vnc", ERROR_CLASS_GENERIC_ERROR },
> { "query-vnc-servers", ERROR_CLASS_GENERIC_ERROR },
>
next prev parent reply other threads:[~2020-10-09 16:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-09 15:21 [RFC v1 0/4] unbreak non-tcg builds Claudio Fontana
2020-10-09 15:21 ` [RFC v1 1/4] tests/Makefile.include: " Claudio Fontana
2020-10-09 17:10 ` Paolo Bonzini
2020-10-09 15:21 ` [RFC v1 2/4] qtest: unbreak non-TCG builds in bios-tables-test Claudio Fontana
2020-10-09 16:01 ` Paolo Bonzini
2020-10-09 15:21 ` [RFC v1 3/4] qtest: do not build ide-test if TCG is not available Claudio Fontana
2020-10-09 16:01 ` Paolo Bonzini
2020-10-10 10:50 ` Claudio Fontana
2020-10-12 10:14 ` Claudio Fontana
2020-10-12 10:32 ` Claudio Fontana
2020-10-09 15:21 ` [RFC v1 4/4] replay: do not build " Claudio Fontana
2020-10-09 16:01 ` Paolo Bonzini [this message]
2020-10-09 15:30 ` [RFC v1 0/4] unbreak non-tcg builds no-reply
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=4f4b4f12-0fdb-9c20-da3d-af222a69265e@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=cfontana@suse.de \
--cc=dovgaluk@ispras.ru \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).