From owner-svn-src-stable@FreeBSD.ORG Tue Jun 18 23:14:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C46B5C88; Tue, 18 Jun 2013 23:14:22 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5FA119E5; Tue, 18 Jun 2013 23:14:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5INEMMR056037; Tue, 18 Jun 2013 23:14:22 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5INELKj056032; Tue, 18 Jun 2013 23:14:21 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201306182314.r5INELKj056032@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 18 Jun 2013 23:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251973 - in stable/9/sys: dev/xen/blkfront dev/xen/netfront xen/xenbus xen/xenstore X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jun 2013 23:14:22 -0000 Author: gibbs Date: Tue Jun 18 23:14:21 2013 New Revision: 251973 URL: http://svnweb.freebsd.org/changeset/base/251973 Log: MFC Xen fixes: svn rev 250081 Author:gibbs Date:2013-04-29T23:08:13.552620Z ============== xenstore/xenstore.c: Prevent access to invalid memory region when listing an empty directory in the XenStore. Reported by: Bei Guan svn rev 250913 Author:gibbs Date:2013-05-22T17:13:03.545339Z ============== Correct panic on detach of Xen PV network interfaces. dev/xen/netfront: In netif_free(), properly stop the interface and drain any pending timers prior to disconnecting from the backend device. Remove all media and detach our interface object from the system prior to deleting it. PR: kern/176471 Submitted by: Roger Pau Monne Reviewed by: gibbs svn rev 250917 Author:gibbs Date:2013-05-22T19:22:44.923351Z ============== Fix loss of the emulated keyboard on Xen PV HVM domains. xen/xenbus/xenbusb.c: In xenbusb_probe_children(), do not modify the XenBus state of devices for which we have no PV driver support. An emulated device we do support may share this backend. Hide the node from XenBus instead. This prevents closing the vkbd device, which Qemu's emulated keyboard device is using as the source for keyboard events. Tested with qemu-xen-traditional, qemu-xen and qemu stubdomains, all working as expected. Submitted by: Roger Pau Monne Reviewed by: gibbs MFC after: 1 week svn rev 251175 Author:gibbs Date:2013-05-31T04:43:19.944993Z ============== Apply the ad* => ada* IDE device name transition to the Xen block front driver. Submitted by: Bei Guan Reviewed by: gibbs MFC after: 1 week svn rev 251176 Author:gibbs Date:2013-05-31T04:45:59.563195Z ============== Make netif_free() safe to call on a partially initialized softc. Sponsored by: Spectra Logic Corporation MFC after: 1 week svn rev 251729 Author:gibbs Date:2013-06-14T03:31:11.033200Z ============== sys/dev/xen/netfront/netfront.c: In netif_free(), call ifmedia_removeall() after ether_ifdetach() so that bpf listeners are detached, any link state processing is completed, and there is no chance for external reference to media information. Suggested by: yongari Modified: stable/9/sys/dev/xen/blkfront/blkfront.c stable/9/sys/dev/xen/netfront/netfront.c stable/9/sys/xen/xenbus/xenbusb.c stable/9/sys/xen/xenstore/xenstore.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/9/sys/dev/xen/blkfront/blkfront.c Tue Jun 18 23:11:36 2013 (r251972) +++ stable/9/sys/dev/xen/blkfront/blkfront.c Tue Jun 18 23:14:21 2013 (r251973) @@ -148,16 +148,16 @@ blkfront_vdevice_to_unit(uint32_t vdevic int base; const char *name; } info[] = { - {3, 6, 0, "ad"}, /* ide0 */ - {22, 6, 2, "ad"}, /* ide1 */ - {33, 6, 4, "ad"}, /* ide2 */ - {34, 6, 6, "ad"}, /* ide3 */ - {56, 6, 8, "ad"}, /* ide4 */ - {57, 6, 10, "ad"}, /* ide5 */ - {88, 6, 12, "ad"}, /* ide6 */ - {89, 6, 14, "ad"}, /* ide7 */ - {90, 6, 16, "ad"}, /* ide8 */ - {91, 6, 18, "ad"}, /* ide9 */ + {3, 6, 0, "ada"}, /* ide0 */ + {22, 6, 2, "ada"}, /* ide1 */ + {33, 6, 4, "ada"}, /* ide2 */ + {34, 6, 6, "ada"}, /* ide3 */ + {56, 6, 8, "ada"}, /* ide4 */ + {57, 6, 10, "ada"}, /* ide5 */ + {88, 6, 12, "ada"}, /* ide6 */ + {89, 6, 14, "ada"}, /* ide7 */ + {90, 6, 16, "ada"}, /* ide8 */ + {91, 6, 18, "ada"}, /* ide9 */ {8, 4, 0, "da"}, /* scsi disk0 */ {65, 4, 16, "da"}, /* scsi disk1 */ Modified: stable/9/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/9/sys/dev/xen/netfront/netfront.c Tue Jun 18 23:11:36 2013 (r251972) +++ stable/9/sys/dev/xen/netfront/netfront.c Tue Jun 18 23:14:21 2013 (r251973) @@ -2172,10 +2172,17 @@ netfront_detach(device_t dev) static void netif_free(struct netfront_info *info) { + XN_LOCK(info); + xn_stop(info); + XN_UNLOCK(info); + callout_drain(&info->xn_stat_ch); netif_disconnect_backend(info); -#if 0 - close_netdev(info); -#endif + if (info->xn_ifp != NULL) { + ether_ifdetach(info->xn_ifp); + if_free(info->xn_ifp); + info->xn_ifp = NULL; + } + ifmedia_removeall(&info->sc_media); } static void Modified: stable/9/sys/xen/xenbus/xenbusb.c ============================================================================== --- stable/9/sys/xen/xenbus/xenbusb.c Tue Jun 18 23:11:36 2013 (r251972) +++ stable/9/sys/xen/xenbus/xenbusb.c Tue Jun 18 23:14:21 2013 (r251973) @@ -404,6 +404,31 @@ xenbusb_device_sysctl_init(device_t dev) } /** + * \brief Decrement the number of XenBus child devices in the + * connecting state by one and release the xbs_attch_ch + * interrupt configuration hook if the connecting count + * drops to zero. + * + * \param xbs XenBus Bus device softc of the owner of the bus to enumerate. + */ +static void +xenbusb_release_confighook(struct xenbusb_softc *xbs) +{ + mtx_lock(&xbs->xbs_lock); + KASSERT(xbs->xbs_connecting_children > 0, + ("Connecting device count error\n")); + xbs->xbs_connecting_children--; + if (xbs->xbs_connecting_children == 0 + && (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) { + xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE; + mtx_unlock(&xbs->xbs_lock); + config_intrhook_disestablish(&xbs->xbs_attach_ch); + } else { + mtx_unlock(&xbs->xbs_lock); + } +} + +/** * \brief Verify the existance of attached device instances and perform * probe/attach processing for newly arrived devices. * @@ -417,7 +442,7 @@ xenbusb_probe_children(device_t dev) { device_t *kids; struct xenbus_device_ivars *ivars; - int i, count; + int i, count, error; if (device_get_children(dev, &kids, &count) == 0) { for (i = 0; i < count; i++) { @@ -430,7 +455,30 @@ xenbusb_probe_children(device_t dev) continue; } - if (device_probe_and_attach(kids[i])) { + error = device_probe_and_attach(kids[i]); + if (error == ENXIO) { + struct xenbusb_softc *xbs; + + /* + * We don't have a PV driver for this device. + * However, an emulated device we do support + * may share this backend. Hide the node from + * XenBus until the next rescan, but leave it's + * state unchanged so we don't inadvertently + * prevent attachment of any emulated device. + */ + xenbusb_delete_child(dev, kids[i]); + + /* + * Since the XenStore state of this device + * still indicates a pending attach, manually + * release it's hold on the boot process. + */ + xbs = device_get_softc(dev); + xenbusb_release_confighook(xbs); + + continue; + } else if (error) { /* * Transition device to the closed state * so the world knows that attachment will @@ -579,31 +627,6 @@ xenbusb_nop_confighook_cb(void *arg __un { } -/** - * \brief Decrement the number of XenBus child devices in the - * connecting state by one and release the xbs_attch_ch - * interrupt configuration hook if the connecting count - * drops to zero. - * - * \param xbs XenBus Bus device softc of the owner of the bus to enumerate. - */ -static void -xenbusb_release_confighook(struct xenbusb_softc *xbs) -{ - mtx_lock(&xbs->xbs_lock); - KASSERT(xbs->xbs_connecting_children > 0, - ("Connecting device count error\n")); - xbs->xbs_connecting_children--; - if (xbs->xbs_connecting_children == 0 - && (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) { - xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE; - mtx_unlock(&xbs->xbs_lock); - config_intrhook_disestablish(&xbs->xbs_attach_ch); - } else { - mtx_unlock(&xbs->xbs_lock); - } -} - /*--------------------------- Public Functions -------------------------------*/ /*--------- API comments for these methods can be found in xenbusb.h ---------*/ void Modified: stable/9/sys/xen/xenstore/xenstore.c ============================================================================== --- stable/9/sys/xen/xenstore/xenstore.c Tue Jun 18 23:11:36 2013 (r251972) +++ stable/9/sys/xen/xenstore/xenstore.c Tue Jun 18 23:14:21 2013 (r251973) @@ -307,7 +307,8 @@ split(char *strings, u_int len, u_int *n const char **ret; /* Protect against unterminated buffers. */ - strings[len - 1] = '\0'; + if (len > 0) + strings[len - 1] = '\0'; /* Count the strings. */ *num = extract_strings(strings, /*dest*/NULL, len);