KMAP Physical Page to Kernel Virtual Address: unable to handle kernel paging request
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
KMAP Physical Page to Kernel Virtual Address: unable to handle kernel paging request
Hello everyone,
I have seemed to come across some strange behavior and was hoping to either get a solution or explanation for what I am seeing.
Using kernel 2.6.31.6, I compiled two slightly different 32-bit builds. One build is PAE enabled, one is not. This is the only difference between the two. On my PAE enabled build I can map a physical frame number to a kernel virtual address by using: page = pfn_to_page(phypageaddr); va = kmap(page); Using "va" I can read the contents successfully. However, if I try the same for the non-PAE build I get an error: "unable to handle kernel paging request." The PDE = 00000000.
The memory I am accessing is mapped just below the 2 gb boundary and this is marked as BIOS reserved in the bios memory map. I can successfully map lower memory (e.g. 0xe0000) which is also BIOS reserved without an issue.
At this point I am very stumped on the issue I am having given such a minimal change. I don't believe PAE should effect such a request.
Any help, insight, or direction for solving such a problem would be greatly appreciated. Or suggest a better way to map a physical address area to virtual memory.
thanks for the suggestion. unfortunately, it looks like remap_pfn_range is used to map kernel physical memory to userspace. The virtual address returned I believe isn't a kernel virtual address. I simply want to read physical memory in a kernel module, not from userspace.
If you believe I can still use remap_pfn_range, how are you suggest populating the vma struct which contains mm_struct which I believe is not available to a kernel module.
Thanks nini09 for the suggestion. Have indeed walked through function. The problem is that page_address is returning a valid va when the page table entry is not mapped.
Either way it seems like a bug. I am doing something very straight forward and the paging request can't be handled. All I want to do is map some physical memory to a virtual KERNEL address. Using existing kernel memory functions fail. This only happens for higher range memory locations (above 0x7FB00000).
I gave up on the issue and decided to stick with PAE.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.