--- On Sat, 4/19/08, Marcelo Tosatti <[EMAIL PROTECTED]> wrote:
> From: Marcelo Tosatti <[EMAIL PROTECTED]>
> Subject: Re: [kvm-devel] Second KVM process hangs eating 80-100% CPU on host
> during startup
> To: "Alex Davis" <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED], [email protected]
> Date: Saturday, April 19, 2008, 7:11 PM
> On Sat, Apr 19, 2008 at 03:47:31PM -0700, Alex Davis wrote:
> > --- On Fri, 4/18/08, Avi Kivity
> <[EMAIL PROTECTED]> wrote:
> >
> > > From: Avi Kivity <[EMAIL PROTECTED]>
> > > Subject: Re: [kvm-devel] Second KVM process hangs
> eating 80-100% CPU on host during startup
> > [snip]
> >
> > I tried booting the guest with 'lpj=10682525'
> to work around the
> > calibrate_delay issue, but that gave me:
> >
> > [ 0.004100] ENABLING IO-APIC IRQs
> > [ 0.004100] ..TIMER: vector=0x31 apic1=0 pin1=0
> apic2=-1 pin2=-1
> > [ 0.004100] ..MP-BIOS bug: 8254 timer not connected
> to IO-APIC
> > [ 0.004100] ...trying to set up timer (IRQ0)
> through the 8259A ... failed.
> > [ 0.004100] ...trying to set up timer as Virtual
> Wire IRQ ... failed.
> > [ 0.004100] ...trying to set up timer as ExtINT IRQ
> ... failed :(.
> > [ 0.004100] Kernel panic - not syncing: IO-APIC +
> timer doesn't work! Boot
> > with apic=debug and send a report.Then try booting
> with the 'noapic' option.
> >
> > Booting with 'apic=debug' gives these
> additional lines:
> > [ 0.004100] Getting VERSION: 50014
> > [ 0.004100] Getting VERSION: 50014
> > [ 0.004100] Getting ID: 0
> > [ 0.004100] Getting LVT0: 700
> > [ 0.004100] Getting LVT1: 10000
>
> Hi Alex,
>
> Can you please try the following.
>
> KVM: PIT: make last_injected_time per-guest
>
> Otherwise multiple guests use the same variable and boom.
>
> Also use kvm_vcpu_kick() to make sure that if a timer
> triggers on
> a different CPU the event won't be missed.
>
> Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]>
>
>
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index 2852dd1..5697ad2 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -200,10 +200,8 @@ int __pit_timer_fn(struct
> kvm_kpit_state *ps)
>
> atomic_inc(&pt->pending);
> smp_mb__after_atomic_inc();
> - if (vcpu0 && waitqueue_active(&vcpu0->wq))
> {
> - vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE;
> - wake_up_interruptible(&vcpu0->wq);
> - }
> + if (vcpu0)
> + kvm_vcpu_kick(vcpu0);
>
> pt->timer.expires = ktime_add_ns(pt->timer.expires,
> pt->period);
> pt->scheduled = ktime_to_ns(pt->timer.expires);
> @@ -572,7 +570,6 @@ void kvm_inject_pit_timer_irqs(struct
> kvm_vcpu *vcpu)
> struct kvm_pit *pit = vcpu->kvm->arch.vpit;
> struct kvm *kvm = vcpu->kvm;
> struct kvm_kpit_state *ps;
> - static unsigned long last_injected_time;
>
> if (vcpu && pit) {
> ps = &pit->pit_state;
> @@ -582,11 +579,11 @@ void kvm_inject_pit_timer_irqs(struct
> kvm_vcpu *vcpu)
> * 2. Last interrupt was accepted or waited for too long
> time*/
> if (atomic_read(&ps->pit_timer.pending)
> &&
> (ps->inject_pending ||
> - (jiffies - last_injected_time
> + (jiffies - ps->last_injected_time
> >= KVM_MAX_PIT_INTR_INTERVAL))) {
> ps->inject_pending = 0;
> __inject_pit_timer_intr(kvm);
> - last_injected_time = jiffies;
> + ps->last_injected_time = jiffies;
> }
> }
> }
> diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
> index e63ef38..db25c2a 100644
> --- a/arch/x86/kvm/i8254.h
> +++ b/arch/x86/kvm/i8254.h
> @@ -35,6 +35,7 @@ struct kvm_kpit_state {
> struct mutex lock;
> struct kvm_pit *pit;
> bool inject_pending; /* if inject pending interrupts */
> + unsigned long last_injected_time;
> };
>
> struct kvm_pit {
Problem(s) solved. Everything is working now. Can now boot both with and
without 'lpj='. The BogoMIPs are also being calculated correctly in secondary
guests without 'lpj='. I'll play with it some more just to make sure, then I'll
close the original bug.
Thanks, Marcelo et al.
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel