linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mike Galbraith <efault@gmx.de>
Cc: Christoph Hellwig <hch@lst.de>,
	Thorsten Leemhuis <linux@leemhuis.info>,
	virtio-dev@lists.oasis-open.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	rjones@redhat.com
Subject: Re: Random guest crashes since 5c34d002dcc7 ("virtio_pci: use shared interrupts for virtqueues")
Date: Fri, 31 Mar 2017 06:22:31 +0300	[thread overview]
Message-ID: <20170331032231.GA2471@redhat.com> (raw)
In-Reply-To: <20170331041959-mutt-send-email-mst@kernel.org>

On Fri, Mar 31, 2017 at 04:23:35AM +0300, Michael S. Tsirkin wrote:
> On Thu, Mar 30, 2017 at 09:20:35AM +0200, Mike Galbraith wrote:
> > On Thu, 2017-03-30 at 05:10 +0200, Mike Galbraith wrote:
> > 
> > > WRT spin, you should need do nothing more than boot with threadirqs,
> > > that's 100% repeatable here in absolutely virgin source.
> > 
> > No idea why virtqueue_get_buf() in __send_control_msg() fails forever
> > with threadirqs, but marking that vq as being busted (it clearly is)
> > results in one gripe, and a vbox that seemingly cares not one whit that
> > something went missing.  CONFIG_DEBUG_SHIRQ OTOH notices, mutters
> > something that sounds like "idiot" when I hibernate the thing ;-)
> > 
> > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> > index e9b7e0b3cabe..831406dae1cb 100644
> > --- a/drivers/char/virtio_console.c
> > +++ b/drivers/char/virtio_console.c
> > @@ -567,6 +567,7 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
> >  	struct scatterlist sg[1];
> >  	struct virtqueue *vq;
> >  	unsigned int len;
> > +	unsigned long deadline = jiffies+1;
> >  
> >  	if (!use_multiport(portdev))
> >  		return 0;
> > @@ -583,9 +584,13 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
> >  
> >  	if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) {
> >  		virtqueue_kick(vq);
> > -		while (!virtqueue_get_buf(vq, &len)
> > -			&& !virtqueue_is_broken(vq))
> > +		while (!virtqueue_get_buf(vq, &len) && !virtqueue_is_broken(vq)) {
> >  			cpu_relax();
> > +			if (time_after(jiffies, deadline)) {
> > +				trace_printk("Aw crap, I'm stuck.. breaking device\n");
> > +				virtio_break_device(portdev->vdev);
> > +			}
> > +		}
> >  	}
> >  
> >  	spin_unlock(&portdev->c_ovq_lock);
> 
> 
> OK so with your help I was able to reproduce. Surprisingly easy:
> 
> 1. add threadirqs
> 2. add to qemu -device virtio-serial-pci -no-shutdown
> 3. within guest, do echo disk > /sys/power/state
> 
> This produces a warning. Looking deeper into it, I find:
> the device has 64 vqs. This line
> 
>                err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),
>                                   vring_interrupt, IRQF_SHARED,
>                                   vp_dev->msix_names[j], vqs[i]);
> 
> fails after assigning interrupts to 33 vqs.
> Is there a limit to how many threaded irqs can share a line?

In fact it fails on the 33'rd one, and I see this:

/*
 * Unlikely to have 32 resp 64 irqs sharing one line,
 * but who knows.
 */
if (thread_mask == ~0UL) {
	printk(KERN_ERR "%s +%d\n", __FILE__, __LINE__);
	ret = -EBUSY;
	goto out_mask;
}


I'm not sure why does it fail after 32 on 64 bit, but as
virtio devices aren't limited to 32 vqs it looks like we
should go back to requesting the irq only once for all vqs.

Christoph, should I just revert for now, or do you
want to look into a smaller patch for this?

Another question is looking into intx support - that
should work but it seems to be broken at the moment.


