qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 15/15] qtest: add rtc-test test-case


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 15/15] qtest: add rtc-test test-case
Date: Tue, 10 Jan 2012 20:59:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

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. 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, and busy loop running that method using UIP like you would do on hardware.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]