Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2008 12:34:02 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Stacey Son <sson@freebsd.org>
Cc:        Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-arch@freebsd.org
Subject:   Re: ksyms pseudo driver
Message-ID:  <20080715093402.GO17123@deviant.kiev.zoral.com.ua>
In-Reply-To: <487AD49F.6040304@freebsd.org>
References:  <4875A5D2.8030902@freebsd.org> <20080711155232.A96384@grasshopper.cs.duke.edu> <48780661.5050002@freebsd.org> <20080712045837.GD17123@deviant.kiev.zoral.com.ua> <487AD49F.6040304@freebsd.org>

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

--tlBB11+jzEStP2nB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jul 13, 2008 at 11:22:55PM -0500, Stacey Son wrote:
> Kostik Belousov wrote:
> >Most likely, I miss some obvious reason there. But for me it looks
> >like you do it in the reverse. The natural setup would be to require
> >userspace to supply an allocated memory to the driver, and then the
> >driver fills the memory with symbol table. This solves the problem of
> >exhaustion of kernel address space.
> >  =20
>=20
> The snapshot of the consolidated symbol table is made when /dev/ksyms is=
=20
> opened.   The storage for the snapshot is allocated in the memory map of=
=20
> the calling process.  No kernel address space is used for the snapshot.
Again, why this is done this way ? Why not creating snapshot when the
user process issues ioctl that supplies neccessary usermode memory
to the driver ?

>=20
> A temporary buffer is allocated in kernel space in the read() handler=20
> (ksyms_read).    Right now, for a read, it does two copies:  one from=20
> user space to the temporary kernel space buffer and a second copy from=20
> the kernel space temp buffer and back out to user space.   Ideally, it=20
> would be nice to do just one user space to user space copy directly in=20
> the kernel.
>=20
> >As usual, when user-supplied region is too small, driver shall return
> >both an error and new required size. It is understandable that the size
> >is volatile and may be too small for the next call too. But, in fact,
> >kernel symtable does not change too often, so I think even the one
> >iteration mostly succeed.
> >  =20
>=20
> The reason the driver tries three times to create a valid snapshot is I=
=20
> couldn't figure out a way (without creating a lock reversal) to=20
> temporarily keep modules from being loaded or unloaded while the=20
> snapshot is created.   I agree that it should be able to create the=20
> snapshot on the first iteration in most cases.
>=20
> BTW, you may have noticed the ksyms driver now uses your per-open file=20
> private data code which I like much better than using clone_create() for=
=20
> per-descriptor storage.
Does it work ? Do you have any suggestions for the KPI ?

--tlBB11+jzEStP2nB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkh8bwkACgkQC3+MBN1Mb4jKCACgk8JxGJf2CHd/JB31ouYKxw5J
7ikAoJtSodf1j2gW1I3xUqNRwA2UMLqO
=2azh
-----END PGP SIGNATURE-----

--tlBB11+jzEStP2nB--



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