Re: remap_pte_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- "Raghu R. Arur" <rra2002@aria.ncl.cs.columbia.edu>
wrote:

> > Not exactly. It does set the pte in some cases:
> >
> > >	page = virt_to_page(__va(phys_addr));
> > > 	if ((!VALID_PAGE(page)) || PageReserved(page))
> > >  		set_pte(pte, mk_pte_phys(phys_addr, prot));
> >                
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> 
> Yes i see that it is setting the pte. But it is setting
> it only if the page is reserved or if the page is not 
> valid. It is setting the pte entry which it had cleared 
> it before. 

Are you saying the old and new entries are same? They
are not. 

> So it is clearing the pte of those pages which 
> are not reserved and which are valid.

No. PTEs for all addresses in the range are cleared.

remap_page_range() is mostly called from mmap routines of
drivers. The virtual to physical mapping may or may not
be known at the time of mmap. If the mapping is known, the
physical pages will be reserved and the PTE can be set.
If the mapping is not known, then the PTE should be set
to zero (or some other invalid value) so that accessing
the address will cause a page fault. Instead, if the page
is valid but not reserved, the PTE should not be set.
There is no guarantee that the page will not be reused.
Ideally, drivers calling remap_page_range should not pass
such a page as parameter.


Hope this helps,
Ravi.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux