From owner-freebsd-net@freebsd.org Thu Feb 20 11:16:10 2020 Return-Path: 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 863FF25CC04 for ; Thu, 20 Feb 2020 11:16:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48NX8T75k4z4Sxr; Thu, 20 Feb 2020 11:16:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 682FAD495; Thu, 20 Feb 2020 11:16:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [169.254.162.27] (94-225-81-19.access.telenet.be [94.225.81.19]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 55A8F4455A; Thu, 20 Feb 2020 12:16:07 +0100 (CET) From: "Kristof Provost" To: "Gleb Smirnoff" Cc: freebsd-net Subject: Re: vtnet IFF_NEEDSEPOCH? Date: Thu, 20 Feb 2020 12:16:06 +0100 X-Mailer: MailMate (1.13.1r5671) Message-ID: In-Reply-To: <20200219224845.GI5741@FreeBSD.org> References: <20200218193708.GH5741@FreeBSD.org> <5520BD42-7D17-4561-A2CD-C690B159D15E@FreeBSD.org> <20200219224845.GI5741@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Feb 2020 11:16:10 -0000 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: 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 ; 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 ; 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 ; 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 ; 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 ; 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 ; 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: In-Reply-To: References: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 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.=