[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] Re: Shared memory > 32mb



C. W.,

You asked about a resolution to this problem with shared memory, reported
by Volker Zahn:

> In my attemps to use shared memory between user and RT task on a 64M
> Pentium, I ran into a problem regarding the base address of the memory
> range.
> When using a base address larger than 32M I got a  segmentation fault
> like following:
> 
> Sep 17 13:21:46 picard kernel: Unable to handle kernel paging request at
> virtual address c3f00000

I had similar problems with access to shared memory causing segmentation
faults in kernel module code. Rich Bowser (bowser@luz.cs.nmt.edu) alerted
me to the source of the problem. The kernel maps memory in 4 MB pages (1 MB
on older 486 machines). If you manually set the size of physical memory for
Linux to use (e.g., append="mem=63m" on a 64 MB machine to specify 63 MB
for Linux and 1 MB shared memory for you), Linux will lay a 4 MB page to
cover this, with some left over on the last page if your memory size is not
a multiple of 4 MB. This leftover is fair game for shared memory access.
This implies a maximum size of 4 MB (minus 1 K) for shared memory.

So, if you do this on a 64 MB machine:

append="mem=31m"

and think you have 33 MB of shared memory, you really only have 1 MB.
Accesses beyond 32 MB will cause segmentation faults.

I have a note from Albert Cahalan (acahalan@saturn.cs.uml.edu) suggesting
that I use vmalloc() to get shared memory in the kernel module, and then
mmap() in the user process. Has anyone tried this?

--Fred

--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/