Hi,
I downloaded version 0.7.4, made 3 changes to get the code to
compile under vanila linux 2.4.20 (Red hat 9 package). The remap_page_range function needed vma pointer as an extra first argument, pte_offset macro function needed to be expanded in 2 places. The compilation went fine. The tester program seemed to work as mentioned in the README file. However, I tried using demo program and also created 2 versions of the demo of my own. The 2 new ones just do mbuff_alloc. One writes to the mmapped shm area and the other reads from the same I don't see my reads or writes working from the user process side. I added an additional kernel module which does mbuf_allocate and writes to the shmem. Another kernel module could read the shm contents and it works. The only problem was in the user space usage. mmap seems to work and returns a valid VMA space address, but writing and reading are not working.
One thing that perplexes me in the strace output is that munmap is getting automatically invoked by the kernel immediately after the mmap call from the demo program. Please let me know how I should proceed about fixing the problem.
Thanks,
Siva.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fixed the problem in 2.4.20 by porting kvmem.h inline functions (kvirt_to_pa, rvmalloc, rvfree, etc.) to reflect equivalent changes in bttv-driver [ a la bttv-driver.c ]. It works fine now...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I downloaded version 0.7.4, made 3 changes to get the code to
compile under vanila linux 2.4.20 (Red hat 9 package). The remap_page_range function needed vma pointer as an extra first argument, pte_offset macro function needed to be expanded in 2 places. The compilation went fine. The tester program seemed to work as mentioned in the README file. However, I tried using demo program and also created 2 versions of the demo of my own. The 2 new ones just do mbuff_alloc. One writes to the mmapped shm area and the other reads from the same I don't see my reads or writes working from the user process side. I added an additional kernel module which does mbuf_allocate and writes to the shmem. Another kernel module could read the shm contents and it works. The only problem was in the user space usage. mmap seems to work and returns a valid VMA space address, but writing and reading are not working.
I am attaching strace output also:
23:33:03.611721 execve("./d1", ["./d1"], [/* 34 vars */]) = 0
23:33:03.612080 uname({sys="Linux", node="localhost.localdomain", ...}) = 0
23:33:03.612231 brk(0) = 0x8049ba0
23:33:03.612317 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40016000
23:33:03.612407 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
23:33:03.612518 open("/etc/ld.so.cache", O_RDONLY) = 3
23:33:03.612579 fstat64(3, {st_mode=S_IFREG|0644, st_size=115094, ...}) = 0
23:33:03.612686 old_mmap(NULL, 115094, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
23:33:03.612753 close(3) = 0
23:33:03.612827 open("/lib/tls/libc.so.6", O_RDONLY) = 3
23:33:03.612891 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`V\1B4\0"..., 512) = 512
23:33:03.612997 fstat64(3, {st_mode=S_IFREG|0755, st_size=1531064, ...}) = 0
23:33:03.613080 old_mmap(0x42000000, 1257224, PROT_READ|PROT_EXEC, MAP_PRIVATE,
3, 0) = 0x42000000
23:33:03.613150 old_mmap(0x4212e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12e000) = 0x4212e000
23:33:03.613246 old_mmap(0x42131000, 7944, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x42131000
23:33:03.613318 close(3) = 0
<bold>
23:33:03.613664 set_thread_area({entry_number:-1 -> 6, base_addr:0x400169e0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
23:33:03.613748 munmap(0x40017000, 115094) = 0
</bold>
23:33:03.613845 open("/dev/mbuff", O_RDWR) = 3
23:33:03.614169 ioctl(3, FIBMAP, 0xbfffdeb0) = 12288
23:33:03.614425 mmap2(NULL, 12288, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1
ENOMEM (Cannot allocate memory)
23:33:03.614590 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
23:33:03.614676 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
23:33:03.614743 write(1, "mbuff_alloc failed\n", 19) = 19
23:33:03.681327 munmap(0x40017000, 4096) = 0
23:33:03.681426 exit_group(3) = ?
One thing that perplexes me in the strace output is that munmap is getting automatically invoked by the kernel immediately after the mmap call from the demo program. Please let me know how I should proceed about fixing the problem.
Thanks,
Siva.
Fixed the problem in 2.4.20 by porting kvmem.h inline functions (kvirt_to_pa, rvmalloc, rvfree, etc.) to reflect equivalent changes in bttv-driver [ a la bttv-driver.c ]. It works fine now...