Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2011 19:57:44 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Juergen Lock <nox@jelal.kn-bremen.de>
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)
Message-ID:  <20110219175744.GH78089@deviant.kiev.zoral.com.ua>
In-Reply-To: <20110218205542.GA45210@triton8.kn-bremen.de>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110219175744.GH78089>