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

[-- Attachment #1 --]
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.
> >   
> 
> The snapshot of the consolidated symbol table is made when /dev/ksyms is 
> opened.   The storage for the snapshot is allocated in the memory map of 
> 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 ?

> 
> A temporary buffer is allocated in kernel space in the read() handler 
> (ksyms_read).    Right now, for a read, it does two copies:  one from 
> user space to the temporary kernel space buffer and a second copy from 
> the kernel space temp buffer and back out to user space.   Ideally, it 
> would be nice to do just one user space to user space copy directly in 
> the kernel.
> 
> >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.
> >   
> 
> The reason the driver tries three times to create a valid snapshot is I 
> couldn't figure out a way (without creating a lock reversal) to 
> temporarily keep modules from being loaded or unloaded while the 
> snapshot is created.   I agree that it should be able to create the 
> snapshot on the first iteration in most cases.
> 
> BTW, you may have noticed the ksyms driver now uses your per-open file 
> private data code which I like much better than using clone_create() for 
> per-descriptor storage.
Does it work ? Do you have any suggestions for the KPI ?

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

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

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