All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Tyrone Ting" <kfting@nuvoton.com>,
	"Hao Wu" <wuhaotsh@google.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v1] tests/qtest: Avoid timers from default devices
Date: Tue, 28 Apr 2026 15:45:31 -0300	[thread overview]
Message-ID: <878qa6j54k.fsf@suse.de> (raw)
In-Reply-To: <CAJSP0QXAJvSbgjxfL2eOubzNa1i3Xqc2B_rykaXzYfi9d7FPJg@mail.gmail.com>

Stefan Hajnoczi <stefanha@gmail.com> writes:

> On Tue, Apr 28, 2026 at 12:04 PM Fabiano Rosas <farosas@suse.de> wrote:
>>
>> Having default devices enabled while testing timers leads to
>> non-deterministic behavior on the usage of the QTest
>> qtest_clock_step_next() command as the implicit devices can have
>> timers of their own that may have a deadline more recent than the
>> tested device.
>>
>> In the particular case of npcm7xx-timer-test, having SLIRP enabled in
>> the QEMU binary may cause the net_slirp_timer to shadow the clock
>> advance that was expected to trigger the NPCM7xx timer:
>>
>> npcm7xx_timer-test.c:475:test_periodic_interrupt:
>>   assertion failed (tim_read(td, TISR) == tim_timer_bit(td)): (0x00000000 == 0x00000010)
>> npcm7xx_timer-test.c:476:test_periodic_interrupt:
>> 'qtest_get_irq(global_qtest, tim_timer_irq(td))' should be TRUE
>>
>> Add the -nodefaults command line option to all tests that invoke
>> qtest_clock_step_next.
>>
>> CC: Alex Bennée <alex.bennee@linaro.org>
>> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>>  tests/qtest/npcm7xx_timer-test.c | 2 +-
>>  tests/qtest/pflash-cfi02-test.c  | 4 ++--
>>  tests/qtest/rtc-test.c           | 2 +-
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> Hi Fabiano,
> Thank you for the patch! I'm not sure this is a long-term fix since
> any code in QEMU could use timers (monitor, io channels, etc)?
>

Good point, if we go this way I'll add more words to the commit message
to make that pitfall clear.

@Alex, I was even under the impression that the issues with slirp timers
getting in the way of clock_step were entirely fixed by your changes
from:
https://lore.kernel.org/r/20250210161451.3273284-1-alex.bennee@linaro.org

Was that the intention at the time? Should we consider a timer test that
expects it to fire right after advancing the clock a mistake in the
test?

> Whether it is a full fix or not, it's definitely an improvement:
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>



      reply	other threads:[~2026-04-28 18:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 16:01 [PATCH v1] tests/qtest: Avoid timers from default devices Fabiano Rosas
2026-04-28 18:23 ` Stefan Hajnoczi
2026-04-28 18:45   ` Fabiano Rosas [this message]

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=878qa6j54k.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=kfting@nuvoton.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=wuhaotsh@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.