Hey Chetan, Exactly.You are absolutely correct! But I thought that as the conversion is platform specific & in most cases, we can do away with page tables in the identity mapped segment if it is as simple as adding an offset, which is a kind of a performance hack. We can look at the arch specific __pa(..) and __va(..) implementation in the kernel to have a better idea.
For example, if we look at arch specific IA64 code, __pa and __va are defined as follows : FILE : arch/IA64/include/asm/page.h . #ifdef __ASSEMBLY__ <http://lxr.linux.no/linux+*/+code=__ASSEMBLY__> <http://lxr.linux.no/linux+*/arch/ia64/include/asm/page.h#L59># define __pa <http://lxr.linux.no/linux+*/+code=__pa>(x <http://lxr.linux.no/linux+*/+code=x>) ((x <http://lxr.linux.no/linux+*/+code=x>) - PAGE_OFFSET <http://lxr.linux.no/linux+*/+code=PAGE_OFFSET>) <http://lxr.linux.no/linux+*/arch/ia64/include/asm/page.h#L60># define __va <http://lxr.linux.no/linux+*/+code=__va>(x <http://lxr.linux.no/linux+*/+code=x>) ((x <http://lxr.linux.no/linux+*/+code=x>) + PAGE_OFFSET <http://lxr.linux.no/linux+*/+code=PAGE_OFFSET>) <http://lxr.linux.no/linux+*/arch/ia64/include/asm/page.h#L61>#else /* !__ASSEMBLY */ So, in this case no page tables were used. This is what i meant. On Tue, Apr 6, 2010 at 11:48 PM, Chetan Nanda <[email protected]> wrote: > > > On Wed, Apr 7, 2010 at 11:50 AM, Venkatram Tummala <[email protected] > > wrote: > >> Can you please explain the last statement. My understanding was - the >> exact conversion formula of virtual address to physical address in identity >> mapped segment is platform specific and in most cases, this is as simple as >> the addition of an offset. So we can do away with page tables to access >> memory mapped in identity mapped segment. >> > > Hi Venkat, > > That is what I was trying to point out. even the address that are generated > by kernel are virtual address and they still goes through page table for > mapping to actual physical address. > And this is done by MMU (via page table), so MMU must be configured to do > the same. > > ~cnanda > > Am i missing something? >> >> Regards, >> Venkatram Tummala >> >> >> On Tue, Apr 6, 2010 at 11:04 PM, H. Peter Anvin <[email protected]> wrote: >> >>> On 04/06/2010 10:57 PM, Venkatram Tummala wrote: >>> > Just a note Chetan. >>> > >>> > We can't exactly say that we require "page table settings" to map that >>> > 896 MB of physical ram. It is an identity mapped segment (1-1 mapping). >>> > So, we dont require the "page tables". Virtual address will be equal >>> to >>> > Physical Address + Page Offset. It is just an addition of offset >>> > >>> >>> No, we still need page tables for the identity-mapped segment. >>> >>> -hpa >>> >>> -- >>> H. Peter Anvin, Intel Open Source Technology Center >>> I work for Intel. I don't speak on their behalf. >>> >>> >> >
