From owner-freebsd-current Mon Mar 27 13:47:12 2000 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 5554537BBEA for ; Mon, 27 Mar 2000 13:47:10 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id NAA43734; Mon, 27 Mar 2000 13:47:09 -0800 (PST) (envelope-from dillon) Date: Mon, 27 Mar 2000 13:47:09 -0800 (PST) From: Matthew Dillon Message-Id: <200003272147.NAA43734@apollo.backplane.com> To: Alfred Perlstein Cc: Daniel Eischen , Nate Williams , nms@otdel-1.org, freebsd-current@FreeBSD.ORG Subject: Re: Is there spinlocks/semaphores available for drivers? References: <200003272008.MAA42799@apollo.backplane.com> <20000327135414.M21029@fw.wintelcom.net> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :I think you're thinking this: : : /-----int 1 :spl -<---> int 2 : \-----int 3 : :spl messing with several mutexes, instead consider: : :int 1 >---\ :int 2 >---->-- splmutex :int 3 >---/ Problem #1: Different spl levels use different combinations of interrupts. Some interrupts belong to several spl sets. Problem #2: Mutexes that you compete for on a regular basis cost cpu cycles to own. Combining spl bits into a smaller set of mutexes will exasperate this problem -- it will almost be as if we had a BGL. :Where a single mutex is shared by several interrupts. : :There's also this to consider: : :proc0: splaaa(); splbbb(); :proc1: splbbb(); splaaa(); : :deadlock. Which needs to be worked out somehow. : :-- :-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] Yes, which is one of the many reasons why all current spl() manipualtion must be done while holding the BGL. I think the best way to approach solving the spl problem is to not attempt to migrate the spl interface. Instead we slowly replace it in a piecemeal fashion. It would work like this: Any existing code using the spl API *MUST* hold the BGL. In order to remove the BGL requirement the code, amoung other things, must migrate to the 'new' mutex interface (or whatever API we come up with). Both the old and the new interfaces would be able to work in tandem. This way we split the problem into multiple pieces rather then attempt to shoehorn the existing SPL mechanism into the ultimate SMP solution (instead it becomes only an interim solution, but one that can be 'mixed' with whatever the real solution winds up being). This allows us to solve the problem in a piecemeal fashion and reduces the chance of breaking the code base in a nasty fashion. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message