-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the two phase creation handshake #160
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this patch. The "NS service ack" has to be service dependent, not rdev dependent. The expected behavior depends on the implementation of the service itself.
From my POV, this has to be managed by the application not at the RPMsg level.
@arnop2 I can't understand why the acknowledge is service dependent? could you give some example the ack may generate some bad side efffect?
As I learn from IPC mechanism(e.g. pipe, unix socket, udp, tcp and rpc), once all necessary information pass to the library, either side(client or server) could send the message first. |
The name "client" and "server" is confusing. i think one side has "service name" is because this site is to provide service, and it doesn't need to send the first message. instead, the side which wants service will send out the name resource announcement requests to enquire the available services. |
Another side effect is that this implementation adds a constraint on service that must be ready for reception as soon as the endpoint is created. Last point is that this can generates compatibility issue with some other rpmsg implementation like Linux or rpmsg-lite.
|
Yes, let me clarify a little bit:
Yes, this is one approach to fix the problem: both side call rpmsg_create_ept with dest == RPMSG_ADDR_ANY and then trigger RPMSG_NS_CREATE twice to exchange the port information.
Yes, Linux kernel never create the name channel proactively. but as describe before, client<->server model is also useful for OpenAMP. |
Yes, It's a problem. After some thought, we should guard ALL NS annoucement(both RPMSG_NS_CREATE and RPMSG_NS_CREATE_ACK) when name equal NULL. So the caller could bypass all NS by the empty channel name.
This patch just make the client could send the first message possibly, If the server in upper layer need take more time to do the preparation, it could still enforce the client don't send any message before the server send some special message first. From my point of view, both side should be enabled to send the first message as needed once the channel setup. It's the responsibility and rights for the application protocol desginer to define the initial sequence(who send the first message), but not the transport layer enforce that only server can send the first message.
Yes, the new RPMSG_NS_CREATE_ACK may confuse old implementation. That's why I add a feature bit VIRTIO_RPMSG_F_ACK to guard the new behaviour.
Yes, I will send the similar patch to kernel side once the patch pass OpenAMP community review.
|
30344bf
to
a65a83e
Compare
@arnop2 the third patch resolve your issue about the side effect of rpmsg_create_ept, please take a look. |
@xiaoxiang-xiaomi: i think this patch break the rpmsg protocol, a rpmsg channel is a service name + one or several associated endpoints.
|
This sounds like another version of RPMsg, instead of use NS_ACK feature bit, better to make it RPMsg v2 feature bit. Go back to the issue this patch is trying to solve.
|
rpmsg protocol = main endpoint + aided endpoints That's why I add a new API rpmsg_create_anon_ept, to help the user:
For main endpoint, we need provide the service name, but we don't need provide the name for the additional endpoints since NS service shouldn't activate in this case like Linux kernel.
Another case is in rpmsg_device->ns_bind_cb, we receive the peer port and then supply to rpmsg_create_ept. What I enhance here is to send RPMSG_NS_CREATE_ACK to let the peer know our port information. |
Ok, I will split the pull request to several small one.
To learn the peer port, two approach could use:
No, I don't want to send the normal message before dest_addr != ANY, I just want to exchange the port information automatically. |
@arnop2 has use cases that there are multiple service endpoints(that is different endpoint addresses) of the same service name. Option 1, Reuse RPMSG_NS_CREATE will not solve this case. |
@arnop2, could you explain how the second endpoint create?
Sure, I will send the patch to kernel by end of the week. |
7a00333
to
7618abe
Compare
This partially true for Linux, as there is a channel notion with a default endpoint and a service. you can create endpoints on top of this channel. But in this case an endpoint is still linked to service (attached to the channel). In OpenAMP, the channel concept does no more exist.
|
|
Since Linux distinguish channel and endpoint, I need clarify a little bit:
Yes, the new OpenAMP remove the channel concept, that's why I add rpmsg_create_anon_ept:
But you can see the endpoint(struct rpmsg_endpoint) in Linux side actually hasn't name at all, only channel(struct rpmsg_device) has name.
|
So you create two endpoints with the same name from OpenAMP then two RPMSG_NS_CREATE with the same name will send to Linux kernel? I think rpmsg_create_channel in drivers/rpmsg/virtio_rpmsg_bus.c will complain:
So two rpmsg_endpoint with the same name from OpenAMP map to one rpmsg_device from Linux kernel? How kernel rpmsg driver distinguish the different OpenAMP instance? Actually, we also create a similar driver(rpmsg_tty), but each tty has a different channel name to support the multiple tty instances. Here is the related patch:
|
Yes we could consider that the endpoint does not need to have a name. But from my pov this does not correspond to the protocol:
|
03d5b66
to
ef89230
Compare
Yes, this patch need collaborate at least between OpenAMP and Linux kernel. We can merge it only when both community agree the change. |
@arnopo @edmooring the current design has a flaw that OpenAMP can't send any message if the kernel don't send a message first. This patch try to fix this flaw. |
9d890c4
to
16a035c
Compare
0f156cc
to
d1702cc
Compare
d076611
to
7c1e31f
Compare
7c1e31f
to
5e8239e
Compare
a20266b
to
69b0685
Compare
Hi @xiaoxiang781216 |
Sure, it's good to move forward. |
Hi @arnopo , Thanks |
Not the good place here as it is not related to the PR. Please create a new discussion thread for this, i will answer it |
d7b5e78
to
6dc51fd
Compare
383ec3a
to
52fae02
Compare
e5c31ec
to
5595b73
Compare
the two phase handsake make the client could initiate the transfer immediately without the server side send any dummy message first. Signed-off-by: Xiang Xiao <[email protected]>
Guard by a new feature bit to keep the backward compatiblity, @wjliang please review.