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

Re: [Xen-devel] [PATCH 4/4] x86/hvm: Let the guest miss a few ticks before resetting the timer.



>>> On 28.03.13 at 14:22, Tim Deegan <tim@xxxxxxx> wrote:

Interesting. And you say this is the most important one. Gets us
somewhere in the middle of 4.2 and recent code, which I guess is
quite fine. Thanks for working out all this!

Jan

> --- a/xen/arch/x86/hvm/rtc.c
> +++ b/xen/arch/x86/hvm/rtc.c
> @@ -77,16 +77,17 @@ void rtc_periodic_interrupt(void *opaque)
>      RTCState *s = opaque;
>  
>      spin_lock(&s->lock);
> -    if ( s->hw.cmos_data[RTC_REG_C] & RTC_PF )
> -    {
> -        destroy_periodic_time(&s->pt);
> -        s->pt_active = 0;
> -    }
> -    else
> +    if ( !(s->hw.cmos_data[RTC_REG_C] & RTC_PF) )
>      {
>          s->hw.cmos_data[RTC_REG_C] |= RTC_PF;
>          rtc_update_irq(s);
>      }
> +    else if ( ++(s->pt_dead_ticks) >= 10 )
> +    {
> +        /* VM is ignoring its RTC; no point in running the timer */
> +        destroy_periodic_time(&s->pt);
> +        s->pt_active = 0;
> +    }
>      spin_unlock(&s->lock);
>  }
>  
> @@ -99,6 +100,8 @@ static void rtc_timer_update(RTCState *s)
>  
>      ASSERT(spin_is_locked(&s->lock));
>  
> +    s->pt_dead_ticks = 0;
> +
>      period_code = s->hw.cmos_data[RTC_REG_A] & RTC_RATE_SELECT;
>      switch ( s->hw.cmos_data[RTC_REG_A] & RTC_DIV_CTL )
>      {
> diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
> index 76a83a1..4d274d3 100644
> --- a/xen/include/asm-x86/hvm/vpt.h
> +++ b/xen/include/asm-x86/hvm/vpt.h
> @@ -115,6 +115,7 @@ typedef struct RTCState {
>      s_time_t start_time;
>      int period;
>      bool_t pt_active;
> +    uint8_t pt_dead_ticks;
>      uint32_t use_timer;
>      spinlock_t lock;
>  } RTCState;
> -- 
> 1.7.10.4




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.