> 
> If so we need to rethink the whole approach.
> 
> Still looking into it.
> 
> Christoph, any idea?
> 
> 
> -- 
> MST

  parent reply	other threads:[~2017-03-31  3:22 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 14:51 Random guest crashes since 5c34d002dcc7 ("virtio_pci: use shared interrupts for virtqueues") Thorsten Leemhuis
2017-03-23 14:56 ` Christoph Hellwig
2017-03-23 14:59   ` Richard W.M. Jones
2017-03-23 15:01   ` Thorsten Leemhuis
2017-03-23 15:19   ` Richard W.M. Jones
2017-03-27  9:07   ` Mike Galbraith
2017-03-27 17:05     ` Christoph Hellwig
2017-03-27 18:16       ` Michael S. Tsirkin
2017-03-28  1:08         ` Mike Galbraith
2017-03-28  2:35           ` Michael S. Tsirkin
2017-03-28  3:16             ` Mike Galbraith
2017-03-28 15:37               ` Michael S. Tsirkin
2017-03-28 16:33                 ` Mike Galbraith
2017-03-28 17:27                   ` Michael S. Tsirkin
2017-03-28 17:47                     ` Mike Galbraith
2017-03-27 18:18       ` Mike Galbraith
2017-03-29  6:23         ` Mike Galbraith
2017-03-29 20:10           ` Michael S. Tsirkin
2017-03-30  3:10             ` Mike Galbraith
2017-03-30  7:20               ` Mike Galbraith
     [not found]                 ` <20170331041959-mutt-send-email-mst@kernel.org>
2017-03-31  3:22                   ` Michael S. Tsirkin [this message]
2017-03-31  8:20                     ` Christoph Hellwig
2017-03-31 16:47                       ` Michael S. Tsirkin
2017-04-03 14:18                         ` Christoph Hellwig
2017-04-03 15:49                           ` Michael S. Tsirkin
2017-04-03 16:14                           ` Michael S. Tsirkin
2017-04-05  6:36                             ` Christoph Hellwig
2017-04-03 17:56                           ` Mike Galbraith
2017-04-03 18:11                             ` Michael S. Tsirkin
2017-04-04  4:02                               ` Mike Galbraith
2017-04-04 13:38                                 ` Michael S. Tsirkin
2017-04-04 14:18                                   ` Mike Galbraith
2017-04-04 14:24                                     ` Michael S. Tsirkin
2017-04-04 15:30                                     ` Michael S. Tsirkin
2017-04-04 17:40                                       ` Mike Galbraith
2017-04-04 17:54                                         ` Mike Galbraith
2017-04-04 18:00                                           ` Michael S. Tsirkin
2017-04-04 18:38                                             ` Mike Galbraith
2017-04-04 21:31                                               ` Michael S. Tsirkin
2017-04-05  2:54                                                 ` Mike Galbraith
2017-04-04 19:03                                           ` Michael S. Tsirkin
2017-04-05  3:09                                             ` Mike Galbraith
2017-04-05  3:13                                               ` Michael S. Tsirkin
2017-04-05  3:24                                                 ` Mike Galbraith
2017-04-05  3:40                                                   ` Mike Galbraith
2017-04-05  3:51                                                     ` Michael S. Tsirkin
2017-04-05  4:24                                                       ` Mike Galbraith
2017-04-05  6:29                                                         ` Christoph Hellwig
2017-04-05  6:51                                                           ` Mike Galbraith
2017-04-05 21:38                                                           ` Michael S. Tsirkin
2017-04-07  6:03                                                             ` Mike Galbraith
2017-04-07  6:24                                                               ` Michael S. Tsirkin
2017-04-07  6:44                                                                 ` Mike Galbraith
2017-04-07  7:05                                                                   ` Mike Galbraith
2017-04-07  7:22                                                                     ` Mike Galbraith
2017-04-07  7:23                                                                       ` Mike Galbraith
2017-04-07 13:20                                                                       ` Michael S. Tsirkin
2017-04-07 13:35                                                                         ` Michael S. Tsirkin
2017-04-07 14:29                                                                           ` Mike Galbraith
2017-04-07 18:56                                                                             ` Michael S. Tsirkin
2017-04-08  5:01                                                                               ` Mike Galbraith
2017-04-10 21:23                                                                                 ` Michael S. Tsirkin
2017-04-11  4:19                                                                                   ` Mike Galbraith
2017-04-05  3:52                                                   ` Michael S. Tsirkin
2017-04-07 21:35                           ` [Random guest crashes since 5c34d002dcc7 ("virtio_pci] 3313bedd74: WARNING:at_include/linux/pci.h:#vp_del_vqs kernel test robot
2017-03-29 20:19           ` Random guest crashes since 5c34d002dcc7 ("virtio_pci: use shared interrupts for virtqueues") Michael S. Tsirkin
2017-03-30  3:54             ` Mike Galbraith
2017-03-28  1:01       ` Mike Galbraith
2017-03-23 14:59 ` Richard W.M. Jones

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=20170331032231.GA2471@redhat.com \
    --to=mst@redhat.com \
    --cc=efault@gmx.de \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=rjones@redhat.com \
    --cc=virtio-dev@lists.oasis-open.org \
    /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;
as well as URLs for NNTP newsgroup(s).