nicolas.ochem | 15 Jun 2012 17:38
Picon
Favicon

UIP flag not cleared

Hi list, 

I am having troubles porting my os to qemu/kvm environment. It's about the RTC (real-time clock) 

There is a flag (UIP flag) which is supposed to show when RTC can be read or not. 

We wait 10ms for that flag to be cleared, but sometimes it's not enough with qemu/kvm. 

Is it necessary to check this flag at all ? or can I always read the RTC regardless of the status of the flag ? If
the latter is true, why then is this flag not always clear ? 

I'm using the virtualization stack of centos 6.2 

Thanks in advance 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Paolo Bonzini | 3 Jul 2012 15:28
Picon
Favicon
Gravatar

Re: UIP flag not cleared

Il 15/06/2012 17:38, nicolas.ochem <at> free.fr ha scritto:
> Hi list,
> 
> 
> I am having troubles porting my os to qemu/kvm environment. It's
> about the RTC (real-time clock)
> 
> There is a flag (UIP flag) which is supposed to show when RTC can be
> read or not.
> 
> We wait 10ms for that flag to be cleared, but sometimes it's not
> enough with qemu/kvm.

You need to wait more than 10ms then. :(  This will be fixed in QEMU
1.2, but you cannot rule out delays due to bad scheduling of the virtual
machine monitor (aka QEMU itself).

> Is it necessary to check this flag at all ? or can I always read the
> RTC regardless of the status of the flag ? If the latter is true, why
> then is this flag not always clear ?

Unlike real hardware, QEMU updates the time atomically; there are no
"invalid states" during the update of the RTC.  However, _reads_ of the
RTC are not atomic so you do need UIP.  UIP triggers 220 us *before* the
invalid state, so that if UIP=0 you have 220 us to read the RTC.  If
your reads take less than 220 us, they are guaranteed to be atomic.

If you need a workaround you can do the following (but it will break on
bare metal):

(Continue reading)


Gmane