Removing NET_NEEDS_GIANT: first patch

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Wed, 25 Jul 2007 11:02:48 +0100 (BST)
(Resent spelling current_at_FreeBSD.org correctly)

Dear all,

Per many discussions over the past few years, we've finally reached the end of 
the road on non-MPSAFE network protocol components.  Recently, Bjoern, George, 
and I resolved, in various ways, the last few remaining protocol-layer 
dependencies (IPSEC, i4b, IPX over IP, netatm), and there are now no 
Giant-dependent protocol components left.  This is the result of a lot of 
hardware work by a great many FreeBSD developers over the past six years, and I 
really appreciate everyone's hard work to make this possible!

Attached is the first of a series of patches to start removing the 
NET_NEEDS_GIANT and debug.mpsafenet scaffolding.  This source code declaration 
was used by optionally compiled components to declare a strict requirement for 
Giant, and forced Giant over the entire network stack.  debug.mpsafenet could 
also be set by users in loader.conf in order to similar force Giant over the 
network stack, and existed for two reasons: to allow Giant to be put back over 
the network stack for debugging purposes, and to support these recently removed 
or fixed unsafe components.  As such, this patch removes the following:

- NET_NEEDS_GIANT() macro
- debug.mpsafenet tunable/sysctl and associated debug_mpsafenet variable, as
   well as functions supporting these.
- Use of this variable to control acqusition of Giant in network-related
   interrupt handlers and various other paths.

If also converts the following to no-ops, allowing them to be gradually removed 
in a series of follow-up patches to minimize risk and disruption:

- NET_LOCK_GIANT(), NET_UNLOCK_GIANT()
- NET_ASSERT_GIANT()

Finally, the following conversion takes place:

- NET_CALLOUT_MPSAFE is now an alias for CALLOUT_MPSAFE

The patch is attached, and I would appreciate feedback on the patch and any 
testing.  Assuming no serious negative feedback in the next couple of days, 
I'll request permission to commit from re_at_.  The patches that follow will:

- Replace all remaining NET_CALLOUT_MPSAFE instances with CALLOUT_MPSAFE,
   removing NET_CALLOUT_MPSAFE.
- Removing all references to NET_{LOCK,UNLOCK,ASSERT}_GIANT.
- Clean up some other weird Giant-related compatibility in the Cronyx drivers.

Things this patch doesn't do:

- Address the WITNESS lock order warnings generated when credential rules are
   used with ipfw/pf.  These are believed to be annoying but non-harmful, as
   deadlocks are no longer reported.  This view may be revised if evidence to
   the contrary is presented.

- Remove IFF_NEEDSGIANT, a similar set of Giant-acquiring shims used to
   protect non-MPSAFE device drivers.  I had hoped to remove this in 7.0, but I
   think this will happen instead for 8.0 due to remaining non-MPSAFEty in a
   few key network device drivers.

Patch attached, and also available at this URL:

   http://www.watson.org/~robert/freebsd/netperf/20070724-no_net_needs_giant_1.diff

Robert N M Watson
Computer Laboratory
University of Cambridge
Received on Wed Jul 25 2007 - 08:02:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC