public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ioremap vs remap_pfn_range, VMSPLIT, etc
@ 2015-01-09 12:59 Mason
  2015-01-09 13:13 ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Mason @ 2015-01-09 12:59 UTC (permalink / raw)
  To: Linux ARM; +Cc: LKML

Hello everyone,

Yesterday, I used /dev/mem to mmap 2 GB and (to my surprise) it worked.
Specifically, I opened /dev/mem O_RDWR | O_SYNC
then called
  mmap(NULL, 1U<<31, PROT_WRITE, MAP_SHARED, fd, 0x80000000);

And mmap returned a valid pointer.

I was expecting it to fail.

- the kernel is configured with VMSPLIT_3G (3G/1G user/kernel)
- the kernel manages 256 MB RAM
- there is roughly 750 MB of VMALLOC space, no highmem

I know /dev/mem's mmap calls remap_pfn_range, but I was expecting
the VMALLOC space to impose a limit on the size of the mapping.
Obviously this was incorrect?

If I requested the same mapping *within the kernel* using ioremap,
would that fail because of limited VMALLOC space?

Moving to arch-specific questions (namely ARM Cortex-A9).
If I understand correctly (which is very possibly NOT the case)
the CPU has two registers pointing to page tables, one for
the current process, one for the kernel. And the CPU automatically
picks the correct one, based on the active context?
It would seem possible to have a full 4G for process, and a full 4G
for the kernel, using that method, no? (Like Ingo's old 4G/4G split).
Without the performance overhead of fiddling with the page tables.
What am I missing?

Regards.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-09 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09 12:59 ioremap vs remap_pfn_range, VMSPLIT, etc Mason
2015-01-09 13:13 ` Russell King - ARM Linux
2015-01-09 17:46   ` Mason
2015-01-09 18:06     ` Vladimir Murzin
2015-01-09 18:42       ` Mason
2015-01-09 19:05     ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox