All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: "Arshad, Farrukh" <Farrukh_Arshad@mentor.com>
Cc: Scott Wood <scottwood@freescale.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: Problem in getting shared memory access on P1022RDK
Date: Thu, 12 Jan 2012 16:09:29 +0800	[thread overview]
Message-ID: <4F0E9539.7090205@windriver.com> (raw)
In-Reply-To: <93CD5F41FDBC6042A6B449764F3B35CC050CD375@EU-MBX-03.mgc.mentorg.com>

Arshad, Farrukh wrote:
> 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. 
>

Did you dump TLB entry to check page memory coherence attribute for a shared
memory as I mentioned previously? This should be consistent on both sides.

> 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);

You may need to add with 'O_SYNC'.

Tiejun

> 
> 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

  reply	other threads:[~2012-01-12  8:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 19:10 Problem in getting shared memory access on P1022RDK Arshad, Farrukh
2012-01-03  9:42 ` Arshad, Farrukh
2012-01-03 17:10   ` Scott Wood
2012-01-04  6:49     ` Arshad, Farrukh
2012-01-05  2:09       ` tiejun.chen
2012-01-05  5:46         ` Arshad, Farrukh
2012-01-11 15:52         ` Arshad, Farrukh
2012-01-12  8:09           ` tiejun.chen [this message]
2012-01-25 11:04             ` Arshad, Farrukh
2012-01-29  3:15               ` tiejun.chen
2012-01-04  9:56     ` Arshad, Farrukh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F0E9539.7090205@windriver.com \
    --to=tiejun.chen@windriver.com \
    --cc=Farrukh_Arshad@mentor.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.