Skip to contentSkip to conversation

Sharing memory between rt-posix and standard-posix apps

Xenomai Wolfgang Grandegger 2 participants 10 messages Jun 19, 2012 – Jun 20, 2012

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 4 lines · Wolfgang Grandegger

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.

Signature · 1 line
					    Gilles.
#2 lore raw
Quoted 9 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger

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.

#3 lore raw
Quoted 4 lines · Wolfgang Grandegger
Quoted 3 lines · Gilles Chanteperdrix
Quoted 2 lines · Wolfgang Grandegger

Hello,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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.

Signature · 1 line
					    Gilles.
#4 lore raw
Quoted 8 lines · Gilles Chanteperdrix
Quoted 7 lines · Wolfgang Grandegger
Quoted 6 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger

Hello,

the shared memory support of Xenomai's POSIX skin currently only support shared memory between rt processes.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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.

#5 lore raw
Quoted 13 lines · Wolfgang Grandegger
Quoted 12 lines · Gilles Chanteperdrix
Quoted 11 lines · Wolfgang Grandegger
Quoted 9 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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 ?

Signature · 1 line
					    Gilles.
#6 lore raw
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · Wolfgang Grandegger
Quoted 12 lines · Gilles Chanteperdrix
Quoted 11 lines · Wolfgang Grandegger
Quoted 9 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger

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.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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.

#7 lore raw
Quoted 19 lines · Wolfgang Grandegger
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wolfgang Grandegger
Quoted 15 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Quoted 3 lines · Gilles Chanteperdrix
Quoted 2 lines · Wolfgang Grandegger

Hello,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 4 lines

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

Quoted 1 line

initialization phase. Then no more page faults should happen.

Yes. It is a bit ugly, but should work.

Signature · 1 line
					    Gilles.
#8 lore raw
Quoted 36 lines · Gilles Chanteperdrix
Quoted 19 lines · Wolfgang Grandegger
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wolfgang Grandegger
Quoted 15 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Quoted 3 lines · Gilles Chanteperdrix
Quoted 2 lines · Wolfgang Grandegger

Hello,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 4 lines

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?

Quoted 8 lines

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

Quoted 1 line

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.

#9 lore raw
Quoted 41 lines · Wolfgang Grandegger
Quoted 40 lines · Gilles Chanteperdrix
Quoted 19 lines · Wolfgang Grandegger
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Wolfgang Grandegger
Quoted 15 lines · Gilles Chanteperdrix
Quoted 4 lines · Wolfgang Grandegger
Quoted 3 lines · Gilles Chanteperdrix
Quoted 2 lines · Wolfgang Grandegger

Hello,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 4 lines

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.

Quoted 8 lines
Quoted 4 lines

... and access the page once per page in the

Quoted 1 line

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.

Signature · 1 line
					    Gilles.