Skip to contentSkip to conversation

xddp port questions

Xenomai Leopold Palomo-Avellaneda 2 participants 6 messages Jan 14, 2014 – Jan 20, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from the non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread listen from that port.

I don't understand how is possible that both (non-rt and rt threads) listen from the same port and could not have collisions if two threads (non-rt and rt) try to write in the same port.

Could not be better to separate it?

Thanks in advance,

Leopold

Signature · 10 lines
--
Linux User 152692
Catalonia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20140114/935a98e0/attachment.sig>
#1 lore raw
Quoted 10 lines · Leopold Palomo-Avellaneda

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from the non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread listen from that port.

Quoted 6 lines

I don't understand how is possible that both (non-rt and rt threads) listen from the same port and could not have collisions if two threads (non-rt and rt) try to write in the same port.

Could not be better to separate it?

No, that would defeat the purpose of the illustration.

XDDP is a wrapper over Xenomai's message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a given /dev/rtp device minor, but the communication endpoints between RT and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>

                     ^
                     |
                     |  * input queue:  /dev/rtp -> xnpipe
                     |  * output queue: xnpipe -> /dev/rtp
                     |
                     v
               /dev/rtp<port>

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are bi-directional. Likewise, NRT and RT never write to the same queue, since the purpose of message pipes is to cross the RT/NRT domain boundary.

Signature · 1 line
Philippe.
#2 lore raw

A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure:

Quoted 9 lines · Leopold Palomo-Avellaneda
Quoted 8 lines

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from the non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread listen

from

Quoted 3 lines
Quoted 3 lines

that port.

I don't understand how is possible that both (non-rt and rt threads)

listen

Quoted 1 line
Quoted 1 line

from the same port and could not have collisions if two threads (non-rt

and

Quoted 21 lines
Quoted 4 lines

rt) try to write in the same port.

Could not be better to separate it?

No, that would defeat the purpose of the illustration.

XDDP is a wrapper over Xenomai's message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a given /dev/rtp device minor, but the communication endpoints between RT and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>

                      ^
                      |
                      |  * input queue:  /dev/rtp -> xnpipe
                      |  * output queue: xnpipe -> /dev/rtp
                      |
                      v
                /dev/rtp<port>
Quoted 4 lines

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are bi-directional. Likewise, NRT and RT never write to the same queue, since the purpose of message pipes is to cross the RT/NRT domain boundary.

Ok,

in the example the same thread open a device for write and read from the same device. From your answer about the endpoints, I understand that when the NRT open for read, read from the RT world, and when the NRT writes to the RT world.

So, could I have a NRT function (thread) that open the device to just read from the RT world and _another_ that send to the RT world?

Because I have to one the same device, and I don't know that I could do it at the same time.

Regards,

Leopold

Signature · 10 lines
--
Linux User 152692
Catalonia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20140120/e730351a/attachment.sig>
#3 lore raw
Quoted 50 lines · Leopold Palomo-Avellaneda

A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure:

Quoted 9 lines · Leopold Palomo-Avellaneda
Quoted 8 lines

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from the non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread listen

from

Quoted 3 lines
Quoted 3 lines

that port.

I don't understand how is possible that both (non-rt and rt threads)

listen

Quoted 1 line
Quoted 1 line

from the same port and could not have collisions if two threads (non-rt

and

Quoted 21 lines
Quoted 4 lines

rt) try to write in the same port.

Could not be better to separate it?

No, that would defeat the purpose of the illustration.

XDDP is a wrapper over Xenomai's message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a given /dev/rtp device minor, but the communication endpoints between RT and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>

                       ^
                       |
                       |  * input queue:  /dev/rtp -> xnpipe
                       |  * output queue: xnpipe -> /dev/rtp
                       |
                       v
                 /dev/rtp<port>
Quoted 4 lines

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are bi-directional. Likewise, NRT and RT never write to the same queue, since the purpose of message pipes is to cross the RT/NRT domain boundary.

Ok,

in the example the same thread open a device for write and read from the same device. From your answer about the endpoints, I understand that when the NRT open for read, read from the RT world, and when the NRT writes to the RT world.

Quoted 6 lines

So, could I have a NRT function (thread) that open the device to just read from the RT world and _another_ that send to the RT world?

Because I have to one the same device, and I don't know that I could do it at the same time.

You can both send-receive data to/from the same socket descriptor RT-wise, and read-write from/to the same /dev/rtp* descriptor NRT-wise. Message pipes are bi-directional by design, on both ends. In the XDDP case, traffic is routed as follows:

- RT-writes -> NRT-reads
- RT-reads <- NRT-writes

