From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 17:57:49 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B99E106566B; Sat, 19 Feb 2011 17:57:49 +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 D6BA58FC0A; Sat, 19 Feb 2011 17:57:48 +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 p1JHviLp062100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Feb 2011 19:57:44 +0200 (EET) (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 p1JHviAT028572; Sat, 19 Feb 2011 19:57:44 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1JHvi10028571; Sat, 19 Feb 2011 19:57:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 19 Feb 2011 19:57:44 +0200 From: Kostik Belousov To: Juergen Lock Message-ID: <20110219175744.GH78089@deviant.kiev.zoral.com.ua> References: <20110129201000.GA10774@triton8.kn-bremen.de> <20110129205105.GI2518@deviant.kiev.zoral.com.ua> <20110129235448.GA15788@triton8.kn-bremen.de> <20110218205542.GA45210@triton8.kn-bremen.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EUpy5YnDgVCdz9yy" Content-Disposition: inline In-Reply-To: <20110218205542.GA45210@triton8.kn-bremen.de> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, 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: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org Subject: Re: Can vm_mmap()/vm_map_remove() be called with giant held? (linuxolator dvb patches) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 17:57:49 -0000 --EUpy5YnDgVCdz9yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 18, 2011 at 09:55:42PM +0100, Juergen Lock wrote: > I have finally got back to this and did the style and vm_map_remove() > return value handling fixes, updated the patches in-place: >=20 > http://people.freebsd.org/~nox/dvb/linux-dvb.patch >=20 > (for head) >=20 > http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch >=20 > (for 8.) >=20 > On Sun, Jan 30, 2011 at 12:54:48AM +0100, Juergen Lock wrote: > > On Sat, Jan 29, 2011 at 10:51:05PM +0200, Kostik Belousov wrote: > > > On Sat, Jan 29, 2011 at 09:10:00PM +0100, Juergen Lock wrote: > > > > Hi! > > > >=20 > > > > I was kinda hoping to be able to post a correct patch in public but > > > > getting an answer to ${Subject} seems to be more difficult than I > > > > thought... :) So, does anyone here know? copyout_map() and > > > You do not need Giant locked for vm_map* functions. > > >=20 > > The question was more do I need to drop it first before calling them... > >=20 > > > > copyout_unmap() are copied from ksyms_map() from sys/dev/ksyms/ksym= s.c > > > > - should there maybe be global versions instead of two static copies > > > > each, and what would be good names? And giant is taken by linux_io= ctl() > > > Would you make a patch for this ? > > >=20 > > Heh if you want me to... Where should they go and are my name choices= ok? > >=20 > I haven't done this yet so people can keep patching linux.ko in-place > without having to build a new kernel too... Separate build of linux.ko is not quite supported action. I would greatly prefer to have the move of these two functions before the rest of the patch comes in. Together with conversion of other users. I propose to put it into vm/vm_glue.c. >=20 > > > > in the same source file before calling the parts I added. So here > > > > comes the patch, it is to add support for dvb ioctls to the linuxol= ator > > > > as discussed on -emulation earlier in this thread: > > > >=20 > > > > http://lists.freebsd.org/pipermail/freebsd-multimedia/2011-January= /011575.html > > > >=20 > > > > (patch also at: > > > >=20 > > > > http://people.freebsd.org/~nox/dvb/linux-dvb.patch > > > >=20 > > > > and a version for 8, which is what I tested with w_scan on dvb-s2 > > > > and dvb-t, and Andrew Gallatin also tested it with SageTV: > > > >=20 > > > > http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch > > > >=20 > > > > ) > > > >=20 >=20 > > > > + /* > > > > + * Map somewhere after heap in process memory. > > > > + */ > > > > + PROC_LOCK(td->td_proc); > > > > + *addr =3D round_page((vm_offset_t)vms->vm_daddr + > > > > + lim_max(td->td_proc, RLIMIT_DATA)); > > > > + PROC_UNLOCK(td->td_proc); > > > Are you sure that this is needed ? Why not leave the address selection > > > to the VM ? > > >=20 > > I don't know, maybe sys/dev/ksyms/ksyms.c has a reason? >=20 > How would I leave the address selection to the VM? Just trying > to initialize *addr to (vm_offset_t)NULL there caused the patch to > stop working. I believe you should do *addr =3D 0; vm_mmap(map, addr); --EUpy5YnDgVCdz9yy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1gBJgACgkQC3+MBN1Mb4g3WgCg5pyzNe1TeXXxZeYx4p5+xgDH UQgAoIYBzrFWs/OufIfUq1jD2SWILgD6 =U3c4 -----END PGP SIGNATURE----- --EUpy5YnDgVCdz9yy--