All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] stop the periodic RTC update timer
Date: Thu, 12 Jan 2012 10:41:04 +0100	[thread overview]
Message-ID: <jem9rg$570$1@dough.gmane.org> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E025358@SHSMSX102.ccr.corp.intel.com>

On 01/12/2012 01:51 AM, Zhang, Yang Z wrote:
>> QEMU not being a simulator means that we always assume that the RTC is
>> programmed for a 32768 Hz clock, for example, because any other setting would
>> not make sense on a PC.  We can use a 1-second (or higher, as in your patches)
>> timer, rather than a 32768 Hz timer which anyway would not work well.
>>
>> So we're taking shortcuts, but each of them must be evaluated separately, and
>> _this_ shortcut is not acceptable.
>>
>>> Also, is there an actual case that break with my patch?
>>
>> Any decent unit test for the RTC would break.
>
> Any decent unit test break the following logic too. The spec provide
> three ways for you to program, why we only focus on 0x20? Because this
> is for emulation not for hardware simulation. Because no real OS set it
> to other value.

No, because those bits are supposed to be 0/1/2 depending on the 
frequency of the crystal that is attached to the RTC.  The RTC will not 
operate correctly unless the value and the actual frequency are the same.

A parameter to the unit test would be the frequency of the crystal.  It 
would always be 32768 Hz, thus the unit test will always write 0x20 (or 
0x60/0x70 to reset).

Testing with a different oscillator frequency would be possible and 
indeed would fail, but it would also be kind of useless.

>>>> It means that the (not externally visible) millisecond value is set
>>>> to 500 when you modify the current time of the RTC.  The next update
>>>> of the clock will happen exactly 500 ms after you reset bit
>>>> 7 of register B.
>>>
>>> Same question, any reason need to complicate the current logic? Or any
>>> actual usage model need to add this?
>>
>> Is it really so difficult to implement?
>
> I think what we are talking is do we really need it? Not how difficult to add it.

Sure; but since you're overhauling the whole model, it seems like a good 
occasion to make things better, too.

>> Note that this case is mentioned in drivers/rtc/rtc-cmos.c in the Linux source
>> code, even though it is not used.
>
> Yes, it just mentioned the next update will happen in 500ms later.
> What's wrong with this? The highest resolution of RTC is 1 second, if
> any software intend to use RTC do some check within 1 second, it should
> be wrong.

The highest resolution of the RTC is 1 second, but synchronizing the 
updates with other external clock sources could be a valuable thing. 
Knowing the time of the next update lets you do this kind of 
synchronization.

Paolo


  reply	other threads:[~2012-01-12  9:41 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  7:37 [PATCH 3/3] stop the periodic RTC update timer Zhang, Yang Z
2012-01-06  7:37 ` [Qemu-devel] " Zhang, Yang Z
2012-01-06 17:26 ` Jan Kiszka
2012-01-06 17:26   ` [Qemu-devel] " Jan Kiszka
2012-01-09  7:10   ` Zhang, Yang Z
2012-01-09  7:10     ` [Qemu-devel] " Zhang, Yang Z
2012-01-09  8:19 ` Paolo Bonzini
2012-01-09  8:19   ` [Qemu-devel] " Paolo Bonzini
2012-01-10  6:37   ` Zhang, Yang Z
2012-01-10  6:37     ` [Qemu-devel] " Zhang, Yang Z
2012-01-10  9:24     ` Paolo Bonzini
2012-01-10  9:24       ` [Qemu-devel] " Paolo Bonzini
2012-01-11  0:56       ` Zhang, Yang Z
2012-01-11  0:56         ` [Qemu-devel] " Zhang, Yang Z
2012-01-11  7:24         ` Paolo Bonzini
2012-01-11  7:24           ` [Qemu-devel] " Paolo Bonzini
2012-01-12  0:51           ` Zhang, Yang Z
2012-01-12  0:51             ` [Qemu-devel] " Zhang, Yang Z
2012-01-12  9:41             ` Paolo Bonzini [this message]
2012-01-11  7:25         ` Philipp Hahn
2012-01-11 13:10 ` Marcelo Tosatti
2012-01-11 13:10   ` [Qemu-devel] " Marcelo Tosatti
2012-01-12  0:00   ` Zhang, Yang Z
2012-01-12  0:00     ` [Qemu-devel] " Zhang, Yang Z
2012-01-12  9:26     ` Paolo Bonzini
2012-01-12  9:26       ` [Qemu-devel] " Paolo Bonzini
2012-01-12 10:20       ` Marcelo Tosatti
2012-01-12 10:20         ` [Qemu-devel] " Marcelo Tosatti
2012-01-12 10:43         ` Paolo Bonzini
2012-01-12 10:43           ` [Qemu-devel] " Paolo Bonzini
2012-01-12  9:59     ` Marcelo Tosatti
2012-01-12  9:59       ` [Qemu-devel] " Marcelo Tosatti
2012-01-12 10:03       ` Marcelo Tosatti
2012-01-12 10:03         ` [Qemu-devel] " Marcelo Tosatti
2012-01-12 10:12         ` Zhang, Yang Z
2012-01-12 10:12           ` [Qemu-devel] " Zhang, Yang Z

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='jem9rg$570$1@dough.gmane.org' \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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 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.