From owner-freebsd-bugs@freebsd.org Thu Sep 10 19:58:26 2015 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E466A01263 for ; Thu, 10 Sep 2015 19:58:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 431E81874 for ; Thu, 10 Sep 2015 19:58:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AJwQhq056895 for ; Thu, 10 Sep 2015 19:58:26 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 203022] [patch] Can't destroy vlan dev with vtnet parent that is down and doing vlanhwfilter Date: Thu, 10 Sep 2015 19:58:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: groos@xiplink.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 19:58:26 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203022 Bug ID: 203022 Summary: [patch] Can't destroy vlan dev with vtnet parent that is down and doing vlanhwfilter Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: groos@xiplink.com Keywords: patch The ifconfig command hangs when trying to destroy a vlan device when all of the following are true: * Vlan device has a vtnet device as parent * The vtnet device is down * The vtnet device has vlanhwfilter enabled Running FreeBSD-11.0-CURRENT-amd64-20150826-r287169-disc1.iso in VirtualBox 4.2.12, using vtnet network devices. To reproduce: [hub] /root # ifconfig vtnet0 up [hub] /root # ifconfig vtnet0 vlanhwfilter [hub] /root # ifconfig vlan10 create [hub] /root # ifconfig vlan10 vlan 6 vlandev vtnet0 [hub] /root # ifconfig vtnet0 down [hub] /root # ifconfig vlan10 destroy Inducing a textdump at this point reveals: Tracing command ifconfig pid 29804 tid 100092 td 0xfffffe0001a90490 cpustop_handler() at cpustop_handler+0x28/frame 0xffffff8000227db0 ipi_nmi_handler() at ipi_nmi_handler+0x3f/frame 0xffffff8000227dd0 trap() at trap+0x15c/frame 0xffffff8000227f20 nmi_calltrap() at nmi_calltrap+0x8/frame 0xffffff8000227f20 --- trap 0x13, rip = 0xffffffff807dab5e, rsp = 0xffffff8000227fe0, rbp = 0xffffff801945f750 --- Xapic_isr1() at Xapic_isr1+0x8e/frame 0xffffff801945f750 vtnet_exec_vlan_filter() at vtnet_exec_vlan_filter+0x95/frame 0xffffff801945f7d0 vtnet_update_vlan_filter() at vtnet_update_vlan_filter+0xf3/frame 0xffffff801945f800 vlan_unconfig_locked() at vlan_unconfig_locked+0x267/frame 0xffffff801945f850 vlan_unconfig() at vlan_unconfig+0x35/frame 0xffffff801945f870 vlan_clone_destroy() at vlan_clone_destroy+0x28/frame 0xffffff801945f8a0 if_clone_destroyif() at if_clone_destroyif+0xa9/frame 0xffffff801945f8d0 if_clone_destroy() at if_clone_destroy+0xcc/frame 0xffffff801945f8f0 ifioctl() at ifioctl+0x2be/frame 0xffffff801945f9e0 kern_ioctl() at kern_ioctl+0xb3/frame 0xffffff801945fa30 sys_ioctl() at sys_ioctl+0x101/frame 0xffffff801945fb10 amd64_syscall() at amd64_syscall+0x4dc/frame 0xffffff801945fc30 Xfast_syscall() at Xfast_syscall+0xf7/frame 0xffffff801945fc30 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x20f50b4c, rsp = 0x7fffffffe2c8, rbp = 0x7fffffffeddf --- Some printf's reveals we are stuck doing virtqueue_poll: vtnet_exec_ctrl_cmd(struct vtnet_softc *sc, void *cookie, struct sglist *sg, int readable, int writable) { printf("%s:%i\n", __FUNCTION__, __LINE__); struct virtqueue *vq; vq = sc->vtnet_ctrl_vq; printf("%s:%i\n", __FUNCTION__, __LINE__); VTNET_CORE_LOCK_ASSERT(sc); printf("%s:%i\n", __FUNCTION__, __LINE__); KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_VQ, ("%s: CTRL_VQ feature not negotiated", __func__)); printf("%s:%i\n", __FUNCTION__, __LINE__); if (!virtqueue_empty(vq)) return; printf("%s:%i\n", __FUNCTION__, __LINE__); if (virtqueue_enqueue(vq, cookie, sg, readable, writable) != 0) return; printf("%s:%i\n", __FUNCTION__, __LINE__); /* * Poll for the response, but the command is likely already * done when we return from the notify. */ printf("%s:%i\n", __FUNCTION__, __LINE__); virtqueue_notify(vq); printf("%s:%i\n", __FUNCTION__, __LINE__); Stuck>> virtqueue_poll(vq, NULL); printf("%s:%i\n", __FUNCTION__, __LINE__); } My naive fix: diff --git a/freebsd/sys/dev/virtio/network/if_vtnet.c b/freebsd/sys/dev/virtio/network/if_vtnet.c index 7309110..35ae253 100644 --- a/freebsd/sys/dev/virtio/network/if_vtnet.c +++ b/freebsd/sys/dev/virtio/network/if_vtnet.c @@ -3402,6 +3414,7 @@ vtnet_update_vlan_filter(struct vtnet_softc *sc, int add, uint16_t tag) sc->vtnet_vlan_filter[idx] &= ~(1 << bit); if (ifp->if_capenable & IFCAP_VLAN_HWFILTER && + ifp->if_drv_flags & IFF_DRV_RUNNING && vtnet_exec_vlan_filter(sc, add, tag) != 0) { device_printf(sc->vtnet_dev, "cannot %s VLAN %d %s the host filter table\n", -- You are receiving this mail because: You are the assignee for the bug.