From owner-freebsd-virtualization@FreeBSD.ORG Sat Jul 27 14:20:01 2013 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1FBBB8E5; Sat, 27 Jul 2013 14:20:01 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A6AFC27BE; Sat, 27 Jul 2013 14:20:00 +0000 (UTC) Received: from x23.lan (89.164.3.121) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.2.342.3; Sat, 27 Jul 2013 16:19:51 +0200 From: Marko Zec To: Craig Rodrigues Subject: Re: De-virtualize V_pf_mtag_z to eliminate kernel panics. Date: Sat, 27 Jul 2013 16:19:51 +0200 User-Agent: KMail/1.9.10 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <201307271619.51409.zec@fer.hr> X-Originating-IP: [89.164.3.121] Cc: Adrian Chadd , Gleb Smirnoff , "freebsd-virtualization@freebsd.org" , freebsd-pf@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 14:20:01 -0000 On Saturday 27 July 2013 08:31:48 Craig Rodrigues wrote: > Gleb, > > Since you did a lot of work in GRN 240233 > to fix PF issues, especially for VIMAGE, I thought I would > ask your opinion on the attached patch. > > In this post: > > http://lists.freebsd.org/pipermail/freebsd-virtualization/2013-July/00140 >5.html > > I reported multiple PF-related panics when VIMAGE was enabled > in my kernel config. > > In these posts: > http://lists.freebsd.org/pipermail/freebsd-virtualization/2013-July/00141 >3.html > http://lists.freebsd.org/pipermail/freebsd-virtualization/2013-July/00142 >0.html > > Marko Zec seemed to think that de-virtualizing V_pf_mtag_z > would be a valid solution to this problem, and that keeping > V_pf_mtag_z as a per-vnet variable is not necessary. > > What do you think of Marko's comments, and this patch? Hi Craig, while in principle I agree with the intent to de-virtualize V_pf_mtag_z (after all, this was my suggestion in the first place), your proposed patch isn't the valid solution, since on each vnet creation you'll be clobbering (now global) variable pf_mtag_z, which would imminently cause double-free or similar issues later during runtime. You should move pf_mtag_z = uma_zcreate(...) to some other function which isn't called for each vnet, or at least as a crude kludge, do this conditionally if (curvnet == vnet0). The same goes for uma_zdestroy(pf_mtag_z)... Cheers, Marko