From owner-freebsd-arch@FreeBSD.ORG Fri Oct 7 09:35:40 2005 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4701116A41F; Fri, 7 Oct 2005 09:35:40 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C06943D48; Fri, 7 Oct 2005 09:35:40 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id j979ZdwL005325; Fri, 7 Oct 2005 02:35:39 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id j979ZdRt005324; Fri, 7 Oct 2005 02:35:39 -0700 (PDT) (envelope-from rizzo) Date: Fri, 7 Oct 2005 02:35:39 -0700 From: Luigi Rizzo To: dima <_pppp@mail.ru> Message-ID: <20051007023539.B5081@xorpc.icir.org> References: <20051006183413.GH14542@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from _pppp@mail.ru on Fri, Oct 07, 2005 at 01:28:58PM +0400 Cc: arch@freebsd.org, Gleb Smirnoff Subject: Re: [REVIEW/TEST] polling(4) changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2005 09:35:40 -0000 On Fri, Oct 07, 2005 at 01:28:58PM +0400, dima wrote: > > d> Seems to be a first considerable step regarding the ideas discussed in March :) > > d> But, my idea about the separate locking of each interface dissappeared from this implementation. mtx_poll is good to protect the pollrec array and other sensitive variables. But we could get advantage of SMP machines writing polling loops like this: > > d> > > d> for( i = 0; i < poll_handlers; ++i ) { > > d> mtx_lock( &iface_lock[i] ); > > d> pr[i].handler(pr[i].ifp, POLL_ONLY, count); > > d> mtx_unlock( &iface_lock[i] ); > > d> } > > > > What is the benefit here? The driver must have its own lock. > > Well, consider the absense of the mtx_poll lock: > > - mtx_lock( &mtx_poll ); > for( i = 0; i < poll_handlers; ++i ) { > + mtx_lock( &iface_lock[i] ); > pr[i].handler( pr[i].ifp, POLL_ONLY, count ); > + mtx_unlock( &iface_lock[i] ); > } > - mtx_unlock( &mtx_poll ); > > So, several kernel threads in an SMP machine can poll different interfaces simultaneously. And mtx_lock should only be used in ether_poll_[de]register(). and spend their time fighting for the locks. The "ideas discussed in march" tried to point out exactly that problem. cheers luigi > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"