All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Sharing memory between rt-posix and standard-posix apps
@ 2012-06-19  8:25 Wolfgang Grandegger
  2012-06-19  8:33 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2012-06-19  8:25 UTC (permalink / raw)
  To: Xenomai

Hello,

the shared memory support of Xenomai's POSIX skin currently only support
shared memory between rt processes. I mean, all apps must be linked
against Xenomai's POSIX library. Shared memory created by apps linked
against the standard POSIX library will not be found. Is/was there a
good reason for that limitation?

Wolfgang.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  8:25 [Xenomai] Sharing memory between rt-posix and standard-posix apps Wolfgang Grandegger
@ 2012-06-19  8:33 ` Gilles Chanteperdrix
  2012-06-19  8:49   ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-19  8:33 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Xenomai

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.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  8:33 ` Gilles Chanteperdrix
@ 2012-06-19  8:49   ` Wolfgang Grandegger
  2012-06-19  8:50     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2012-06-19  8:49 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai

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?

Wolfgang.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  8:49   ` Wolfgang Grandegger
@ 2012-06-19  8:50     ` Gilles Chanteperdrix
  2012-06-19  8:52       ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-19  8:50 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Xenomai

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.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  8:50     ` Gilles Chanteperdrix
@ 2012-06-19  8:52       ` Wolfgang Grandegger
  2012-06-19  9:04         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2012-06-19  8:52 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai

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.

Wolfgang.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  8:52       ` Wolfgang Grandegger
@ 2012-06-19  9:04         ` Gilles Chanteperdrix
  2012-06-19  9:29           ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-19  9:04 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Xenomai

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 ?

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  9:04         ` Gilles Chanteperdrix
@ 2012-06-19  9:29           ` Wolfgang Grandegger
  2012-06-19  9:38             ` Gilles Chanteperdrix
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2012-06-19  9:29 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai

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.

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? ... and access the page once per page in the
initialization phase. Then no more page faults should happen.

Wolfgang.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  9:29           ` Wolfgang Grandegger
@ 2012-06-19  9:38             ` Gilles Chanteperdrix
  2012-06-20  7:33               ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-19  9:38 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Xenomai

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.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-19  9:38             ` Gilles Chanteperdrix
@ 2012-06-20  7:33               ` Wolfgang Grandegger
  2012-06-20  9:18                 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2012-06-20  7:33 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai

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.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Xenomai] Sharing memory between rt-posix and standard-posix apps
  2012-06-20  7:33               ` Wolfgang Grandegger
@ 2012-06-20  9:18                 ` Gilles Chanteperdrix
  0 siblings, 0 replies; 10+ messages in thread
From: Gilles Chanteperdrix @ 2012-06-20  9:18 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Xenomai

On 06/20/2012 09:33 AM, Wolfgang Grandegger wrote:
> 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.

Yes, when we prefault in kernel-space, we prefault write faults. We can
do that, yes.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-06-20  9:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19  8:25 [Xenomai] Sharing memory between rt-posix and standard-posix apps Wolfgang Grandegger
2012-06-19  8:33 ` Gilles Chanteperdrix
2012-06-19  8:49   ` Wolfgang Grandegger
2012-06-19  8:50     ` Gilles Chanteperdrix
2012-06-19  8:52       ` Wolfgang Grandegger
2012-06-19  9:04         ` Gilles Chanteperdrix
2012-06-19  9:29           ` Wolfgang Grandegger
2012-06-19  9:38             ` Gilles Chanteperdrix
2012-06-20  7:33               ` Wolfgang Grandegger
2012-06-20  9:18                 ` Gilles Chanteperdrix

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.