Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933021AbdC3HUt (ORCPT ); Thu, 30 Mar 2017 03:20:49 -0400 Received: from mout.gmx.net ([212.227.15.15]:53603 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754290AbdC3HUq (ORCPT ); Thu, 30 Mar 2017 03:20:46 -0400 Message-ID: <1490858435.4696.25.camel@gmx.de> Subject: Re: Random guest crashes since 5c34d002dcc7 ("virtio_pci: use shared interrupts for virtqueues") From: Mike Galbraith To: "Michael S. Tsirkin" Cc: Christoph Hellwig , Thorsten Leemhuis , virtio-dev@lists.oasis-open.org, Linux Kernel Mailing List , rjones@redhat.com Date: Thu, 30 Mar 2017 09:20:35 +0200 In-Reply-To: <1490843414.4167.11.camel@gmx.de> References: <20170323145622.GA31690@lst.de> <1490605644.14634.50.camel@gmx.de> <20170327170540.GA28715@lst.de> <1490638711.26533.44.camel@gmx.de> <1490768602.5950.25.camel@gmx.de> <20170329230936-mutt-send-email-mst@kernel.org> <1490843414.4167.11.camel@gmx.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:A1iNyuAahHAfF3kn1sQnkGo+sXB6ORrcQRPs0URRmBrne3HaLAC MxA0OHJUWJk3T/5WrNIBOy1feVUJJBTfurWmI61Md8eLRulwwqfwjs0ZVmxGTaqW3MLH36y YbU7tFZ0qw+9UiVSzgujPUwW9/WG5xWEsNxM3K35VcVDu3AlsoJvE67M/bP/lI6G3/mv1c1 mdnpOGzB9INBbD25vRaFg== X-UI-Out-Filterresults: notjunk:1;V01:K0:vcGWo7kSyXI=:Iqv9DBdpHVOWV0D0lcDdM5 bh59gl+Lr2KqX+/Xnqgro1ZWTBa6sv/IzkMbaUUKlGVW5ZmtXT7cco9yde3WvtT715b+20sVv bfpTPpGS/Y8F+rm7mVTt55Wj2JfTwhrBREvsKTRF2sVm8x5+PCTKRXVIAMIftMELjSwaILAze NkIlrxPzTbdT8wsZln92x2N7CysJYRiyZTusQ8eCLhRI+/I8CG/gZ4OS1fq2rFwebKLZ8k4rH w2m/By0rXOHJP/N+aSUVX7U7YmGKydljJAPVWmmCVrBopfMp7Wp23dJdire7oIRlCkjq0uYTw C5rf3QdyCHMAk5jUfgnL3Ls65/SGiHj/aauyUjZ4hr4y1mfxfv+OGRQ9F2HhxR0Yx7RWC8RGH vgBfLSkMOCUrBRk97FGjrqKzBWf2rw4PwrqFOcdtR+DXoMqudlpf+pu4VBcsIewtjaqcEoaOU 4QSfhAcu3ML/lHYQf5uge4iNomvsnIIt+6xZmm22wpnxEw3Ofr0PYxi8WAiiGJ3XJI4k3ZVbI ry3gutPTw6EXaHTnJH+XXgqCCyVUrCGrucWKLSLDIXbOroBw0S0n16GHfWEfh+yR8QJuI9xuj Er4/gkIhxzBrqOzcIURMhgjgVvJQTAaXBpnqaqA1NWY5kfPxrxjCGkV2HutLqTyFqPiUYK5N6 i4cU+cXArtqowTUShZHFRAnh/HthdhT1kEz1DTqrmqbofTrU8GYIkr4uXzKVkTHP55J9qoZ6M huJeE0b7qrJw/Ipq8rODGiejMBw4lNRZRL1eJn+2Ry47RShZENGvgMBRtLkCap+FPMjsHOUQ1 I+mR2SV Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1526 Lines: 39 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);