From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4FE17CD4.2060108@grandegger.com> Date: Wed, 20 Jun 2012 09:33:40 +0200 From: Wolfgang Grandegger MIME-Version: 1.0 References: <4FE03797.7000408@grandegger.com> <4FE03955.60108@xenomai.org> <4FE03D17.3040408@grandegger.com> <4FE03D5D.7050806@xenomai.org> <4FE03DE4.5050301@grandegger.com> <4FE040A1.80400@xenomai.org> <4FE04695.4020609@grandegger.com> <4FE04880.7060009@xenomai.org> In-Reply-To: <4FE04880.7060009@xenomai.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gilles Chanteperdrix Cc: Xenomai@xenomai.org On 06/19/2012 11:38 AM, Gilles Chanteperdrix wrote: > On 06/19/2012 11:29 AM, Wolfgang Grandegger wrote: >> On 06/19/2012 11:04 AM, Gilles Chanteperdrix wrote: >>> On 06/19/2012 10:52 AM, Wolfgang Grandegger wrote: >>>> On 06/19/2012 10:50 AM, Gilles Chanteperdrix wrote: >>>>> On 06/19/2012 10:49 AM, Wolfgang Grandegger wrote: >>>>>> On 06/19/2012 10:33 AM, Gilles Chanteperdrix wrote: >>>>>>> On 06/19/2012 10:25 AM, Wolfgang Grandegger wrote: >>>>>>>> Hello, >>>>>>>> >>>>>>>> the shared memory support of Xenomai's POSIX skin currently only support >>>>>>>> shared memory between rt processes. >>>>>>> >>>>>>> These services are for sharing memory between user-space and >>>>>>> kernel-space. In order to share memory between user-space processes, you >>>>>>> can use plain linux shared memories. >>>>>> >>>>>> But then I will get mode switches due to page faults, right? >>>>> >>>>> No, there should not be any page fault. >>>> >>>> But that's what we observe on a i.MX53 and i.MX6Q board. IIRC, the first >>>> access usually results in a page fault. >>> >>> And you do not get the same behaviour with posix skin shared memories ? >> >> Right, and that's because do_pagefault() is called somewhere in the >> initialization, IIRC. But I will redo my tests now. > > Yes, I forgot about that, we pre-fault shared memory on ARM, in order to > avoid the page fault on first access. > >> >> Anyway, if I use the POSIX skin the shared memory functions in there >> will be used automatically. But I could use __real_shm_open and >> __real_mmap, right? > > Or you can used the wrapped version, but without enabling support for > xenomai posix shared memories in the kernel configuration. > > > ... and access the page once per page in the >> initialization phase. Then no more page faults should happen. > > Yes. It is a bit ugly, but should work. I forgot. The problem was not the read but the first write to a page triggering the page fault. Therefore it would make sense to wrap just mmap and doing the pre-faulting if XENO_OPT_POSIX_SHM is not set. Wolfgang.