# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID a1c2cede77c78d2af99088d7dece8f74f2a27260
# Parent f986ead202dcc2b8ae01b2d079ab33fc741d3f43
[HVM] Fix "Many lost ticks" warning in ia32e guest
Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>
Signed-off-by: Xiaowei Yang <xiaowei.yang@xxxxxxxxx>
---
xen/arch/x86/hvm/i8254.c | 10 ++++++++--
xen/arch/x86/hvm/intercept.c | 4 +++-
xen/arch/x86/hvm/vmx/io.c | 1 +
xen/include/asm-x86/hvm/vpit.h | 4 +++-
4 files changed, 15 insertions(+), 4 deletions(-)
diff -r f986ead202dc -r a1c2cede77c7 xen/arch/x86/hvm/i8254.c
--- a/xen/arch/x86/hvm/i8254.c Mon Jul 10 14:58:42 2006 +0100
+++ b/xen/arch/x86/hvm/i8254.c Mon Jul 10 15:01:49 2006 +0100
@@ -188,6 +188,12 @@ int pit_get_gate(PITState *pit, int chan
return s->gate;
}
+void pit_time_fired(struct vcpu *v, void *priv)
+{
+ PITChannelState *s = priv;
+ s->count_load_time = hvm_get_clock(v);
+}
+
static inline void pit_load_count(PITChannelState *s, int val)
{
u32 period;
@@ -209,11 +215,11 @@ static inline void pit_load_count(PITCha
switch (s->mode) {
case 2:
/* create periodic time */
- s->pt = create_periodic_time (s->vcpu, period, 0, 0);
+ s->pt = create_periodic_time (s, period, 0, 0);
break;
case 1:
/* create one shot time */
- s->pt = create_periodic_time (s->vcpu, period, 0, 1);
+ s->pt = create_periodic_time (s, period, 0, 1);
#ifdef DEBUG_PIT
printk("HVM_PIT: create one shot time.\n");
#endif
diff -r f986ead202dc -r a1c2cede77c7 xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c Mon Jul 10 14:58:42 2006 +0100
+++ b/xen/arch/x86/hvm/intercept.c Mon Jul 10 15:01:49 2006 +0100
@@ -261,11 +261,12 @@ void pickup_deactive_ticks(struct period
* period: fire frequency in ns.
*/
struct periodic_time * create_periodic_time(
- struct vcpu *v,
+ PITChannelState *s,
u32 period,
char irq,
char one_shot)
{
+ struct vcpu *v = s->vcpu;
struct periodic_time *pt =
&(v->domain->arch.hvm_domain.pl_time.periodic_tm);
if ( pt->enabled ) {
if ( v->vcpu_id != 0 ) {
@@ -290,6 +291,7 @@ struct periodic_time * create_periodic_t
pt->scheduled = NOW() + period;
set_timer (&pt->timer,pt->scheduled);
pt->enabled = 1;
+ pt->priv = s;
return pt;
}
diff -r f986ead202dc -r a1c2cede77c7 xen/arch/x86/hvm/vmx/io.c
--- a/xen/arch/x86/hvm/vmx/io.c Mon Jul 10 14:58:42 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/io.c Mon Jul 10 15:01:49 2006 +0100
@@ -75,6 +75,7 @@ interrupt_post_injection(struct vcpu * v
pt->pending_intr_nr--;
pt->last_plt_gtime += pt->period_cycles;
set_guest_time(v, pt->last_plt_gtime);
+ pit_time_fired(v, pt->priv);
}
}
diff -r f986ead202dc -r a1c2cede77c7 xen/include/asm-x86/hvm/vpit.h
--- a/xen/include/asm-x86/hvm/vpit.h Mon Jul 10 14:58:42 2006 +0100
+++ b/xen/include/asm-x86/hvm/vpit.h Mon Jul 10 15:01:49 2006 +0100
@@ -64,6 +64,7 @@ struct periodic_time {
s_time_t scheduled; /* scheduled timer interrupt */
u64 last_plt_gtime; /* platform time when last IRQ is injected */
struct timer timer; /* ac_timer */
+ void *priv; /* ponit back to platform time source */
};
typedef struct PITState {
@@ -93,9 +94,10 @@ extern void hvm_hooks_assist(struct vcpu
extern void hvm_hooks_assist(struct vcpu *v);
extern void pickup_deactive_ticks(struct periodic_time *vpit);
extern u64 hvm_get_guest_time(struct vcpu *v);
-extern struct periodic_time *create_periodic_time(struct vcpu *v, u32 period,
char irq, char one_shot);
+extern struct periodic_time *create_periodic_time(PITChannelState *v, u32
period, char irq, char one_shot);
extern void destroy_periodic_time(struct periodic_time *pt);
void pit_init(struct vcpu *v, unsigned long cpu_khz);
void pt_timer_fn(void *data);
+void pit_time_fired(struct vcpu *v, void *priv);
#endif /* __ASM_X86_HVM_VPIT_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|