All of lore.kernel.org
 help / color / mirror / Atom feed
* KVM-66: FreeBSD guest takes all CPU when idle
@ 2008-05-02 20:39 Aurelien Jarno
  2008-05-02 22:23 ` Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2008-05-02 20:39 UTC (permalink / raw)
  To: kvm-devel; +Cc: Marcelo Tosatti

Hi,

Since commit a0d22c57fbf0c67d73ab7ca3416841030e0bc22f, FreeBSD guests
takes all host CPU even when they are idle. Reverting this patch in
kvm-67 or git tree fixes (or workarounds?) the problem. Using 
-no-kvm-pit also workarounds the problem.

Some more details:
Host: Linux 2.6.24 x86-64
CPU: problem occurs on T7500 and Q9450
Guest: problem occurs with FreeBSD/i386 6.2 and 6.3

Regards,
Aurelien


commit a0d22c57fbf0c67d73ab7ca3416841030e0bc22f
Author: Marcelo Tosatti <mtosatti@redhat.com>
Date:   Fri Apr 11 14:53:26 2008 -0300

    KVM: hlt emulation should take in-kernel APIC/PIT timers into account
    
    Timers that fire between guest hlt and vcpu_block's add_wait_queue() are
    ignored, possibly resulting in hangs.
    
    Also make sure that atomic_inc and waitqueue_active tests happen in the
    specified order, otherwise the following race is open:
    
    CPU0                                        CPU1
                                                if (waitqueue_active(wq))
    add_wait_queue()
    if (!atomic_read(pit_timer->pending))
        schedule()
                                                atomic_inc(pit_timer->pending)
    
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Avi Kivity <avi@qumranet.com>


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: KVM-66: FreeBSD guest takes all CPU when idle
  2008-05-02 20:39 KVM-66: FreeBSD guest takes all CPU when idle Aurelien Jarno
@ 2008-05-02 22:23 ` Marcelo Tosatti
  2008-05-02 22:45   ` Aurelien Jarno
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2008-05-02 22:23 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

On Fri, May 02, 2008 at 10:39:25PM +0200, Aurelien Jarno wrote:
> Hi,
> 
> Since commit a0d22c57fbf0c67d73ab7ca3416841030e0bc22f, FreeBSD guests
> takes all host CPU even when they are idle. Reverting this patch in
> kvm-67 or git tree fixes (or workarounds?) the problem. Using 
> -no-kvm-pit also workarounds the problem.
> 
> Some more details:
> Host: Linux 2.6.24 x86-64
> CPU: problem occurs on T7500 and Q9450
> Guest: problem occurs with FreeBSD/i386 6.2 and 6.3
> 
> Regards,
> Aurelien

Aurelien,

Can you give this a try.

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 1646102..07f9ff1 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -216,7 +216,7 @@ int pit_has_pending_timer(struct kvm_vcpu *vcpu)
 {
 	struct kvm_pit *pit = vcpu->kvm->arch.vpit;
 
-	if (pit && vcpu->vcpu_id == 0)
+	if (pit && vcpu->vcpu_id == 0 && pit->pit_state.inject_pending)
 		return atomic_read(&pit->pit_state.pit_timer.pending);
 
 	return 0;

-------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: KVM-66: FreeBSD guest takes all CPU when idle
  2008-05-02 22:23 ` Marcelo Tosatti
@ 2008-05-02 22:45   ` Aurelien Jarno
  0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2008-05-02 22:45 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

On Fri, May 02, 2008 at 07:23:22PM -0300, Marcelo Tosatti wrote:
> On Fri, May 02, 2008 at 10:39:25PM +0200, Aurelien Jarno wrote:
> > Hi,
> > 
> > Since commit a0d22c57fbf0c67d73ab7ca3416841030e0bc22f, FreeBSD guests
> > takes all host CPU even when they are idle. Reverting this patch in
> > kvm-67 or git tree fixes (or workarounds?) the problem. Using 
> > -no-kvm-pit also workarounds the problem.
> > 
> > Some more details:
> > Host: Linux 2.6.24 x86-64
> > CPU: problem occurs on T7500 and Q9450
> > Guest: problem occurs with FreeBSD/i386 6.2 and 6.3
> > 
> > Regards,
> > Aurelien
> 
> Aurelien,
> 
> Can you give this a try.

Yep, that fixes the problem. Thanks a lot!

> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index 1646102..07f9ff1 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -216,7 +216,7 @@ int pit_has_pending_timer(struct kvm_vcpu *vcpu)
>  {
>  	struct kvm_pit *pit = vcpu->kvm->arch.vpit;
>  
> -	if (pit && vcpu->vcpu_id == 0)
> +	if (pit && vcpu->vcpu_id == 0 && pit->pit_state.inject_pending)
>  		return atomic_read(&pit->pit_state.pit_timer.pending);
>  
>  	return 0;
> 

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-02 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 20:39 KVM-66: FreeBSD guest takes all CPU when idle Aurelien Jarno
2008-05-02 22:23 ` Marcelo Tosatti
2008-05-02 22:45   ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.