So, fd = open("/dev/rtpX", ...) => read(fd, and write(fd, are allowed
s = socket(AF_RTIPC, ...) => sendmsg(s, and recv(s, are allowed.

Signature · 1 line
Philippe.
#4 lore raw

A Dilluns, 20 de gener de 2014, Philippe Gerum va escriure:

Quoted 7 lines · Leopold Palomo-Avellaneda
Quoted 6 lines

A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure:

Quoted 5 lines · Leopold Palomo-Avellaneda
Quoted 4 lines

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from

the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread

listen

Quoted 28 lines
Quoted 28 lines

from

Quoted 3 lines
Quoted 3 lines

that port.

I don't understand how is possible that both (non-rt and rt threads)

listen

Quoted 1 line
Quoted 1 line

from the same port and could not have collisions if two threads (non-rt

and

Quoted 21 lines
Quoted 4 lines

rt) try to write in the same port.

Could not be better to separate it?

No, that would defeat the purpose of the illustration.

XDDP is a wrapper over Xenomai's message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a given /dev/rtp device minor, but the communication endpoints between RT and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>

                       ^
                       |
                       |  * input queue:  /dev/rtp -> xnpipe
                       |  * output queue: xnpipe -> /dev/rtp
                       |
                       v
                 /dev/rtp<port>
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are bi-directional. Likewise, NRT and RT never write to the same queue, since the purpose of message pipes is to cross the RT/NRT domain

boundary.

Quoted 4 lines
Quoted 4 lines

Ok,

in the example the same thread open a device for write and read from the

same

Quoted 1 line
Quoted 1 line

device. From your answer about the endpoints, I understand that when the

NRT

Quoted 7 lines
Quoted 7 lines

open for read, read from the RT world, and when the NRT writes to the RT world.

So, could I have a NRT function (thread) that open the device to just read from the RT world and _another_ that send to the RT world?

Because I have to one the same device, and I don't know that I could do it

at

Quoted 8 lines
Quoted 2 lines

the same time.

You can both send-receive data to/from the same socket descriptor RT-wise, and read-write from/to the same /dev/rtp* descriptor NRT-wise. Message pipes are bi-directional by design, on both ends. In the XDDP case, traffic is routed as follows:

Quoted 6 lines

- RT-writes -> NRT-reads
- RT-reads <- NRT-writes

So, fd = open("/dev/rtpX", ...) => read(fd, and write(fd, are allowed
s = socket(AF_RTIPC, ...) => sendmsg(s, and recv(s, are allowed.

Sorry if I have not been clear or I don't understand you. For design I would like to make a thread that:

fd = open("/dev/rtpX", ...) => read(fd, ...

to read

and another thread to

fd = open("/dev/rtpX", ...) => write(fd, ...

so I open TWO times the /dev/rtpX, one for read and another for write, because I would like to use it in two different parts, and I don't know if it's allowed.

I understand that the RT part and the NRT part open the same /dev/rtp*, but I don't know if several NRT (or RT) could open the same open descriptor at the same time.

Regards,

Leopold

Signature · 10 lines
--
Linux User 152692
Catalonia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20140120/75fe941b/attachment.sig>
#5 lore raw
Quoted 83 lines · Leopold Palomo-Avellaneda

A Dilluns, 20 de gener de 2014, Philippe Gerum va escriure:

Quoted 7 lines · Leopold Palomo-Avellaneda
Quoted 6 lines

A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure:

Quoted 5 lines · Leopold Palomo-Avellaneda
Quoted 4 lines

Hi,

in the example xddp-label a two realtime task are connected with a non- realtime time. They share the same port where one rt task receive from

the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

non-rt task and the other send to rt-task.

The regular thread read and write in the same devname (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread

listen

Quoted 28 lines
Quoted 28 lines

from

Quoted 3 lines
Quoted 3 lines

that port.

I don't understand how is possible that both (non-rt and rt threads)

listen

Quoted 1 line
Quoted 1 line

from the same port and could not have collisions if two threads (non-rt

and

Quoted 21 lines
Quoted 4 lines

rt) try to write in the same port.

Could not be better to separate it?

No, that would defeat the purpose of the illustration.

XDDP is a wrapper over Xenomai's message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a given /dev/rtp device minor, but the communication endpoints between RT and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>

                        ^
                        |
                        |  * input queue:  /dev/rtp -> xnpipe
                        |  * output queue: xnpipe -> /dev/rtp
                        |
                        v
                  /dev/rtp<port>
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are bi-directional. Likewise, NRT and RT never write to the same queue, since the purpose of message pipes is to cross the RT/NRT domain

boundary.

Quoted 4 lines
Quoted 4 lines

Ok,

in the example the same thread open a device for write and read from the

same

Quoted 1 line
Quoted 1 line

device. From your answer about the endpoints, I understand that when the

NRT

Quoted 7 lines
Quoted 7 lines

open for read, read from the RT world, and when the NRT writes to the RT world.

So, could I have a NRT function (thread) that open the device to just read from the RT world and _another_ that send to the RT world?

Because I have to one the same device, and I don't know that I could do it

at

Quoted 8 lines
Quoted 2 lines

the same time.

You can both send-receive data to/from the same socket descriptor RT-wise, and read-write from/to the same /dev/rtp* descriptor NRT-wise. Message pipes are bi-directional by design, on both ends. In the XDDP case, traffic is routed as follows:

Quoted 6 lines

- RT-writes -> NRT-reads
- RT-reads <- NRT-writes

So, fd = open("/dev/rtpX", ...) => read(fd, and write(fd, are allowed
s = socket(AF_RTIPC, ...) => sendmsg(s, and recv(s, are allowed.

Sorry if I have not been clear or I don't understand you. For design I would like to make a thread that:

fd = open("/dev/rtpX", ...) => read(fd, ...

to read

Quoted 7 lines

and another thread to

fd = open("/dev/rtpX", ...) => write(fd, ...

so I open TWO times the /dev/rtpX, one for read and another for write, because I would like to use it in two different parts, and I don't know if it's allowed.

No, this won't work. open() is implicitly exclusive for those devices.

Signature · 1 line
Philippe.