From owner-svn-src-all@FreeBSD.ORG Thu Jun 11 19:01:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 230971065676; Thu, 11 Jun 2009 19:01:46 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206192061.chello.pl [87.206.192.61]) by mx1.freebsd.org (Postfix) with ESMTP id 588378FC1A; Thu, 11 Jun 2009 19:01:45 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id E47B845DF4; Thu, 11 Jun 2009 21:01:43 +0200 (CEST) Received: from localhost (chello087206192061.chello.pl [87.206.192.61]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 2FC9845683; Thu, 11 Jun 2009 21:01:38 +0200 (CEST) Date: Thu, 11 Jun 2009 21:01:40 +0200 From: Pawel Jakub Dawidek To: Marko Zec Message-ID: <20090611190140.GE2642@garage.freebsd.pl> References: <200906111650.n5BGonnn053446@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Oiv9uiLrevHtW1RS" Content-Disposition: inline In-Reply-To: <200906111650.n5BGonnn053446@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194012 - in head: . sys/netgraph sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2009 19:01:46 -0000 --Oiv9uiLrevHtW1RS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 11, 2009 at 04:50:49PM +0000, Marko Zec wrote: > Author: zec > Date: Thu Jun 11 16:50:49 2009 > New Revision: 194012 > URL: http://svn.freebsd.org/changeset/base/194012 >=20 > Log: > Introduce a mechanism for detecting calls from outbound path of the > network stack when reentering the inbound path from netgraph, and > force queueing of mbufs at the outbound netgraph node. > =20 > The mechanism relies on two components. First, in netgraph nodes > where outbound path of the network stack calls into netgraph, the > current thread has to be appropriately marked using the new > NG_OUTBOUND_THREAD_REF() macro before proceeding to call further > into the netgraph topology, and unmarked using the > NG_OUTBOUND_THREAD_UNREF() macro before returning to the caller. > Second, netgraph nodes which can potentially reenter the network > stack in the inbound path have to mark their inbound hooks using > NG_HOOK_SET_TO_INBOUND() macro. The netgraph framework will then > detect when there is a danger of a call graph looping back from > outbound to inbound path via netgraph, and defer handing off the > mbufs to the "inbound" node to a worker thread with a clean stack. > =20 > In this first pass only the most obvious netgraph nodes have been > updated to ensure no outbound to inbound calls can occur. Nodes > such as ng_ipfw, ng_gif etc. should be further examined whether a > potential for outbound to inbound call looping exists. > =20 > This commit changes the layout of struct thread, but due to > __FreeBSD_version number shortage a version bump has been omitted > at this time, nevertheless kernel and modules have to be rebuilt. Are you sure Marko that you can't use sys/sys/osd.h instead of adding yet another field to the thread structure? Netgraph is optional component and optional components could take advantage of allocating stuff they need dynamically. The OSD (Object-Specific Data) KPI is designed for use by optional components - you can add your data to a thread, you can get it when you want and OSD will call your callback when thread dies, so you can clean up. Maybe you can't, but it's worth checking. PS. Currently OSD works for threads and jails, but it is ready to be extended to work with other object types, eg. vnodes, ifnets, etc. Even if you can't use it in this particular case, keep it in mind, as it might be useful for other vimage-related stuff. > Modified: head/sys/sys/proc.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/proc.h Thu Jun 11 16:48:59 2009 (r194011) > +++ head/sys/sys/proc.h Thu Jun 11 16:50:49 2009 (r194012) > @@ -235,6 +235,7 @@ struct thread { > char td_name[MAXCOMLEN + 1]; /* (*) Thread name. */ > struct file *td_fpop; /* (k) file referencing cdev under op */ > int td_dbgflags; /* (c) Userland debugger flags */ > + int td_ng_outbound; /* (k) Thread entered ng from above. */ > struct osd td_osd; /* (k) Object specific data. */ > #define td_endzero td_base_pri --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --Oiv9uiLrevHtW1RS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKMVSUForvXbEpPzQRAsMjAKCbEhGZb8oJQW8pnH+7SeIdvxIMHgCdFMJk 7vPmgM/FftsNB4x1xL8yXHE= =kIBG -----END PGP SIGNATURE----- --Oiv9uiLrevHtW1RS--