From owner-svn-src-all@FreeBSD.ORG Fri Apr 17 21:16:44 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6E9429E; Fri, 17 Apr 2015 21:16:44 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8045EB2; Fri, 17 Apr 2015 21:16:44 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4FA1A1FE023; Fri, 17 Apr 2015 23:16:42 +0200 (CEST) Message-ID: <5531786A.1000900@selasky.org> Date: Fri, 17 Apr 2015 23:17:30 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: John Baldwin CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r281644 - head/sys/dev/usb/video References: <201504170707.t3H777HV089365@svn.freebsd.org> <2107439.xSp98Qc672@ralph.baldwin.cx> In-Reply-To: <2107439.xSp98Qc672@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 21:16:45 -0000 On 04/17/15 14:44, John Baldwin wrote: > On Friday, April 17, 2015 07:07:07 AM Hans Petter Selasky wrote: >> Author: hselasky >> Date: Fri Apr 17 07:07:06 2015 >> New Revision: 281644 >> URL: https://svnweb.freebsd.org/changeset/base/281644 >> >> Log: >> Buffers which can be memory mapped into userspace should never be >> freed. Recycle the buffers instead. This patch also fixes a panic at >> reboot issue when an UDL adapter is attached to the system. > > You can free them safely if you don't use malloc() / free(). Instead, you > could create an OBJT_PHYS object that you wire when you map into the kernel > and export that to userland via d_mmap_single. In your driver you just > need to unmap the kernel mapping to drop the reference count on the object. > Once the userland processes exit or remove their mappings the pages would > be freed. > Hi, If you want to make a patch for UDL as a good example how to do this, please go ahead! I can test the driver is not broken afterwards. --HPS