From nobody@FreeBSD.org  Sat Jun  2 22:01:04 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 259A737B422
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  2 Jun 2001 22:01:04 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f53514r03464;
	Sat, 2 Jun 2001 22:01:04 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200106030501.f53514r03464@freefall.freebsd.org>
Date: Sat, 2 Jun 2001 22:01:04 -0700 (PDT)
From: simonw@lucent.com
To: freebsd-gnats-submit@FreeBSD.org
Subject: AGP RELEASE ioctl frees memory
X-Send-Pr-Version: www-1.0

>Number:         27849
>Category:       kern
>Synopsis:       AGP RELEASE ioctl frees memory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dfr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 02 22:10:01 PDT 2001
>Closed-Date:    Fri Jan 17 20:42:37 PST 2003
>Last-Modified:  Fri Jan 17 20:42:37 PST 2003
>Originator:     Simon Walton
>Release:        4.2
>Organization:
>Environment:
FreeBSD stepney 4.2-RELEASE FreeBSD 4.2-RELEASE #8: Mon May 28 23:34:51 PDT 2001     simonw@stepney:/usr/src/sys/compile/STEPNEY  i386

>Description:
The implementation of the ioctl AGPIOC_RELEASE includes the following
code:

        /*
         * Clear out the aperture and free any outstanding memory blocks.
         */     
        while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
                if (mem->am_is_bound)
                        AGP_UNBIND_MEMORY(dev, mem);
                AGP_FREE_MEMORY(dev, mem);
        }

Clearly this deallocates all the memory that the application
has attached to the AGP space. Yet the spec for the agp ioctls
(at least the one I have) states that this ioctl merely releases
control of the agp device - it doesn't deallocate memory that the
app allocated while it had control. That is done with the UNBIND
and DEALLOCATE commands.

   The Utah GLX code certainly assumes this behaviour - I had to
comment out the RELEASE ioctl to get it to work with FreeBSD.

>How-To-Repeat:
Use Xfree86 3.3.5 with the Utah GLX module (add -DHAVE_LINUX_NEWAGP).
It will complain about 
>Fix:
I think just taking out the code segment given above
will suffice.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dfr 
Responsible-Changed-By: ru 
Responsible-Changed-When: Mon Jun 4 03:45:23 PDT 2001 
Responsible-Changed-Why:  
Over to the author of the code. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27849 
State-Changed-From-To: open->closed 
State-Changed-By: anholt 
State-Changed-When: Fri Jan 17 20:41:52 PST 2003 
State-Changed-Why:  
Fixed in r1.14 of agp.c (in 2001). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=27849 
>Unformatted:
