Module Name: src Committed By: pooka Date: Wed Aug 13 14:35:46 UTC 2014
Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Don't use config_deferred_interrupts() for vioif_deferred_init(), just run it once as part of if_init(). The problem with the former is that it will execute the deferred init routine in-place when !cold, and since vioif_deferred_init() finishing depends on virtio interrupts which are established only after config_deferred_interrupts() is called, the vioif attach method would deadlock when !cold. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.7 src/sys/dev/pci/if_vioif.c:1.8 --- src/sys/dev/pci/if_vioif.c:1.7 Tue Jul 22 02:21:50 2014 +++ src/sys/dev/pci/if_vioif.c Wed Aug 13 14:35:46 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $ */ +/* $NetBSD: if_vioif.c,v 1.8 2014/08/13 14:35:46 pooka Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.8 2014/08/13 14:35:46 pooka Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -155,7 +155,7 @@ struct vioif_softc { uint8_t sc_mac[ETHER_ADDR_LEN]; struct ethercom sc_ethercom; - short sc_ifflags; + short sc_deferred_init_done; /* bus_dmamem */ bus_dma_segment_t sc_hdr_segs[1]; @@ -602,8 +602,6 @@ vioif_attach(device_t parent, device_t s if (vioif_alloc_mems(sc) < 0) goto err; - if (vsc->sc_nvqs == 3) - config_interrupts(self, vioif_deferred_init); strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); ifp->if_softc = sc; @@ -670,6 +668,14 @@ vioif_init(struct ifnet *ifp) vioif_stop(ifp, 0); + if (!sc->sc_deferred_init_done) { + struct virtio_softc *vsc = sc->sc_virtio; + + sc->sc_deferred_init_done = 1; + if (vsc->sc_nvqs == 3) + vioif_deferred_init(sc->sc_dev); + } + /* Have to set false before vioif_populate_rx_mbufs */ sc->sc_stopping = false;