From owner-freebsd-net@freebsd.org Wed Sep 5 10:47:32 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D93CAFEBD78 for ; Wed, 5 Sep 2018 10:47:31 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 608617BB65 for ; Wed, 5 Sep 2018 10:47:31 +0000 (UTC) (envelope-from zec@fer.hr) Received: by mailman.ysv.freebsd.org (Postfix) id 22582FEBD77; Wed, 5 Sep 2018 10:47:31 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10CD3FEBD75 for ; Wed, 5 Sep 2018 10:47:31 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA 3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8493A7BB62; Wed, 5 Sep 2018 10:47:30 +0000 (UTC) (envelope-from zec@fer.hr) Received: from x23 (161.53.19.9) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.3.399.0; Wed, 5 Sep 2018 12:47:28 +0200 Date: Wed, 5 Sep 2018 12:47:30 +0200 From: Marko Zec To: Vincenzo Maffione CC: Luigi Rizzo , "freebsd-net@freebsd.org" , Subject: Re: vale and netmap module questions Message-ID: <20180905124730.0f266c37@x23> In-Reply-To: References: <20180901014953.GV45503@funkthat.com> <20180901211123.GZ45503@funkthat.com> <20180904164303.68c43b6e@x23> <20180904162815.GA75530@funkthat.com> <20180905104433.08ad13b8@x23> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; amd64-portbld-freebsd11.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [161.53.19.9] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 10:47:32 -0000 On Wed, 5 Sep 2018 12:36:38 +0200 Vincenzo Maffione wrote: > Hi Marko, > Thanks a lot for identifying the problem. > If I understand correctly, simply adding -D VIMAGE here > https://github.com/luigirizzo/netmap/blob/master/sys/modules/netmap/Makefile#L11 > would at least mitigate the issue. > If you think I'm right I'll just add it. Right, go for it... Marko > > Thanks, > Vincenzo > > Il giorno mer 5 set 2018 alle ore 10:44 Marko Zec ha > scritto: > > > On Tue, 4 Sep 2018 20:18:29 +0200 > > Vincenzo Maffione wrote: > > > > > Hi, > > > I don't think the panic depends on the architecture. Also, it > > > does not depend on using emulated mode or not. > > > We have seen this happening on x86_64 on FreeBSD 12 head. > > > > > > As John-Mark says, kdloading netmap.ko is not enough. You need to > > > open a netmap port corresponding > > > to any network interface, e.g. > > > # pkt-gen -i eth0 > > > because this will trigger ifunit_ref() in the kernel (netmap > > > tries to grab the interface called "eth0"). > > > The ifunit_ref() panics and we still need to figure out why. > > > > After more carefully rereading jmg's original report, on amd64 I > > reproduced exactly the same panic he reported on arm64, the summary > > follows: > > > > - the problem can be observed as VNET related, and can be triggered > > only on kernels built with "options VIMAGE" but without "device > > netmap". > > > > - netmap.ko built using make buildkernel works fine. > > > > - netmap.ko built separately (cd sys/modules/netmap; make) panics > > on a first reference to vale interface, such as "tcpdump -ni > > vale1:a" > > > > - the problem is that the separately built module is compiled > > without "options VIMAGE", and as such does not set curvnet prior to > > calling into network stack functions, therefore we have a null > > pointer dereference in ifunit_ref() and voila... > > > > - hence, there's nothing to fix in the netmap code, and there's > > nothing to fix in the network stack either related to this > > particular problem, but rather we need a general mechanism which > > would prevent kldloading non-VNETized .ko modules into a VNETized > > kernel. I have no idea how to approach this, besides adding bz@ to > > the cc: list, perhaps he could chime in with some thoughts? > > > > Cheers, > > > > Marko > > > >