From: Peter Maydell <peter.maydell@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
qemu-arm@nongnu.org, Thomas Huth <thuth@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 6/7] tests/qtest: tighten up the checks on clock_step
Date: Tue, 21 Jan 2025 13:04:56 +0000 [thread overview]
Message-ID: <CAFEAcA_qceSO9be7wSj6U2a9yDvj9VhjQZuRugzGKsae+wEoog@mail.gmail.com> (raw)
In-Reply-To: <20250120210212.3890255-7-alex.bennee@linaro.org>
On Mon, 20 Jan 2025 at 21:02, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> It is invalid to call clock_step with an implied time to step forward
> as if no timers are running we won't be able to advance.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> system/qtest.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/system/qtest.c b/system/qtest.c
> index 28b6fac37c..1a9bfd0b33 100644
> --- a/system/qtest.c
> +++ b/system/qtest.c
> @@ -708,10 +708,15 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> } else {
> ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
> QEMU_TIMER_ATTR_ALL);
> + if (ns < 0) {
> + qtest_send(chr, "FAIL "
> + "no timers for clock_step to follow\n");
I think I would say
"cannot advance clock to the next deadline because there is no pending deadline"
as being a bit clearer about what's gone wrong here.
> + return;
> + }
> }
> new_ns = qemu_clock_advance_virtual_time(old_ns + ns);
> qtest_sendf(chr, "%s %"PRIi64"\n",
> - new_ns > old_ns ? "OK" : "FAIL", new_ns);
> + new_ns > old_ns ? "OK" : "FAIL could not advance time", new_ns);
Maybe we should give up on trying to handle the OK and FAIL
cases in the same qtest_sendf() call? It's not clear to me that
printing the new clock value in the FAIL message is actually
useful.
For that matter, is it actually possible for the clock to not
advance? It doesn't seem obvious that "advance the clock by 0 ticks"
should be a failure case rather than a "does nothing" case,
and once patch 7 is applied I don't think there's any case
where qemu_clock_advance_virtual_time() could make the
clock go backwards... Put another way, this would be moving
back to the situation before your commit d524441a3610b.
thanks
-- PMM
next prev parent reply other threads:[~2025-01-21 13:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 21:02 [PATCH 0/7] testing/next (qtest timer stuff) Alex Bennée
2025-01-20 21:02 ` [PATCH 1/7] tests/docker: replicate the check-rust-tools-nightly CI job Alex Bennée
2025-01-20 21:02 ` [PATCH 2/7] tests/qtest: don't attempt to clock_step while waiting for virtio ISR Alex Bennée
2025-01-21 5:13 ` Thomas Huth
2025-01-20 21:02 ` [PATCH 3/7] tests/qtest: don't step clock at start of npcm7xx periodic IRQ test Alex Bennée
2025-01-21 12:52 ` Thomas Huth
2025-01-20 21:02 ` [PATCH 4/7] tests/qtest: simplify qtest_process_inbuf Alex Bennée
2025-01-20 21:02 ` [PATCH 5/7] tests/qtest: rename qtest_send_prefix and roll-up into qtest_send Alex Bennée
2025-01-20 22:05 ` Daniel Henrique Barboza
2025-01-20 21:02 ` [PATCH 6/7] tests/qtest: tighten up the checks on clock_step Alex Bennée
2025-01-21 13:04 ` Peter Maydell [this message]
2025-01-20 21:02 ` [PATCH 7/7] Revert "util/timer: avoid deadlock when shutting down" Alex Bennée
2025-01-21 12:51 ` [PATCH 0/7] testing/next (qtest timer stuff) Thomas Huth
2025-01-21 13:50 ` Fabiano Rosas
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=CAFEAcA_qceSO9be7wSj6U2a9yDvj9VhjQZuRugzGKsae+wEoog@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@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).