qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 15/15] qtest: add rtc-test test-case
Date: Wed, 11 Jan 2012 11:06:46 -0600	[thread overview]
Message-ID: <4F0DC1A6.7000605@codemonkey.ws> (raw)
In-Reply-To: <jei5a4$srb$2@dough.gmane.org>

On 01/10/2012 01:59 PM, Paolo Bonzini wrote:
> On 01/10/2012 08:10 PM, Anthony Liguori wrote:
>> + sec = cmos_read(0x00);
>> + min = cmos_read(0x02);
>> + hour = cmos_read(0x04);
>> + mday = cmos_read(0x07);
>> + mon = cmos_read(0x08);
>> + year = cmos_read(0x09);
>
> Please use identifiers for register numbers.
>
>> + /*
>> + * This check assumes a few things. First, we cannot guarantee that we get
>> + * a consistent reading from the wall clock because we may hit an edge of
>> + * the clock while reading. To work around this, we read four clock readings
>> + * such that at least two of them should match. We need to assume that one
>> + * reading is corrupt so we need four readings to ensure that we have at
>> + * least two consecutive identical readings
>> + *
>> + * It's also possible that we'll cross an edge reading the host clock so
>> + * simply check to make sure that the clock reading is within the period of
>> + * when we expect it to be.
>> + */
>
> This seems broken to me.

It's not broken, although it may be ugly.

> The right thing to do would be to run the test with
> vm_clock for the rtc_clock, add a way for the qtest machine to bump the vm_clock
> to the next event,

I actually was looking at this yesterday.  Just bumping to the next event is not 
enough, you want to be able to control how time progresses.  I was thinking of 
adding another qtest_clock and allowing the rtc to use the qtest_clock.

What's nice about that is that you can simulate long periods of time (2 years) 
in a short period of time and do long term drift testing.

I know the math in the rtc is broken right now because we assume that there's a 
rational conversion from RTC cycle frequency to nanoseconds which is not the 
case.  We need a more sophisticated approach that can maintain an irrational 
conversion factor (in the form of a fractional multiplier).

Regards,

Anthony Liguori

> and busy loop running that method using UIP like you would do
> on hardware.
>
> Paolo
>
>

  reply	other threads:[~2012-01-11 17:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10 19:10 [Qemu-devel] [PATCH 01/15] tests: mv tests/* -> tests/tcg Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 02/15] build: split unit test builds to a separate makefile fragment Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 03/15] check-qdict: convert to gtest Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 04/15] check-qfloat: " Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 05/15] check-qint: " Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 06/15] check-qstring: " Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 07/15] check-qlist: " Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 08/15] check-qjson: " Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 09/15] check-qjson: enable disabled tests Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 10/15] test: eliminate libcheck tests and have make check use gtester Anthony Liguori
2012-01-12 12:17   ` Eduardo Habkost
2012-01-13 10:58   ` [Qemu-devel] --enable-check-utests gone, you may have to re-run configure (was: [PATCH 10/15] test: eliminate libcheck tests and have make check use gtester) Markus Armbruster
2012-01-10 19:10 ` [Qemu-devel] [PATCH 11/15] qtest: add test framework Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 12/15] qtest: add support for target-i386 -M pc Anthony Liguori
2012-01-10 19:56   ` Paolo Bonzini
2012-01-11 19:44     ` Anthony Liguori
2012-01-12  9:25       ` Paolo Bonzini
2012-01-10 19:10 ` [Qemu-devel] [PATCH 13/15] qtest: add C version of test infrastructure Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 14/15] make: add check targets based on gtester Anthony Liguori
2012-01-10 19:10 ` [Qemu-devel] [PATCH 15/15] qtest: add rtc-test test-case Anthony Liguori
2012-01-10 19:59   ` Paolo Bonzini
2012-01-11 17:06     ` Anthony Liguori [this message]
2012-01-11 19:27       ` Paolo Bonzini
2012-01-10 22:35 ` [Qemu-devel] [PATCH 01/15] tests: mv tests/* -> tests/tcg Andreas Färber
2012-01-12 16:53 ` Anthony Liguori

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=4F0DC1A6.7000605@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).