On Thu, Jan 12, 2012 at 10:26:17AM +0100, Paolo Bonzini wrote: > On 01/12/2012 01:00 AM, Zhang, Yang Z wrote: > >>Regarding the UIP bit, a guest could read it in a loop and wait > >>for the value to change. But you can emulate it in > >>cmos_ioport_read by reading the host time, that is, return 1 > >>during 244us, 0 for remaining of the second, and have that in > >>sync with update-cycle-ended interrupt if its enabled. > > > >Yes. Guest may use the loop to read RTC, but the point is the guest > >is waiting for the UIP changed to 0. If this bit always equal to 0 , > >guest will never go into the loop. For real RTC, this may wrong, > >because the RTC cannot give you the valid value during the update > >cycle. But the virtual RTC doesn't' need this logic, whenever you > >read it, it will always return the right value to you. > > The point is not _correctness_. It is _atomicity_. Quoting you earlier "This is incorrect, for two reasons. First, the UIP is in the spec, and we have to implement it. Second, reading the clock is not atomic, and waiting for UIP=0 gives you 220 microseconds during which you know that the read will appear atomic." Agree with the first point, but the second, the emulated RTC never returns a bogus read. So what is your point, exactly? And what that has to do with UIP always returning 0? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html