Kouya Shimura
2013-Nov-07 07:32 UTC
[PATCH] x86/hvm: Fix restart of RTC periodic timer with vpt_align=1
The commit 58afa7ef "x86/hvm: Run the RTC periodic timer on a
consistent time series" aligns the RTC periodic timer to the VM''s
boot time.
However, it''s aligned later again to the system time in
create_periodic_time()
with vpt_align=1. The next tick might be skipped.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Cc: Tim Deegan <tim@xen.org>
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
---
xen/arch/x86/hvm/rtc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index d1a6848..cdedefe 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -130,7 +130,10 @@ static void rtc_timer_update(RTCState *s)
s->pt_code = period_code;
period = 1 << (period_code - 1); /* period in 32 Khz
cycles */
period = DIV_ROUND(period * 1000000000ULL, 32768); /* in ns */
- delta = period - ((NOW() - s->start_time) % period);
+ if (
v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] )
+ delta = 0;
+ else
+ delta = period - ((NOW() - s->start_time) % period);
create_periodic_time(v, &s->pt, delta, period,
RTC_IRQ, NULL, s);
}
--
1.7.9.5
Jan Beulich
2013-Nov-07 09:31 UTC
Re: [PATCH] x86/hvm: Fix restart of RTC periodic timer with vpt_align=1
>>> On 07.11.13 at 08:32, Kouya Shimura <kouya@jp.fujitsu.com> wrote: > The commit 58afa7ef "x86/hvm: Run the RTC periodic timer on a > consistent time series" aligns the RTC periodic timer to the VM''s boot time. > However, it''s aligned later again to the system time in create_periodic_time() > with vpt_align=1. The next tick might be skipped.I agree (read: ack), but will want to hear Tim''s opinion in any case before committing. Jan> Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com> > Cc: Tim Deegan <tim@xen.org> > Cc: Keir Fraser <keir@xen.org> > Cc: Jan Beulich <jbeulich@suse.com> > --- > xen/arch/x86/hvm/rtc.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c > index d1a6848..cdedefe 100644 > --- a/xen/arch/x86/hvm/rtc.c > +++ b/xen/arch/x86/hvm/rtc.c > @@ -130,7 +130,10 @@ static void rtc_timer_update(RTCState *s) > s->pt_code = period_code; > period = 1 << (period_code - 1); /* period in 32 Khz cycles */ > period = DIV_ROUND(period * 1000000000ULL, 32768); /* in ns > */ > - delta = period - ((NOW() - s->start_time) % period); > + if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] ) > + delta = 0; > + else > + delta = period - ((NOW() - s->start_time) % period); > create_periodic_time(v, &s->pt, delta, period, > RTC_IRQ, NULL, s); > } > -- > 1.7.9.5
Tim Deegan
2013-Nov-07 19:31 UTC
Re: [PATCH] x86/hvm: Fix restart of RTC periodic timer with vpt_align=1
At 16:32 +0900 on 07 Nov (1383838351), Kouya Shimura wrote:> The commit 58afa7ef "x86/hvm: Run the RTC periodic timer on a > consistent time series" aligns the RTC periodic timer to the VM''s boot time. > However, it''s aligned later again to the system time in create_periodic_time() > with vpt_align=1. The next tick might be skipped. > > Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>Acked-by: Tim Deegan <tim@xen.org>