From owner-freebsd-current@FreeBSD.ORG Sat May 7 19:16:32 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 590331065672; Sat, 7 May 2011 19:16:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CFBDD8FC08; Sat, 7 May 2011 19:16:31 +0000 (UTC) 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 p47JGQ3N088554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 7 May 2011 22:16:26 +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.4/8.14.4) with ESMTP id p47JGQ39004553; Sat, 7 May 2011 22:16:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p47JGQUN004552; Sat, 7 May 2011 22:16:26 +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: Sat, 7 May 2011 22:16:25 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20110507191625.GQ48734@deviant.kiev.zoral.com.ua> References: <4DC3B764.4030801@FreeBSD.org> <4DC3F9B8.3030505@FreeBSD.org> <20110506140428.GF48734@deviant.kiev.zoral.com.ua> <201105061616.41145.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HevQWRStXZ0Cpw2M" Content-Disposition: inline In-Reply-To: <201105061616.41145.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: multimedia@freebsd.org, freebsd-current@freebsd.org, current@freebsd.org, Andriy Gapon Subject: Re: dsp mmap change X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 19:16:32 -0000 --HevQWRStXZ0Cpw2M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 06, 2011 at 04:16:40PM -0400, John Baldwin wrote: > On Friday, May 06, 2011 10:04:28 am Kostik Belousov wrote: > > On Fri, May 06, 2011 at 04:38:00PM +0300, Andriy Gapon wrote: > > > on 06/05/2011 16:32 Kostik Belousov said the following: > > > > On Fri, May 06, 2011 at 11:55:00AM +0300, Andriy Gapon wrote: > > > >> > > > >> I would like to ask for a review and/or testing of the following p= atch: > > > >> http://people.freebsd.org/~avg/dev_dsp_mmap.diff > > > >> > > > >> It's supposed to fix an issue described here: > > > >> http://lists.freebsd.org/pipermail/freebsd-multimedia/2011- > February/011691.html > > > >> > > > >> In short, the following pseudo-code should do the right thing: > > > >> fd =3D open(/dev/dsp, O_RDWR); > > > >> mmap(PROT_READ, fd); > > > >> mmap(PROT_WRITE, fd); > > > >> > > > >> Thank you! > > > >=20 > > > > I think that you have to call PCM_GIANT_LEAVE() when returning > > > > EINVAL on the vm_pager_alloc() failure. > > >=20 > > > Yes, thank you. > > >=20 > > > > Your patch hardcodes an assumption that sndbufs are always > > > > contiguous. I was unable to convince myself that this is true. > > >=20 > > > I think that this should be true for the case when DMA is used? > > In the current driver, yes, but there is nothing that theoretically > > prevents scatter-gather from be used. >=20 > You could "fix" this by creating an sglist (via sglist_build()) and an > OBJT_SG VM object that the d_mmap_single callback returned. I wish there > was a cleaner way to just create a VM object and populate it with pages > though, and then use vm_map_insert() to map it into the kernel rather > than the more roundabout method of OBJT_SG. You cannot have one page inserted into two vm objects. Contigmalloc() inserts the allocated pages into kernel_object. --HevQWRStXZ0Cpw2M Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3FmokACgkQC3+MBN1Mb4iDLwCgps2E+M4fO+/UnaXayuKxu/z5 WbkAn3TzyN2mZ0VfdXxLQuCfM0ozqtbo =xWwZ -----END PGP SIGNATURE----- --HevQWRStXZ0Cpw2M--