problems with remap_page_range() and virt_to_phys() -- solved

From: Chris Friesen
Date: Fri Sep 10 2004 - 16:04:00 EST


Friesen, Christopher [CAR:VC21:EXCH] wrote:


The problem that I'm having is that after the call to remap_page_range, the result of

virt_to_phys(map_addr)

is not equal to "phys", and I assume it should be since its supposed to be pointing to the same physical page as "virt".

I seem to have found my problem. There were two things involved:

1) virt_to_phys() doesn't work on user addresses, so you basically have to walk the page tables. For ppc, iopa() seems to do this although there is a comment about it not working on pmac (which it seems to).

2) to setup the vma for unmapped areas I was using mmap with MAP_PRIVATE. On the first write by userspace, the mapping was changed and the user page was no longer mapped to the desired kernel page. Changing this to MAP_SHARED fixed it.

Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/