Skip to contentSkip to conversation

rt_heap_bind, Error=-11 -> EWOULDBLOCK why?

Xenomai Hänel-Baas, Alexander 2 participants 2 messages Feb 24, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

Wrong email address and I understand your reply not correctly you are right -> sorry.

Ok, so now I changed the flags to H_SINGLE | H_SHARED | H_DMA | H_NONCACHED. (it is possible? DMA + NONCACHED)

By the way, we have 3 shm areas:
2 of them was created from the user space application with the flags: H_SINGLE | H_SHARED | H_NONCACHED 1 of them created from the kernel driver with : H_SINGLE | H_SHARED | H_DMA (contiguous memory for dma)

I spend my time to check the situation, here my notice:

------
FLAGS: H_SINGLE | H_SHARED | H_DMA
shmMu_initialize: Open or create SHM "SLINK4" with 256 bytes header and 36864 bytes data.
createNewHeap: FLAGS_: 0x0700
createNewHeap: Heap SLINK4 (Id = 0x9f0f05c6, size=37120, flags=0x00000700, address: f57f0c00) successfully created.
allocateHeap: +RTAPI+ rt_heap_alloc( shm = "SLINK4" ) success. Shm-area is at c0051000
rtapi_shmInitialize: shm-area SLINK4 (id = 0x9f0f05c6) allocated at c0051000 size = 37120
SM. Shared Memory Area SLINK4 at c0051000

Ok, the kernel driver creates shm with the name SLINK4 but the user space side doesn't see it:

rt_heap_bind(shmName=SLINK4) failed. Error=-11 -> EWOULDBLOCK SHM area (Name SLINK4, Id 0x9f0f05c6) at (nil) is INVALID!!!

But the Shm areas that was created from the user space application for herself works fine. Only the Flags are different:

shmMu_initialize: Open or create SHM "GLOBAL" with 256 bytes header and 1048576 bytes data.
createNewHeap: FLAGS: 0x0e00
createNewHeap: Heap GLOBAL (Id = 0x5e8b9ffb, size=1048832, flags=0x00000e00, address: f5540800) successfully created.
allocateHeap: +RTAPI+ rt_heap_alloc( shm = "GLOBAL" ) success. Shm-area is at f873d000

rt_heap_bind(shmName=GLOBAL) success. RT_HEAP = 0x9ade0f0, HEAP->area= 0xf873c000. ( shm = "GLOBAL" ) success. Shm-area is at 0xb4e29000

----------
No lets start the kernel with "nopat"

FLAGS: H_SINGLE | H_SHARED | H_DMA and nopat in cmd line
shmMu_initialize: Open or create SHM "SLINK4" with 256 bytes header and 36864 bytes data.
createNewHeap: FLAGS: 0x0700
createNewHeap: Heap SLINK4 (Id = 0x9f0f05c6, size=37120, flags=0x00000700, address: f650ac00) successfully created.
allocateHeap: +RTAPI+ rt_heap_alloc( shm = "SLINK4" ) success. Shm-area is at c0051000 from f650ac00
rtapi_shmInitialize: shm-area SLINK4 (id = 0x9f0f05c6) allocated at c0051000 size = 37120
SM. Shared Memory Area SLINK4 at c0051000

Kerneldriver creates shm, and the userspace side can catch it.

rt_heap_bind(shmName=SLINK4) success. RT_HEAP = 0x8ac7ca8, HEAP->area= 0xf83b1000. Shm-area is at 0xb4f90000 from 0x8ac7ca8

And the self created shm area is also good.

rt_heap_bind(shmName=GLOBAL) success. RT_HEAP = 0x8ba0070, HEAP->area= 0xf873c000. ( shm = "GLOBAL" ) success. Shm-area is at 0xb4e8e000

And the system works fine. I hope my notice are helpful.

With best regards,
Alexander Hänel-Baas

#1 lore raw
Quoted 5 lines · Alexander

Hi,

Wrong email address and I understand your reply not correctly you are right -> sorry.

Ok, so now I changed the flags to H_SINGLE | H_SHARED | H_DMA | H_NONCACHED. (it is possible? DMA + NONCACHED)

Sure, on architectures without snooping, using cached mapping means you have to manually invalidate the cache after a DMA transfer to the mapping (or flush it before a DMA transfer from the mapping). With uncached mappings, you do not have this problem.

Quoted 16 lines

By the way, we have 3 shm areas:
2 of them was created from the user space application with the flags: H_SINGLE | H_SHARED | H_NONCACHED 1 of them created from the kernel driver with : H_SINGLE | H_SHARED | H_DMA (contiguous memory for dma)

I spend my time to check the situation, here my notice:

------
FLAGS: H_SINGLE | H_SHARED | H_DMA
shmMu_initialize: Open or create SHM "SLINK4" with 256 bytes header and 36864 bytes data.
createNewHeap: FLAGS_: 0x0700
createNewHeap: Heap SLINK4 (Id = 0x9f0f05c6, size=37120, flags=0x00000700, address: f57f0c00) successfully created.
allocateHeap: +RTAPI+ rt_heap_alloc( shm = "SLINK4" ) success. Shm-area is at c0051000
rtapi_shmInitialize: shm-area SLINK4 (id = 0x9f0f05c6) allocated at c0051000 size = 37120
SM. Shared Memory Area SLINK4 at c0051000

Quoted 4 lines

Ok, the kernel driver creates shm with the name SLINK4 but the user space side doesn't see it:

rt_heap_bind(shmName=SLINK4) failed. Error=-11 -> EWOULDBLOCK SHM area (Name SLINK4, Id 0x9f0f05c6) at (nil) is INVALID!!!

For the third time: that is because the mapping is not uncached, as shown by the message you showed us on the kernel console. The problem is probably that the mmap method of the driver you use does not want to map cached regions.

Signature · 1 line
					    Gilles.