Device Pager

Konstantin Belousov kostikbel at gmail.com
Wed May 4 11:23:01 UTC 2016


On Wed, May 04, 2016 at 07:51:55AM +0530, kumara rathnavel wrote:
> Hello All,
> 
> I have written a character device pager. I have associated an object with
> my device and I have mapped it to the kernel and I also have a virtual
> address for it. So whenever the address is accessed first time I get a page
> fault and i give the physical address to be associated in the fault
> routine. Now how do I again get a page fault for the same virtual address.
> I need to change the physical address periodically for a virtual address.

This cannot be done with the device_pager, i.e. OBJT_DEVICE.  VM system
does not track mappings of the page into userspace processes, so it
cannot invalidate existing mappings.

What can be used for this purpose is OBJT_MGTDEVICE, which operates on
managed fictitious pages.  Such pages do track userspace mappings with
the usual PV-lists mechanisms, so pmap_remove_all() works.  This kind
of pager is used by GEM and TTM.

There is not much useful documentation about OBJT_MGTDEVICE, read the source
to see how it is plumbed.


More information about the freebsd-drivers mailing list