LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2010, 02:09 AM   #1
kumart
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
Question Mapping Kernel virtual address space to Physical memory zones (ZONE_DMA, ZONE_NORMAL)


As i undertsand - out of 1GB of the virtual Address space for Kernel from 3GB to 4GB of the process address space,

Kernel image (code, data, bss, stack, heap) resides staring @0x0 address. Vmalloc area starts either at the end of Physical ram size or at 896M. This 896M cap is mandated to ensure that minimum of 128MB is reserved as vmalloc_reserve for vmalloc,kmap etc.

Is the understanding correct?

Now trying to map Physical Zones into this 1GB address space

Initial 16MB is mapped to ZONE_DMA
16MB - 896MB is mapped to ZONE_NORMAL
896MB - 1024MB is mapped to ZONE_HIGHMEM

Does this mean that Kernel image is residing in ZONE_DMA area?
Any call to vmalloc() in kernel code will return address beyond 896M?
insmod of any LKM will internally invoke vmalloc() to obtain contiguous area - where will this code physically located along with rest of kernel code in ZONE_DMA or in ZONE_HIGHMEM?

Thanks.
 
Old 11-04-2010, 02:38 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
So what makes you feel a "virtual address" is any less real than a "physical address"? Or that a virtual address's physical addresses won't change as the system runs?

Remember - even though the OS *manages* physical::logical address mapping, it's essentially a *hardware* operation.

This is a good link:

http://lwn.net/images/pdf/LDD3/ch15.pdf

PS:
No: "the kernel" does NOT "reside" in ZONE_DMA. The kernel manages ZONE_DMA (as discussed in the above link).

No: vmalloc() returns a VIRTUAL address. It may or may not be mapped to a physical address. And, in fact, it's entirely possible that the region allocated may NEVER actually be mapped to an actual physical address!

No: a logically contiguous area (consisting of N pages) may or may not map to physically contiguous area. Except possibly in the case of DMA buffers. Again: refer to the above link.

You might also find this article useful:

2.6 Kernel memory allocation: Robert Love

'Hope that helps!

Last edited by paulsm4; 11-04-2010 at 02:46 AM.
 
Old 04-03-2012, 10:11 AM   #3
firo
LQ Newbie
 
Registered: Mar 2012
Location: Dalian, China
Distribution: Ubuntu
Posts: 1

Rep: Reputation: Disabled
I meet this confusions when I read linux book Professional Linux Kernel Architecture.

I use Ubuntu 12.04, kernel version is 3.2.

firo@snow:~/linux$ dmesg | grep -e ".init " -A 2
[ 0.000000] .init : 0xc1833000 - 0xc18e5000 ( 712 kB)
[ 0.000000] .data : 0xc157e844 - 0xc1832180 (2766 kB)
[ 0.000000] .text : 0xc1000000 - 0xc157e844 (5626 kB)
These output of my computer show that:
.text is start at 0xc1000000,the actual physical address is 0x01000000 (16Mb).

these link mybe useful:
http://forum.kernelnewbies.org/read.php?13,2193,2193
http://lists.gnu.org/archive/html/gr.../msg00251.html

Last edited by firo; 04-03-2012 at 10:15 AM. Reason: add one web link
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
virtual memory address to physical address _Linux_Learner Linux - Newbie 1 04-14-2010 02:34 AM
virtual address to physical memory access pupillo Linux - General 2 02-22-2010 11:07 AM
Find virtual to physical address mapping in Kernel? bkankru Linux - Kernel 2 11-09-2009 03:15 PM
API for mapping Physical Address to Virtual Address Lakshman_smt Linux - Software 2 10-15-2006 10:08 PM
Memory Mapping (same physical address = virtual address) skd.tech Linux - Kernel 7 07-25-2006 12:13 AM


All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration