From owner-freebsd-current@FreeBSD.ORG Thu Aug 24 01:11:12 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DFB3B16A4DE for ; Thu, 24 Aug 2006 01:11:11 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1DA143D4C for ; Thu, 24 Aug 2006 01:11:10 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: by py-out-1112.google.com with SMTP id o67so426046pye for ; Wed, 23 Aug 2006 18:11:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:reply-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=G/gSWkFlL1LgJIuU/yUtSlXwiKOGZLwvUJ8P5IQ7M39TlXxfdZC0DMLLd2HYdEN5xoRrbwF1LJYt3c1EWvZIEWLZhQ1N9msMZpkA281ZbIKRey3LOnuClIoEYSeGc4XgD3jZxyn7e/NNFPZhUmzQWMCENFvt9A2dCeVP6BaRFfs= Received: by 10.35.121.9 with SMTP id y9mr1651713pym; Wed, 23 Aug 2006 18:11:10 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ( [211.53.35.84]) by mx.gmail.com with ESMTP id j4sm876755nzd.2006.08.23.18.11.07; Wed, 23 Aug 2006 18:11:09 -0700 (PDT) Received: from michelle.cdnetworks.co.kr (localhost.cdnetworks.co.kr [127.0.0.1]) by michelle.cdnetworks.co.kr (8.13.5/8.13.5) with ESMTP id k7O1BGJi023071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Aug 2006 10:11:17 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id k7O1BGcY023070; Thu, 24 Aug 2006 10:11:16 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Thu, 24 Aug 2006 10:11:16 +0900 From: Pyun YongHyeon To: Oleg Bulyzhin Message-ID: <20060824011116.GD22634@cdnetworks.co.kr> References: <20060822042023.GC12848@cdnetworks.co.kr> <20060822091107.A3909@fw.reifenberger.com> <20060822073201.GI12848@cdnetworks.co.kr> <20060822144341.L5561@fw.reifenberger.com> <20060822204342.GA4943@lath.rinet.ru> <20060823005554.GC17902@cdnetworks.co.kr> <20060823124035.GA18628@lath.rinet.ru> <20060824002632.GA22634@cdnetworks.co.kr> <20060824004225.GB25876@lath.rinet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060824004225.GB25876@lath.rinet.ru> User-Agent: Mutt/1.4.2.1i Cc: Michael Reifenberger , freebsd-current@freebsd.org Subject: Re: call for bge(4) testers X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2006 01:11:12 -0000 On Thu, Aug 24, 2006 at 04:42:25AM +0400, Oleg Bulyzhin wrote: > On Thu, Aug 24, 2006 at 09:26:32AM +0900, Pyun YongHyeon wrote: > > On Wed, Aug 23, 2006 at 04:40:35PM +0400, Oleg Bulyzhin wrote: [...] > > > > > My idea was: perhaps, under certain condition, concurrent access to PHY could > > > lead to hardware deadlock. > > > > > > > Yes. Because MII bus access needs several steps to access PHY > > registers its operation shouldn't be interrupted until all pending > > requests are served. > > > > I can't sure you remember my mail for MII lock which modifies > > mii_phy_probe API to take an additional mutex. The driver mutex > > could be used with MII bus access/callbacks. > > Yes, i remember that mail but i didnt had time to dig code deep enough > to give an answer. I did it recently, while working on PR. > Glad to hear that. :-) > > If interface is up/running and auto negotiation is in progress MII > > layer would inspect BMSR register periodically to know the state > > of link. During the time if you run ifconfig(8) to know the state > > of the link or to change media type/duplex it will access PHY > > registers. Normally it would end up with "link states coalesced" > > messages. > > > > As you know the two callbacks(vge_ifmedia_upd/vge_ifmedia_sts) will > > end up with calling mii_mediachg() or mii_pollstat() which in turn > > access PHY registers. So if MII access is properly serialized we > > wouldn't get stale data. I guess your fix solves it by protecting > > callbacks with driver mutex but it wouldn't fix other cases. > > For example see vge_miibus_statchg MII interface. > > MII layer does not have it's own callouts, i.e. those autonegotiation > checks of BMSR are triggered by driver's _tick() function, which are locked. > So if we have locked _tick() & _ifmedia_(upd|sts) functions, concurrent > access to PHY is impossible. > (If we are talking about vge_miibus_statchg(), it would be: > vge_tick (here we obtain lock) -> mii_tick -> ciphy_service -> > mii_phy_update -> vge_miibus_statchg). > If we set media type manually while autonegotiation is in progress, wouldn't it access PHY registers without driver lock? -- Regards, Pyun YongHyeon