Problem in getting shared memory access on P1022RDK

Arshad, Farrukh Farrukh_Arshad at mentor.com
Thu Jan 12 02:52:12 EST 2012


Adding more it, 

I have removed the shared memory kernel driver dependency just to narrow down the problem area and I have written a small piece of code in user space. A writer & a reader application which access the shared memory and I got the same behavior as with the shared memory kernel driver. Interestingly, my user space application work fine on P1022DS but not on P1022RDK however both using the same CPU modules.

When I write a simple string on shared memory from Core 1 it is read at Core 0 properly
When I write a simple string on shared memory from Core 0 it is not read at Core 1. 

With this test now I am sure the problem lies in the kernel itself. Any pointers to look for the troubled area ?

My application code is (error checking and other code is omitted)

#define 	SHM_BASE 	0x1C000000
#define	SHM_SIZE 	0x400000		// 4 MB of Shared Memory
#define 	PAGE_SIZE 	(4*1024)

fd = open(device, O_RDWR);

shm = malloc(SHM_SIZE + (PAGE_SIZE - 1));
if ( (unsigned long) shm % PAGE_SIZE) {
	shm += PAGE_SIZE - ((unsigned long)shm % PAGE_SIZE);
}

shm = mmap(shm, SHM_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, SHM_BASE);
......
...... write some string at shm.

My memory partitioning for both systems is 

Core                 		Base Address         	Size
Core 0               		0x0000,0000          	0x1000,0000
Core 1               		0x1000,0000          	0x0C00,0000
Shared Memory    	0x1C00,0000          	0x0400,0000

Regards,
Farrukh Arshad.
Mentor Graphics Pakistan


More information about the Linuxppc-dev mailing list