From owner-freebsd-amd64@FreeBSD.ORG Mon Apr 13 19:29:32 2009 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FC34106566B; Mon, 13 Apr 2009 19:29:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id C24EE8FC1F; Mon, 13 Apr 2009 19:29:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LtRqQ-0009cA-GI; Mon, 13 Apr 2009 22:29:27 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n3DJTDGx096972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 13 Apr 2009 22:29:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n3DJTD2u022891; Mon, 13 Apr 2009 22:29:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n3DJTDLl022890; Mon, 13 Apr 2009 22:29:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 13 Apr 2009 22:29:13 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20090413192913.GZ3014@deviant.kiev.zoral.com.ua> References: <200904121520.n3CFK6G8032035@freefall.freebsd.org> <20090412193044.GN3014@deviant.kiev.zoral.com.ua> <200904131156.36255.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3h0UNLyY10zL13pE" Content-Disposition: inline In-Reply-To: <200904131156.36255.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LtRqQ-0009cA-GI 1b1141873901e4424a0d1be940ee3910 X-Terabit: YES Cc: Scott Long , freebsd-amd64@freebsd.org Subject: Re: amd64/133592: [busdma] [patch] busdma incorrectly calculates bounce buffer requirements for userspace buffers X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2009 19:29:32 -0000 --3h0UNLyY10zL13pE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 13, 2009 at 11:56:35AM -0400, John Baldwin wrote: > On Sunday 12 April 2009 3:30:44 pm Kostik Belousov wrote: > > On Sun, Apr 12, 2009 at 03:20:06PM +0000, Scott Long wrote: > > > The following reply was made to PR amd64/133592; it has been noted by= =20 > GNATS. > > >=20 > > > From: Scott Long > > > To: bug-followup@FreeBSD.org, jason.harmening@gmail.com > > > Cc: =20 > > > Subject: Re: amd64/133592: [busdma] [patch] busdma incorrectly calcul= ates > > > bounce buffer requirements for userspace buffers > > > Date: Sun, 12 Apr 2009 08:53:47 -0600 > > >=20 > > > You're right, it's definitely a problem. The patch looks correct, f= eel > > > free to commit to i386, amd64, and ia64. Arm needs a similar fix, b= ut > > > the code looks to be somewhat different. > >=20 > > Below is updated patch. It was compile-tested on all affected arches. > > Scott, any notes ? >=20 > I've had a similar patch in a branch for years, it should definitely go i= n. Thanks, I committed this. As discussed with Scott, the bus_dmamap_load_uio() KPI does not look as an easy to use. For uio from UIO_USERSPACE, at least, the pages backing uio chunks must be held by the caller, otherwise the pages may be repurposed at any moment. Also, please note that there is no real error check for the result of pmap_extract(). Some time ago I already looked for the KPI that would hold the pages from uio, possibly topped by some per-process or per-user limit. Also, this KPI should check that all addresses are valid. It seems that we do not have such utility. Hope to be wrong. --3h0UNLyY10zL13pE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAknjkokACgkQC3+MBN1Mb4jC1gCg349C0B4O7ov/2Cf2O3bC0W45 358AnRe2G/aKsGg5VlAdh9+5IwNhuOTu =3HJq -----END PGP SIGNATURE----- --3h0UNLyY10zL13pE--