From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 2 20:44:16 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E110E1065672 for ; Wed, 2 Nov 2011 20:44:15 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7201D8FC08 for ; Wed, 2 Nov 2011 20:44:15 +0000 (UTC) Received: by eyd10 with SMTP id 10so767017eyd.13 for ; Wed, 02 Nov 2011 13:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=O6Dm0cfN+B1wszV7wUvw5LhECO3FfThJaDSGOF3S6IY=; b=LXrxRAtmonWIYT6n9D/3pPhRnDzrqbtusy/vi0zfCTniyaWPTmctjBTezCqX9iIM90 0tETmQKNhMNuJYHIRGAdlh56pKNv51WHlkT9WjSy+iElJVDLPSy3haSFC2iO4vCyiweJ qdkbHiYZ54mNyjDlP8WF88nrp3v3hlBPiS7cI= MIME-Version: 1.0 Received: by 10.182.73.67 with SMTP id j3mr1212290obv.46.1320266654201; Wed, 02 Nov 2011 13:44:14 -0700 (PDT) Received: by 10.182.122.33 with HTTP; Wed, 2 Nov 2011 13:44:14 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 Nov 2011 13:44:14 -0700 Message-ID: From: Garrett Cooper To: Navdeep Parhar Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: incorrect parent refcounting in subr_firmware.c? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2011 20:44:17 -0000 On Wed, Nov 2, 2011 at 12:56 PM, Navdeep Parhar wrote: > I built a KLD with multiple firmware images, as shown here: > > KMOD=3Dfoo > FIRMWS=3D foo.bin:foo:1.0.0.0 > FIRMWS+=3Dbar.bin:bar:1.0.0.0 > FIRMWS+=3D ... > .include > > "foo" is the parent firmware and a firmware_get(foo) can autoload the > KLD. =A0"bar" and the rest are available only if the KLD is loaded (by > whatever means). =A0This is reasonable and works as expected. =A0But if I > just get and then put "foo" back, the KLD is not unloaded automatically. > > The problem is that a reference is placed on the parent firmware when > the other firmwares are registered (during module load). =A0I think this > reference should be placed during firmware_get on the child. > > What do people think about the attached patch? =A0It fixes things for me. It might be a generic problem; here's a similar (not exactly the same) issue: http://lists.freebsd.org/pipermail/freebsd-hackers/2010-August= /032714.html . Thanks, -Garrett