linux - mmap messing up - causing kernel to hang -
i building application embedded board using microblaze processor. have linux cross-compiled this. board has 512 mb of memory kernel knows 256 mb of (the lower half of ddr3).
this memory map of system:
0x4000_0000 0x5fff_ffff -> physical range of ddr3 (verified cat /proc/meminfo) 0x4000_0000 0x4fff_ffff -> known linux , used kernel 0x5000_0000 0x5fff_ffff -> mmaped using "/dev/mem" application i have have direct access region in ddr, 2nd half of ddr. wrote application mmap's physical memory this:
typedef struct { int fd; // file descriptor unsigned long *hw_addr; // hardware base address unsigned long *vaddr; // virtual address pointer unsigned long memsize; // size of physical region off_t page_offset; off_t page_address; off_t page_size; } mem_region_t ; mem->vaddr = (unsigned long *) mmap(0, mem->memsize, prot_read|prot_write, map_shared, mem->fd, mem->page_address); to test working, doing simple memory test (memtest) on requested region.
here of problems noticing:
i can allocate amount of memory , mmap it, no problems. when use small region 0x100 bytes memtest, test runs successfully.
when allocate larger regions (0x1000, 0x1_0000, etc), kernel not segfault, hangs !! behavior normal ?
can suggest ways work around problem ? mmap'ing correctly.
my suspicion smaller page of memory works , more screws badly. need enable feature in kernel ?
thanks attention. let me know if need more info.
rrs
ok... solved problem.
i saw kernel didnt have enough pages work. created no-go zone using "memmap" (see kernel parameters). allowed me use mmap mentioned above.
it seems work large allocation of contiguous physical memory.
Comments
Post a Comment