public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Asias He <asias@redhat.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: irqfd issue
Date: Tue, 7 May 2013 17:29:09 +0300	[thread overview]
Message-ID: <20130507142909.GA7899@redhat.com> (raw)
In-Reply-To: <20130507130706.21663153@gondolin>

On Tue, May 07, 2013 at 01:07:06PM +0200, Cornelia Huck wrote:
> On Tue, 7 May 2013 11:21:09 +0200
> Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> 
> > On Tue, 7 May 2013 12:12:09 +0300
> > Gleb Natapov <gleb@redhat.com> wrote:
> > 
> > > On Tue, May 07, 2013 at 05:10:41PM +0800, Asias He wrote:
> > > > On Tue, May 07, 2013 at 11:42:07AM +0300, Gleb Natapov wrote:
> > > > > On Tue, May 07, 2013 at 04:36:50PM +0800, Asias He wrote:
> > > > > > On Tue, May 07, 2013 at 11:18:38AM +0300, Gleb Natapov wrote:
> > > > > > > On Tue, May 07, 2013 at 04:14:50PM +0800, Asias He wrote:
> > > > > > > > On Tue, May 07, 2013 at 10:55:36AM +0300, Gleb Natapov wrote:
> > > > > > > > > On Tue, May 07, 2013 at 09:37:30AM +0800, Asias He wrote:
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > I am seeing this with linus/master. Any ideas?
> > > > > > > > > > 
> > > > > > > > > How reproducible it this? What HEAD are you seeing this with?
> > > > > > > > 
> > > > > > > > Almost always. Start a guest with vhost-net on.
> > > > > > > > 
> > > > > > > It happens during start or on VM exit? The trace shows do_exit()
> > > > > > > 
> > > > > > > > QEMU  : e3351000cd682200835763caca87adf708ed1c65
> > > > > > > > KERNEL: 51a26ae7a14b85c99c9be470c2d28eeeba0f26a3 
> > > > > > > > 
> > > > > > > Can you try with kvm.git next branch?
> > > > > > 
> > > > > > With next branch db6ae6158186a17165ef990bda2895ae7594b039,
> > > > > > 
> > > > > Can you revert a0f155e9646d5f1c263f6f9aae880151100243bb and try again?
> > > > 
> > > > The issue is gone with a0f155e9646d5f1c263f6f9aae880151100243bb
> > > > reverted.
> > > > 
> > > Cornelia, any ideas?
> > 
> > irqfd_deactivate before kvm_init or after kvm_exit? Let me look...
> > 
> 
> Hm, no idea.
> 
For am quick look is seems that after the patch irqfd_cleanup_wq is
initialized as part of kvm-intel/kvm-amd module, but before the patch is
was initialized as part of kvm module. The later is how it should be,
but I do not see why would it cause the problem.

> Asias, could you try whether the patch below yields any interesting
> backtraces?
> 
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index 64ee720..59c3810 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -92,6 +92,8 @@ struct _irqfd {
>  };
>  
>  static struct workqueue_struct *irqfd_cleanup_wq;
> +static int irqfd_ready;
> +static unsigned long irqfd_cnt;
>  
>  static void
>  irqfd_inject(struct work_struct *work)
> @@ -410,6 +412,8 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
>  	 */
>  	fput(file);
>  
> +	irqfd_cnt++;
> +
>  	return 0;
>  
>  fail:
> @@ -483,12 +487,16 @@ kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
>  	 */
>  	flush_workqueue(irqfd_cleanup_wq);
>  
> +	irqfd_cnt--;
> +
>  	return 0;
>  }
>  
>  int
>  kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
>  {
> +	WARN_ON(!irqfd_ready);
> +
>  	if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))
>  		return -EINVAL;
>  
> @@ -548,15 +556,22 @@ void kvm_irq_routing_update(struct kvm *kvm,
>   */
>  int kvm_irqfd_init(void)
>  {
> +	WARN_ON(irqfd_cnt);
> +
>  	irqfd_cleanup_wq = create_singlethread_workqueue("kvm-irqfd-cleanup");
>  	if (!irqfd_cleanup_wq)
>  		return -ENOMEM;
>  
> +	irqfd_ready = 1;
> +
>  	return 0;
>  }
>  
>  void kvm_irqfd_exit(void)
>  {
> +	WARN_ON(irqfd_cnt);
> +	irqfd_ready = 0;
> +
>  	destroy_workqueue(irqfd_cleanup_wq);
>  }
>  #endif

--
			Gleb.

  reply	other threads:[~2013-05-07 14:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07  1:37 irqfd issue Asias He
2013-05-07  7:55 ` Gleb Natapov
2013-05-07  8:14   ` Asias He
2013-05-07  8:18     ` Gleb Natapov
2013-05-07  8:28       ` Asias He
2013-05-07  8:36       ` Asias He
2013-05-07  8:42         ` Gleb Natapov
2013-05-07  9:10           ` Asias He
2013-05-07  9:12             ` Gleb Natapov
2013-05-07  9:21               ` Cornelia Huck
2013-05-07 11:07                 ` Cornelia Huck
2013-05-07 14:29                   ` Gleb Natapov [this message]
2013-05-07 14:38                     ` Asias He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130507142909.GA7899@redhat.com \
    --to=gleb@redhat.com \
    --cc=asias@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox