linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <ttabi@interactivesi.com>
To: Linux MM mailing list <linux-mm@kvack.org>,
	Linux Kernel Mailing list <linux-kernel@vger.rutgers.edu>
Subject: phys-to-virt kernel mapping and ioremap()
Date: Thu, 20 Jul 2000 13:06:21 -0500	[thread overview]
Message-ID: <20000720182643Z131167-4584+4@kanga.kvack.org> (raw)

I'm studying the code for __ioremap and I'm confused by something.

The phys_to_virt and virt_to_phys macros are very simple.  Basically, in kernel
space, the virtual address is an offset of the physical address, so it's very
simple.

__ioremap is supposed to take high PCI memory and map it to kernel space. 
However, __ioremap() calls get_vm_area() which then calls kmalloc(), which
allocates some memory from the heap.  Then remap_area_pages() is called, and
that uses the three-level page tables to map the memory allocated by kmalloc to
the PCI memory.

And that's where I'm confused.  Particularly:

1) Doesn't this mapping break the phys_to_virt and virt_to_phys macros?

2) kmalloc takes real physical memory from the kernel heap.  But then the
virtual addresses are remapped to other physical memory.  What happens to the
physical memory that kmalloc allocated?  Why isn't it freed?	


--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

             reply	other threads:[~2000-07-20 18:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-20 18:06 Timur Tabi [this message]
2000-07-21 13:49 ` Jeff Garzik
     [not found] <20000720174852Z156962-31297+1037@vger.rutgers.edu>
2000-07-20 18:41 ` Jes Sorensen
2000-07-20 18:53   ` Timur Tabi
     [not found] ` <20000720183534Z156966-31297+1096@vger.rutgers.edu>
2000-07-20 19:06   ` Jes Sorensen
2000-07-20 19:12   ` Ivan Passos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000720182643Z131167-4584+4@kanga.kvack.org \
    --to=ttabi@interactivesi.com \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox