Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2020 10:52:09 +0100
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        freebsd-net <freebsd-net@freebsd.org>
Subject:   vtnet IFF_NEEDSEPOCH?
Message-ID:  <B45B8E77-CDB2-450E-951C-1E6E6BCC2527@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi,

I’ve been playing around with a risc-v qemu image, and run into this 
panic with vtnet:

	DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 5
	panic: Assertion in_epoch(net_epoch_preempt) failed at 
/usr/src/sys/net/netisr.c:1093
	cpuid = 0
	time = 1581981733
	KDB: stack backtrace:
	db_trace_self() at db_trace_self
	db_fetch_ksymtab() at db_fetch_ksymtab+0x12a
	kdb_backtrace() at kdb_backtrace+0x2c
	vpanic() at vpanic+0x144
	panic() at panic+0x26
	netisr_dispatch_src() at netisr_dispatch_src+0x3c0
	netisr_dispatch() at netisr_dispatch+0x10
	ether_ifattach() at ether_ifattach+0x2fa
	vtmmio_attach() at vtmmio_attach+0x490c
	vtmmio_attach() at vtmmio_attach+0x4624
	vtmmio_attach() at vtmmio_attach+0x544a
	virtqueue_intr() at virtqueue_intr+0xc
	vtmmio_attach() at vtmmio_attach+0x2008
	db_dump_intr_event() at db_dump_intr_event+0x730
	fork_exit() at fork_exit+0x68
	fork_trampoline() at fork_trampoline+0xa
	KDB: enter: panic
	[ thread pid 12 tid 100023 ]
	Stopped at      kdb_enter+0x44: sd      zero,0(a0)
	db>

It seems pretty clear that the vtmmio path doesn’t enter epoch before 
it runs the vtnet_attach() code.
On the other hand, I run vtnet CURRENT guests in bhyve, and don’t see 
this panic. In that case it lives on top of PCI rather than mmio, but I 
don’t see why/where that’d enter epoch.

The following does fix the panic for me, but I’m not sure if I’m 
fixing the correct problem:

	commit 4e388ab164c0d746875501d403a1c7052f1ed633 (HEAD -> kp-hardfloat)
	Author: Kristof Provost <kristof@codepro.be>
	Date:   Mon Feb 17 10:05:14 2020 +0100

	    vtnet: Needs epoch

	diff --git a/sys/dev/virtio/network/if_vtnet.c 
b/sys/dev/virtio/network/if_vtnet.c
	index ceb3ffaaf2b..8c776b27f21 100644
	--- a/sys/dev/virtio/network/if_vtnet.c
	+++ b/sys/dev/virtio/network/if_vtnet.c
	@@ -950,7 +950,7 @@ vtnet_setup_interface(struct vtnet_softc *sc)
	        if_initname(ifp, device_get_name(dev), device_get_unit(dev));
	        ifp->if_baudrate = IF_Gbps(10); /* Approx. */
	        ifp->if_softc = sc;
	-       ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
	+       ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | 
IFF_NEEDSEPOCH;
	        ifp->if_init = vtnet_init;
	        ifp->if_ioctl = vtnet_ioctl;
	        ifp->if_get_counter = vtnet_get_counter;

Best regards,
Kristof
From owner-freebsd-net@freebsd.org  Tue Feb 18 11:56:44 2020
Return-Path: <owner-freebsd-net@freebsd.org>
Delivered-To: freebsd-net@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9201B25DA4A
 for <freebsd-net@mailman.nyi.freebsd.org>;
 Tue, 18 Feb 2020 11:56:44 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::50:13])
 by mx1.freebsd.org (Postfix) with ESMTP id 48MK8C1SkQz3Fqx
 for <freebsd-net@freebsd.org>; Tue, 18 Feb 2020 11:56:43 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: by mailman.nyi.freebsd.org (Postfix)
 id 2F1F925DA49; Tue, 18 Feb 2020 11:56:43 +0000 (UTC)
Delivered-To: net@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2ED9525DA48
 for <net@mailman.nyi.freebsd.org>; Tue, 18 Feb 2020 11:56:43 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 48MK8C0Lj8z3Fqg
 for <net@FreeBSD.org>; Tue, 18 Feb 2020 11:56:43 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org (kenobi.freebsd.org
 [IPv6:2610:1c1:1:606c::50:1d])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0315D1F984
 for <net@FreeBSD.org>; Tue, 18 Feb 2020 11:56:43 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org ([127.0.1.5])
 by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 01IBugGE008955
 for <net@FreeBSD.org>; Tue, 18 Feb 2020 11:56:42 GMT
 (envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
 by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 01IBugcC008954
 for net@FreeBSD.org; Tue, 18 Feb 2020 11:56:42 GMT
 (envelope-from bugzilla-noreply@freebsd.org)
X-Authentication-Warning: kenobi.freebsd.org: www set sender to
 bugzilla-noreply@freebsd.org using -f
From: bugzilla-noreply@freebsd.org
To: net@FreeBSD.org
Subject: [Bug 187835] ngctl(8) strange behavior when adding more than 530
 vlan through nethraph
Date: Tue, 18 Feb 2020 11:56:43 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: bin
X-Bugzilla-Version: 10.0-STABLE
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: lutz@donnerhacke.de
X-Bugzilla-Status: Open
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: net@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-187835-7501-1BzDBmE5W7@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-187835-7501@https.bugs.freebsd.org/bugzilla/>
References: <bug-187835-7501@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>;
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Feb 2020 11:56:44 -0000

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D187835

lutz@donnerhacke.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lutz@donnerhacke.de

--- Comment #3 from lutz@donnerhacke.de ---
That's a memory allocation issue with the netgraph framework. There are sev=
eral
ones, which become visible, if you add enough nodes.

I've to have a look into it anyway.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B45B8E77-CDB2-450E-951C-1E6E6BCC2527>