Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2020 12:16:06 +0100
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        "Gleb Smirnoff" <glebius@freebsd.org>
Cc:        freebsd-net <freebsd-net@freebsd.org>
Subject:   Re: vtnet IFF_NEEDSEPOCH?
Message-ID:  <CB21E2A0-48DF-46CC-BFC2-31A105B7C865@FreeBSD.org>
In-Reply-To: <20200219224845.GI5741@FreeBSD.org>
References:  <B45B8E77-CDB2-450E-951C-1E6E6BCC2527@FreeBSD.org> <20200218193708.GH5741@FreeBSD.org> <5520BD42-7D17-4561-A2CD-C690B159D15E@FreeBSD.org> <20200219224845.GI5741@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19 Feb 2020, at 23:48, Gleb Smirnoff wrote:
> On Tue, Feb 18, 2020 at 10:08:50PM +0100, Kristof Provost wrote:
> K> So I suspect our call stack is something like virtqueue_intr() ->
> K> vtnet_rx_vq_intr() -> vtnet_rxq_eof() -> vtnet_rxq_input() ->
> K> ether_input().
> K> I don’t see anything entering epoch in that path, which 
> presumably explains
> K> the panic, but I still don’t understand why my bhyve current vm 
> doesn’t
> K> panic in the same way.
>
> On bhyve we enter it through interrupt handler, and this is where we
> enter the epoch. Does RISC-V has interrupt handling by the MI code
> in sys/kern/kern_intr.c as other platforms?
>
It does, yes, but that was the hint I needed. I didn’t know that we 
entered net_epoch automagically based on the interrupt type.

The difference between the two is that Bhyve uses virtio_pci, and in my 
qemu case we run through the virtio_mmio path. In that path we always 
set INTR_TYPE_MISC, so we never set INTR_TYPE_NET, even for if_vtnet, so 
we never entered epoch.

This is the correct fix:

	diff --git a/sys/dev/virtio/mmio/virtio_mmio.c 
b/sys/dev/virtio/mmio/virtio_mmio.c
	index 95eb8647052..ccafe326868 100644
	--- a/sys/dev/virtio/mmio/virtio_mmio.c
	+++ b/sys/dev/virtio/mmio/virtio_mmio.c
	@@ -196,7 +196,7 @@ vtmmio_setup_intr(device_t dev, enum intr_type 
type)
	                return (ENXIO);
	        }

	-       if (bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | 
INTR_MPSAFE,
	+       if (bus_setup_intr(dev, sc->res[1], type | INTR_MPSAFE,
	                NULL, vtmmio_vq_intr, sc, &sc->ih)) {
	                device_printf(dev, "Can't setup the interrupt\n");
	                return (ENXIO);

Thanks for the help!

Regards,
Kristof
From owner-freebsd-net@freebsd.org  Thu Feb 20 11:18:20 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 EFA0325CCDF
 for <freebsd-net@mailman.nyi.freebsd.org>;
 Thu, 20 Feb 2020 11:18:20 +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 48NXC069CNz4WXT
 for <freebsd-net@freebsd.org>; Thu, 20 Feb 2020 11:18:20 +0000 (UTC)
 (envelope-from bugzilla-noreply@freebsd.org)
Received: by mailman.nyi.freebsd.org (Postfix)
 id D1C7E25CCDE; Thu, 20 Feb 2020 11:18:20 +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 D184725CCDD
 for <net@mailman.nyi.freebsd.org>; Thu, 20 Feb 2020 11:18:20 +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 48NXC05Cs2z4WX9
 for <net@FreeBSD.org>; Thu, 20 Feb 2020 11:18:20 +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 A2B9520CE0
 for <net@FreeBSD.org>; Thu, 20 Feb 2020 11:18:20 +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 01KBIK7O021121
 for <net@FreeBSD.org>; Thu, 20 Feb 2020 11:18:20 GMT
 (envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
 by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 01KBIKHF021120
 for net@FreeBSD.org; Thu, 20 Feb 2020 11:18:20 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 244241] ng_eiface: panic: epoch_wait_preempt() called in the
 middle of an epoch section of the same epoch
Date: Thu, 20 Feb 2020 11:18:20 +0000
X-Bugzilla-Reason: AssignedTo CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: kern
X-Bugzilla-Version: CURRENT
X-Bugzilla-Keywords: panic
X-Bugzilla-Severity: Affects Many People
X-Bugzilla-Who: linimon@FreeBSD.org
X-Bugzilla-Status: New
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: net@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: cc assigned_to keywords
Message-ID: <bug-244241-7501-yZilspMZar@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-244241-7501@https.bugs.freebsd.org/bugzilla/>
References: <bug-244241-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: Thu, 20 Feb 2020 11:18:21 -0000

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

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|net@FreeBSD.org             |
           Assignee|bugs@FreeBSD.org            |net@FreeBSD.org
           Keywords|                            |panic

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CB21E2A0-48DF-46CC-BFC2-31A105B7C865>