From owner-svn-src-all@FreeBSD.ORG Fri Dec 14 05:33:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B7577DC; Fri, 14 Dec 2012 05:33:51 +0000 (UTC) (envelope-from mr.kodiak@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A48978FC0A; Fri, 14 Dec 2012 05:33:50 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id u54so1309004wey.13 for ; Thu, 13 Dec 2012 21:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=GknoNeoDucPP1gQVz/bbZdbDEvmcVrjB6uEf7xkr6Mw=; b=c6psycvTUFi9cSopUZCKI/oVfiRW58zI9Uh7Ltb9Ru2gl1gxGgLyq3Mu7H2NadvYip 8CpHtDsp9TaoJPzt9jZf3LL5N7uozyo7+YAeG3a0WHDp5q1C4MnsBEYm2wQX7KqprxN3 SGoJ3eN03jS6g6jQbqSG83Ymjnjw7REqQ3Y4xc9OZcAWqRD7G8lmTfny7R/92csd7TQG qgLY7D2Hu0l6npk8/gbceS0Q6L30N6h3zyBUy+AYOUYrZxoPm7UYyKouzUMU/r07I0JG h68ePzbRgtuIufnjLGXgYuW7WxjaeMphl65dWwZiTS+Cr09oof36ZSojBBO1isDaxs8e CctA== Received: by 10.194.88.98 with SMTP id bf2mr1488675wjb.49.1355463229183; Thu, 13 Dec 2012 21:33:49 -0800 (PST) MIME-Version: 1.0 Sender: mr.kodiak@gmail.com Received: by 10.216.108.130 with HTTP; Thu, 13 Dec 2012 21:33:19 -0800 (PST) In-Reply-To: <201212140527.qBE5Rvue097151@svn.freebsd.org> References: <201212140527.qBE5Rvue097151@svn.freebsd.org> From: Bryan Venteicher Date: Thu, 13 Dec 2012 23:33:19 -0600 X-Google-Sender-Auth: L5gQUPylGIlWVr2Z_w7nnzUHC-Q Message-ID: Subject: Re: svn commit: r244200 - in head/sys/dev/virtio: block network scsi To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 05:33:51 -0000 On Thu, Dec 13, 2012 at 11:27 PM, Bryan Venteicher wrote: > > Author: bryanv > Date: Fri Dec 14 05:27:56 2012 > New Revision: 244200 > URL: http://svnweb.freebsd.org/changeset/base/244200 > > Log: > virtio: Start taskqueues threads after attach cannot fail > > If virtio_setup_intr() failed during boot, we would hang in > taskqueue_free() -> taskqueue_terminate() for all the taskq > threads to terminate. This will never happen since the > scheduler is not running by this point. > FWIW, this seems to be a pretty common bug across dozen of drivers. bus_setup_intr() is not very likely to fail though. For VirtIO, it is somewhat a moot point because the taskqueues are about to be removed and replaced with ithreads as I should have done in the beginning. > Reported by: neel, grehan > Approved by: grehan (mentor) > > Modified: > head/sys/dev/virtio/block/virtio_blk.c > head/sys/dev/virtio/network/if_vtnet.c > head/sys/dev/virtio/scsi/virtio_scsi.c > > Modified: head/sys/dev/virtio/block/virtio_blk.c > > ============================================================================== > --- head/sys/dev/virtio/block/virtio_blk.c Fri Dec 14 00:13:29 2012 > (r244199) > +++ head/sys/dev/virtio/block/virtio_blk.c Fri Dec 14 05:27:56 2012 > (r244200) > @@ -338,8 +338,6 @@ vtblk_attach(device_t dev) > device_printf(dev, "cannot allocate taskqueue\n"); > goto fail; > } > - taskqueue_start_threads(&sc->vtblk_tq, 1, PI_DISK, "%s taskq", > - device_get_nameunit(dev)); > > error = virtio_setup_intr(dev, INTR_TYPE_BIO | INTR_ENTROPY); > if (error) { > @@ -347,6 +345,9 @@ vtblk_attach(device_t dev) > goto fail; > } > > + taskqueue_start_threads(&sc->vtblk_tq, 1, PI_DISK, "%s taskq", > + device_get_nameunit(dev)); > + > vtblk_create_disk(sc); > > virtqueue_enable_intr(sc->vtblk_vq); > > Modified: head/sys/dev/virtio/network/if_vtnet.c > > ============================================================================== > --- head/sys/dev/virtio/network/if_vtnet.c Fri Dec 14 00:13:29 2012 > (r244199) > +++ head/sys/dev/virtio/network/if_vtnet.c Fri Dec 14 05:27:56 2012 > (r244200) > @@ -439,18 +439,17 @@ vtnet_attach(device_t dev) > ether_ifdetach(ifp); > goto fail; > } > - taskqueue_start_threads(&sc->vtnet_tq, 1, PI_NET, "%s taskq", > - device_get_nameunit(dev)); > > error = virtio_setup_intr(dev, INTR_TYPE_NET); > if (error) { > device_printf(dev, "cannot setup virtqueue interrupts\n"); > - taskqueue_free(sc->vtnet_tq); > - sc->vtnet_tq = NULL; > ether_ifdetach(ifp); > goto fail; > } > > + taskqueue_start_threads(&sc->vtnet_tq, 1, PI_NET, "%s taskq", > + device_get_nameunit(dev)); > + > /* > * Device defaults to promiscuous mode for backwards > * compatibility. Turn it off if possible. > > Modified: head/sys/dev/virtio/scsi/virtio_scsi.c > > ============================================================================== > --- head/sys/dev/virtio/scsi/virtio_scsi.c Fri Dec 14 00:13:29 2012 > (r244199) > +++ head/sys/dev/virtio/scsi/virtio_scsi.c Fri Dec 14 05:27:56 2012 > (r244200) > @@ -347,12 +347,6 @@ vtscsi_attach(device_t dev) > device_printf(dev, "cannot allocate taskqueue\n"); > goto fail; > } > - error = taskqueue_start_threads(&sc->vtscsi_tq, 1, PI_DISK, "%s > taskq", > - device_get_nameunit(dev)); > - if (error) { > - device_printf(dev, "cannot start taskqueue threads\n"); > - goto fail; > - } > > error = virtio_setup_intr(dev, INTR_TYPE_CAM); > if (error) { > @@ -360,6 +354,9 @@ vtscsi_attach(device_t dev) > goto fail; > } > > + taskqueue_start_threads(&sc->vtscsi_tq, 1, PI_DISK, "%s taskq", > + device_get_nameunit(dev)); > + > vtscsi_enable_vqs_intr(sc); > > /*