From owner-freebsd-current@FreeBSD.ORG Tue May 5 06:39:56 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97F49106564A for ; Tue, 5 May 2009 06:39:56 +0000 (UTC) (envelope-from jimmiejaz@gmail.com) Received: from mail-qy0-f105.google.com (mail-qy0-f105.google.com [209.85.221.105]) by mx1.freebsd.org (Postfix) with ESMTP id 1756F8FC08 for ; Tue, 5 May 2009 06:39:55 +0000 (UTC) (envelope-from jimmiejaz@gmail.com) Received: by qyk3 with SMTP id 3so8483558qyk.3 for ; Mon, 04 May 2009 23:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:subject:references:content-type :content-transfer-encoding; bh=nphZF+Nzx3RcQ1hiAARD2sD4yRmVUlk5T3Og4T+YI5s=; b=FZohWU1qead//xb2A+tMjnCyBXhWPaPeJBoIUgtFgITEz6S1BjsDd9+vU7JJCXbkaK 7vas9wMmEat3lfrM4XmRV9pQJTj0zWEj+SH9uIDQ0Qp0norL9wQfMDU+9ZS4bX2PdeHn PYRCjT2/VSoOOt/EkxU4rdLIPUJvPbLvbIBMo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:content-type:content-transfer-encoding; b=dOW04FjAnVnu/yUoZDrPDSj+dgmh9bvOzMm+ihx6IMaD9WauQzk/PYU132WfL8apub oYaJVizMDErA2oLXTSTmQB6QOFyHMRFQ3Uzt6hEI+UEAYdZab4wsP72Ahc24daczgdbe Hub2StH25n/L0xk1mM441UlAUc1wCP8apr8rU= Received: by 10.224.54.83 with SMTP id p19mr178756qag.191.1241503779197; Mon, 04 May 2009 23:09:39 -0700 (PDT) Received: from jimmiejaz.org (bas1-toronto44-1279263445.dsl.bell.ca [76.64.2.213]) by mx.google.com with ESMTPS id 34sm1986499yxm.21.2009.05.04.23.09.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 04 May 2009 23:09:38 -0700 (PDT) Message-ID: <49FFD81A.5040501@gmail.com> Date: Tue, 05 May 2009 02:09:30 -0400 From: Jimmie James User-Agent: Thunderbird 2.0.0.7pre (X11/20090406) MIME-Version: 1.0 To: freebsd-current@freebsd.org, john@baldwin.cx References: 200903041011.24606.jhb@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 05 May 2009 11:18:06 +0000 Cc: Subject: pci regression: "panic: resource_list_alloc: resource entry is busy" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jimmiejaz@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: Tue, 05 May 2009 06:39:56 -0000 Why is this affecting 7.2-STABLE? Does anyone test anything before a release anymore? This doesn't apply to 7.2: atching file vga_pci.c using Plan A... Hunk #1 failed at 42. Hunk #2 succeeded at 118 (offset -20 lines). Hunk #3 succeeded at 146 (offset -20 lines). 1 out of 3 hunks failed--saving rejects to vga_pci.c.rej Hmm... Ignoring the trailing garbage. done > John Baldwin wrote: > Probably at some point the agp and drm drivers for Intel will be merged which > would fix this, but this patch should help for now. We used to be leaking > a small portion of KVA due to this problem before. > > --- //depot/vendor/freebsd/src/sys/dev/pci/vga_pci.c 2008/09/19 19:15:30 > +++ //depot/user/jhb/acpipci/dev/pci/vga_pci.c 2009/03/04 15:32:08 > @@ -42,12 +42,20 @@ > #include > #include > #include > +#include > +#include > > #include > #include > > +struct vga_resource { > + struct resource *vr_res; > + int vr_refs; > +}; > + > struct vga_pci_softc { > device_t vga_msi_child; /* Child driver using MSI. */ > + struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; > }; > > static int > @@ -130,7 +138,27 @@ > vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, > u_long start, u_long end, u_long count, u_int flags) > { > + struct vga_pci_softc *sc; > + int bar; > > + switch (type) { > + case SYS_RES_MEMORY: > + case SYS_RES_IOPORT: > + /* > + * For BARs, we cache the resource so that we only allocate it > + * from the PCI bus once. > + */ > + bar = PCI_RID2BAR(*rid); > + if (bar < 0 || bar > PCIR_MAX_BAR_0) > + return (NULL); > + sc = device_get_softc(dev); > + if (sc->vga_res[bar].vr_res == NULL) > + sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type, > + rid, start, end, count, flags); > + if (sc->vga_res[bar].vr_res != NULL) > + sc->vga_res[bar].vr_refs++; > + return (sc->vga_res[bar].vr_res); > + } > return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); > } > > @@ -138,6 +166,37 @@ > vga_pci_release_resource(device_t dev, device_t child, int type, int rid, > struct resource *r) > { > + struct vga_pci_softc *sc; > + int bar, error; > + > + switch (type) { > + case SYS_RES_MEMORY: > + case SYS_RES_IOPORT: > + /* > + * For BARs, we release the resource from the PCI bus > + * when the last child reference goes away. > + */ > + bar = PCI_RID2BAR(rid); > + if (bar < 0 || bar > PCIR_MAX_BAR_0) > + return (EINVAL); > + sc = device_get_softc(dev); > + if (sc->vga_res[bar].vr_res == NULL) > + return (EINVAL); > + KASSERT(sc->vga_res[bar].vr_res == r, > + ("vga_pci resource mismatch")); > + if (sc->vga_res[bar].vr_refs > 1) { > + sc->vga_res[bar].vr_refs--; > + return (0); > + } > + KASSERT(sc->vga_res[bar].vr_refs > 0, > + ("vga_pci resource reference count underflow")); > + error = bus_release_resource(dev, type, rid, r); > + if (error == 0) { > + sc->vga_res[bar].vr_res = NULL; > + sc->vga_res[bar].vr_refs = 0; > + } > + return (error); > + } > > return (bus_release_resource(dev, type, rid, r)); > } > -- Over the years I've come to regard you as people I've met.