Yes 'pfn << PAGE_SHIFT' gives physical-base-address although its
better to use page_to_phys macro
>
> 2. Does the kernel generate PFN serailly from 0 to TOTAL_PHYS or are there
> breaks in between?
>
Yes serially for x86 from 0UL but might contain some starting offset
according to some architectures. Take a look at page_to_phys macro
(http://lxr.free-electrons.com/source/include/asm-i386/io.h#101) and
__page_to_pfn macro
(http://lxr.free-electrons.com/source/include/asm-generic/memory_model.h#032)
--
Fawad Lateef
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
On 11/15/06, Bithika Khargharia <bit...@gmail.com> wrote:
> Hi,
>
> 1. Given the PFN, how do I obtain the base physical address for the PFN.
>
> I use
> 'pfn <<12'.
>
> Is this correct?
Yes 'pfn << PAGE_SHIFT' gives physical-base-address although its
better to use page_to_phys macro
>
> 2. Does the kernel generate PFN serailly from 0 to TOTAL_PHYS or are there
> breaks in between?
>
Yes serially for x86 from 0UL but might contain some starting offset
according to some architectures. Take a look at page_to_phys macro
__page_to_pfn macro
(http://lxr.free-electrons.com/source/include/asm-generic/memory_model.h#032 )
--
Fawad Lateef
Yes, Right. In kernel/protected_mode the memory is referenced/accessed
through pages not from physical addresses and pages have pfn which is
directly associated with physical address by PAGE_SHIFT bits
> 2. What confuses me is the following. I know that I have 8 GB of memory
> physically installed on my System. 8 GB should translate to a PFN of 2097152
> (8 * 2^30)/4 where 4KB is the PAGE_SIZE in my system. However the kernel
> gives a TOTAL_PHYS value of 2411724 which is almost equal to 9.2 GB of
> memory. If PFNs are generated serially why do I have this problem of higher
> PFNs that 8 GB?
>
The PFNs AFAIK must be 2097152 for 8GB RAM, have you tried to do
read/kmap physical-memory representing by PFN greater-than 2097152 ?
TOTAL_PHYS is the term you are referring for total-physical-memory or
its used in the kernel too ? as I not able to find-out that TOTAL_PHYS
in kernel sources. AFAIR max_mapnr variable (if CONFIG_DISCONTIGMEM
isn't defined) can tell maximum number of pages (of physical-memory)
available in system/kernel which actually calculated during memory
initialization at boot-time.
If still not able to get things correctly then please provide you
kernel version number and config file.
Your complete system information to know will be good for better
understanding of your ptoblem. Means output of 'uname -a' and
processor/motherboard model.
I can't say exactly what is happening on your side, might be some
in-compatiblity of your motherboard (bios) with Linux Kernel. But the
thing which you can see is: point 8. Total usable pfns = 2070237 =
~8GB memory, so might possible your bios is telling IO-Devices mapped
region as some more memory available (but I am not sure about this).
Have you tried to read/write/kmap on pages whose pfns are giving
physical address after 8GB ? Is it working ? and what memory size 'cat
/proc/meminfo' is mentioning ?
Its better is you also do CC to kernelnewbies, so that some other
person might give you some better idea too. And please don't do
top-posting, rather do bottom-posting (search google for it) on
mailing-list while replying.
Yes, this might be the case. Try google for your possible bios related issues.
> > Have you tried to read/write/kmap on pages whose pfns are giving
> > physical address after 8GB ? Is it working ? and what memory size 'cat
> > /proc/meminfo' is mentioning ?
>
> No I have not. I will try that and let you know what happens. cat
> /proc/meminfo actually gives MemTotal: 8280948 kB !!
>
This means Linux/Kernel actually knows ~8GB memory so will use only
8GB, now as I said might be your memory mapped IO devices is also
counted in your total_pfns. Someone might give more/correct details
> > Its better is you also do CC to kernelnewbies, so that some other
> > person might give you some better idea too. And please don't do
> > top-posting, rather do bottom-posting (search google for it) on
> > mailing-list while replying.
>
> Thanks Fawad or introducing me to the lists' netiquettes
>
No problem :)