From owner-cvs-src@FreeBSD.ORG Fri Apr 25 11:06:08 2003 Return-Path: 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 3D47337B404 for ; Fri, 25 Apr 2003 11:06:08 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id EA13443FDF for ; Fri, 25 Apr 2003 11:06:06 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 65524 invoked by uid 1000); 25 Apr 2003 18:06:07 -0000 Date: Fri, 25 Apr 2003 11:06:07 -0700 (PDT) From: Nate Lawson To: Jeffrey Hsu In-Reply-To: <200304250949.h3P9ntPi014351@mta4.rcsntx.swbell.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/fxp if_fxp.c if_fxpvar.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 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: Fri, 25 Apr 2003 18:06:08 -0000 On Fri, 25 Apr 2003, Jeffrey Hsu wrote: > > Please do not copy the exact approach taken here for a little > > while until ifnet locking is finished as there may need to be > > some changes made to this model. > > These locks are an example of local SMP locking. It is simply not > possible to correctly reason about SMP locally. > Jeffrey Please see my email on cvs-all about this. I am not attempting to reason about the "outside world" with the locking. I am merely trying to protect access by fxp functions to fxp shared data (i.e. softc, driver registers, etc.) I am not trying to serialize IF_DEQUEUE access or such. My code makes the following assumptions: * Entries are fxp_start, fxp_intr, fxp_tick, fxp_init, fxp_ioctl, and fxp_poll. No one will call fxp except through those routines. * All the above functions access fxp shared data throughout the entire function, therefore it will take more testing and refactoring of the code path to allow multiple locks/unlocks if so desired. Therefore, for now, hold the fxp lock for most of the routine. * It is not harmful to call outside functions (i.e. ifnet) with a local fxp lock held. Note that I am _not_ attempting to serialize access to outside functions by holding the fxp lock across them. Please explain (including details) if any of the above assumptions are going to be invalidated by your locking work. I fully understand that ifnet locking is not complete and that another thread may access ifp while fxp is accessing it. I am not attempting to prevent this and I left MPSAFE disabled because of this. Jeffrey, you've made short comments in private email like the one above but they seem orthogonal to the code I just committed. Please explain so I can modify my approach if necessary. -Nate