From owner-cvs-src@FreeBSD.ORG Thu Sep 22 20:44:42 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 634EA16A41F; Thu, 22 Sep 2005 20:44:42 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D949E43D45; Thu, 22 Sep 2005 20:44:39 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.13.4/8.13.4) with ESMTP id j8MKiWW7027373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Sep 2005 16:44:32 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id j8MKiLN7010347; Thu, 22 Sep 2005 16:44:21 -0400 (EDT) (envelope-from gallatin) Date: Thu, 22 Sep 2005 16:44:21 -0400 From: Andrew Gallatin To: Robert Watson Message-ID: <20050922164421.A10259@grasshopper.cs.duke.edu> References: <20050920223315.V34322@fledge.watson.org> <20050921154153.GB22964@ip.net.ua> <200509211455.59154.jhb@FreeBSD.org> <20050921.130241.102576086.imp@bsdimp.com> <20050922111002.N34322@fledge.watson.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20050922111002.N34322@fledge.watson.org>; from rwatson@FreeBSD.org on Thu, Sep 22, 2005 at 11:11:36AM +0100 X-Operating-System: FreeBSD 4.9-RELEASE-p1 on an i386 Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org, ru@FreeBSD.org, "M. Warner Losh" Subject: Re: cvs commit: src/sys/dev/an if_an.c src/sys/dev/arl if_arl_isa.c src/sys/dev/awi if_awi_pccard.c src/sys/dev/cm if_cm_isa.c src/sys/dev/cnw if_cnw.c src/sys/dev/cp if_cp.c src/sys/dev/cs if_cs.c src/sys/dev/ed if_ed.c src/sys/dev/em if_em.c ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2005 20:44:42 -0000 Robert Watson [rwatson@FreeBSD.org] wrote: > > Would if_dead simply replace the function vector, or would it also drain > threads currently in those functions? We have a pervasive problem with > dead functions that fail to drain (phk has fixed this up for cdev, I > believe, and colin for callouts, but there are many others), and without > that there may be problems. However, if adding draining and refcounting > on entering ifnet methods, we need to be very cautious about the > performance impact. The if_dead() method is basically what MacOSX does. The device operations are replaced by an dlil_recycle_$NAME, which drop packets, return EOPNOTSUPP, etc. I'd hate to see us overhead in the transmit routine to do reference counting to protect against a race which can only happen on detach, which is quite rare. Replacing if_output and sleeping a second or two to wait for threads to drain should solve 99.99% of the races. Nothing in if_output should be blocking, so I don't see the need for real refcounting. For ioctl, just put a lock around all calls into ifp->if_ioctl(), and make sure if_dead grabs that lock before replacing if_ioctl(). Nobody cares about if_ioctl() performance do they? Maybe my viewpoint is too restricted, because I have never had to deal with an mii, or hardware that does really dumb stuff... Drew