From owner-freebsd-virtualization@FreeBSD.ORG Tue Apr 24 09:15:36 2012 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88A511065670 for ; Tue, 24 Apr 2012 09:15:36 +0000 (UTC) (envelope-from nvass@gmx.com) Received: from mailout-us.gmx.com (mailout-us.gmx.com [74.208.5.67]) by mx1.freebsd.org (Postfix) with SMTP id 4E1028FC0C for ; Tue, 24 Apr 2012 09:15:36 +0000 (UTC) Received: (qmail invoked by alias); 24 Apr 2012 09:15:35 -0000 Received: from g224207142.adsl.alicedsl.de (EHLO [192.168.178.28]) [92.224.207.142] by mail.gmx.com (mp-us006) with SMTP; 24 Apr 2012 05:15:35 -0400 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX1/oE6lHwi3oM20poXOEeub82j/+8omNYIV3LeopfI HrY8XPUs/94Ljw Message-ID: <4F966F2D.1070709@gmx.com> Date: Tue, 24 Apr 2012 11:15:25 +0200 From: Nikos Vassiliadis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Christian Lavoie References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------090606060902000909020903" X-Y-GMX-Trusted: 0 Cc: freebsd-virtualization@freebsd.org Subject: Re: kern/165252 patch X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 24 Apr 2012 09:15:36 -0000 This is a multi-part message in MIME format. --------------090606060902000909020903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 4/23/2012 6:33 PM, Christian Lavoie wrote: > The patch mentioned at > http://www.freebsd.org/cgi/query-pr.cgi?pr=165252&cat=kern#reply1 is > working for me -- without the patch my FreeBSD machine crashes within > a minute or two of booting, and with it it's been up for about half a > day now, under non-trivial networking load. > > I've contacted the author directly, and he asked that I mention here > that the patch is working for me, and ask that it be reviewed. Can > someone review said patch? > > I'm running 9.0-RELEASE, running two jails created following the > vimage/vnet howto at > http://wiki.polymorf.fr/index.php/Howto:FreeBSD_jail_vnet#Advenced_networking_:_NAT_and_firewalling > Hi Christian, You may want to try this better version of the patch. Warning: it's untested, I can't test it at moment in my FreeBSD-10, because pf panics in several places. I believe it should apply cleanly to FreeBSD-9.0. Nikos --------------090606060902000909020903 Content-Type: text/x-diff; name="pf.c[1].diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pf.c[1].diff" Index: sys/contrib/pf/net/pf.c =================================================================== --- sys/contrib/pf/net/pf.c (revision 234438) +++ sys/contrib/pf/net/pf.c (working copy) @@ -203,6 +203,8 @@ VNET_DEFINE(uma_zone_t, pf_state_key_pl); VNET_DEFINE(uma_zone_t, pf_state_item_pl); VNET_DEFINE(uma_zone_t, pf_altq_pl); + +#define V_cur VNET(cur) #else struct pf_state_tree pf_statetbl; @@ -1661,7 +1663,7 @@ pf_purge_expired_states(u_int32_t maxcheck) #endif { - static struct pf_state *cur = NULL; + static VNET_DEFINE(struct pf_state *, cur) = NULL; struct pf_state *next; #ifdef __FreeBSD__ int locked = waslocked; @@ -1671,20 +1673,20 @@ while (maxcheck--) { /* wrap to start of list when we hit the end */ - if (cur == NULL) { + if (V_cur == NULL) { #ifdef __FreeBSD__ - cur = TAILQ_FIRST(&V_state_list); + V_cur = TAILQ_FIRST(&V_state_list); #else - cur = TAILQ_FIRST(&state_list); + V_cur = TAILQ_FIRST(&state_list); #endif - if (cur == NULL) + if (V_cur == NULL) break; /* list empty */ } /* get next state, as cur may get deleted */ - next = TAILQ_NEXT(cur, entry_list); + next = TAILQ_NEXT(V_cur, entry_list); - if (cur->timeout == PFTM_UNLINKED) { + if (V_cur->timeout == PFTM_UNLINKED) { /* free unlinked state */ if (! locked) { #ifdef __FreeBSD__ @@ -1695,10 +1697,10 @@ #endif locked = 1; } - pf_free_state(cur); - } else if (pf_state_expires(cur) <= time_second) { + pf_free_state(V_cur); + } else if (pf_state_expires(V_cur) <= time_second) { /* unlink and free expired state */ - pf_unlink_state(cur); + pf_unlink_state(V_cur); if (! locked) { #ifdef __FreeBSD__ if (!sx_try_upgrade(&V_pf_consistency_lock)) @@ -1708,9 +1710,9 @@ #endif locked = 1; } - pf_free_state(cur); + pf_free_state(V_cur); } - cur = next; + V_cur = next; } #ifdef __FreeBSD__ --------------090606060902000909020903--