Device Pager
Konstantin Belousov
kostikbel at gmail.com
Wed May 4 19:11:47 UTC 2016
On Wed, May 04, 2016 at 06:34:38PM +0530, kumara rathnavel wrote:
> Thanks for the reply.
>
> I have mapped it in kernel space. How do I invalidate the kernel vm_page. I
> have tried removing the vm_page_remove also. But I still am not getting
> it invalidated.
I do not understand what you wrote. Specifically, why do you need the
page fault handler for kernel mappings ? In fact, making that handler
work, even without any additional complications like invalidations, is
non-trivial.
For kernel, when you already know the mappings, you do not need the pager
and manageability. In fact, you do not want page faults there at all.
Just use e.g. pmap_qenter() and pmap_qremove(), for a fictious page you
created.
> 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