-
Notifications
You must be signed in to change notification settings - Fork 295
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
rpmsg: notify the user when the remote address is received #246
base: main
Are you sure you want to change the base?
Conversation
The alternative method to fix the issue reported here: #238 |
Hi @xiaoxiang781216, Seems that the callback can be called only in a particular case. Please could you detail your sequence that results in the call of this callback? |
Here is the typical sequence:
In this case, |
eefb239
to
8b8ebfa
Compare
Thanks for the use case clarification For me your point is valid, but as previously suggested i would prefer that we find a generic solution common with Linux implementation, that would perhaps extend the RPMsg protocol. From my point of view, the best way to proceed is to send an RFC or a patch to the Linux remoteproc mailing list to propose an extension of the protocol to support handshaking. This will trigger a discussion on a global solution. |
No, this PR isn't related to #160. #160 provide a mechanism to exchange the address automatically. As we disscuss in that PR, the server can send a dummy message to pass the address back to client manually too. But the client need some way to get the notification when the server address is known by either method, otherwise the client has to check the dest_addr in a busy loop like #238.
No, it work in all cases. The key point is that OpenAMP need provide a better method to notify the peer address is ready if he/she create an endpoint by rpmsg_create_ept(dest=RPMSG_ADDR_ANY). Otherwise, user has to poll the dest_addr again and again.
This PR doesn't change the protocol between Linux and MCU like #160 and #155. It's an implementation detail that how to notify the user when the server address is available, so we don't need(shouldn't) sync so detailed info with Linux.
Yes, #155 and #160 need collaborate with Linux, but this PR doesn't need. |
8b8ebfa
to
22402ba
Compare
Both seems linked as the #160 is how to notify the remote processor when available. This PR can be considered as an extension to propagate to the user. As the way to address the #160 could change the way to implement this. We can not 100% sure that this update would be still relevant after the #160 feature is implemented.I think here it would be more reasonable to take a step-by-step approach, first address the #160 in Linux, then address this PR if still relevant, With the objective of having a generic solution that would work in a maximum of use case.
|
Even #160 is implemented, the address exchange is still an asynchronous process. One side who issue the first rpmsg_create_ept(and then has to pass dest=RPMSG_ADDR_ANY), need a way to know that the destination address available(either by a dummy message or #160 approach). one method is checking dest_addr in a busy loop(bad), another is call a function provided by user(better than first). |
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 think this is probably a good approach. I'd like to see a bit more documentation as to the intent of the callback, and an update to one of the examples to show how to use it.
22402ba
to
061af59
Compare
061af59
to
0b98bfe
Compare
0b98bfe
to
241f8de
Compare
@arnopo and @edmooring we need a method to know when the dest address is got:
Either method is workable, but we have to select one. What are you thinking? |
Hi @xiaoxiang781216, Anyway let's @edmooring shares its point of view |
Hi all, |
Ok, let's wait #160 |
241f8de
to
84e6bec
Compare
84e6bec
to
cc6f0b2
Compare
7ea5ddb
to
93f6a2a
Compare
b2a4587
to
0c70377
Compare
Update the document like #376 . @arnopo like we discussed in #376, bind notification is also useful in some case: |
Agree on the fact that something is needed for the handshake. The point here is that the solution needs to be compliant with Linux implementation.
https://github.com/arnopo/linux/commits/signalling
https://github.com/arnopo/open-amp/commits/flow_ctrl
https://drive.google.com/file/d/1CLU3ybI3oSBGvor18AQ-HOzOJ2nOppEb/view |
But the endpoint setup is part of the life time cycle management, which is different from follow control. It isn't good to mix them. If Linux side support to create rpmsg device dynamically(instead of waiting the remote creation), the mapping still probe callback:
You can see the probe callback is delayed until the handshake finish, it's wrong to:
Since OpenAMP doesn't follow Linux driver model(bus/device/driver), the user may hold a rpmsg_endpoint which isn't capable to communicate with the remote, he has to:
All approach is valuable and can be used in the different case. The last two approach isn't needed in Linux since probe mechanism ensure them never happen.
It's two different topic, please don't mix them. This just like nobody consider to replace driver probe callback with the new flow_control in Linux kernel.
Several questions:
|
Linux supports that and since 5.18 (https://elixir.bootlin.com/linux/v5.18-rc1/source/drivers/rpmsg/rpmsg_ctrl.c#L98)
This part is missing in Linux and as it implies an evolution of the virtio rpmsg features. So If you want to promote this solution You need to send to the linux mailing list the associated patches
The step 3. and 4. is mixed with step 1 when Linux creates the rpmsg device. even if RPMSG_NS_CREATE_ACK is implemented in Linux, the legacy behavior has to be supported.
This is the way it is implemented today in Linux. One advantage of this solution is that you announce only if your driver probe does not fail.
To be able to discuss these points we need first to move forward on the the endpoint bindings
[...]
When the ns announcement or ns annoucement ack is called, the driver is already probed in Linux as the endpoint is already created for OpenAMP .
I would prefer to have both that's why my #246 (comment) was only to inform you about flow control work. As I already mentioned several times, if you want that the RPMSG_NS_CREATE_ACK mechanism be taken into account, an implementation has to be sent on Linux mailing list. |
Thanks for pointing out.
It is seldom needed to create the device proactively from Linux side from my experience:).
Yes, if the peer doesn't support RPMSG_NS_CREATE_ACK, we have to make rpmsg_device ready immediately and then rpmsg driver has to wait the peer send the message first before it can start the talking.
Yes, this is key point: rpmsg_create_ept return rpmsg_endpoint, but it can't work until the peer send RPMSG_NS_CREATE(or RPMSG_NS_CREATE_ACK), this patch provide the callback to notify the endpoint is ready to communicate just like rpmsg_driver:probe callback. BTW, it's very useful even without RPMSG_NS_CREATE_ACK. For example, we have a SoC with four MCU/DSP run OpenAMP and want to setup a mesh network. Here is how we do:
At this point, the service know it could talk to the peer.
One question: why need a dedicated endpoint for the flow control? The flow controol is very protocol specific and better to integrate with the rpmsg driver self. For example, we have create a new socket family on top of rpmsg API, so the user could talk to peer with the standard socket API just like Unix Domain socket. To control the flow, we use a slide window internally which is very efficient since the window info insert into the normal data flow instead. If your target is rpmsg_tty driver, it's better to build the flow control into rpmsg_tty protocol self. Yes, we also build a rpmsg tty driver which use a different but simple flow control than rpmsg socket.
Since I don't actively develop Linux kernel for a while, it's very hard to prepare the new patch without the test.
It's fine to use either method since the result is same: we can get the bind/probe callback. Let's come back to this patch. I hope the mesh network example give you an example why ns_bind_cb is also useful even without RPMSG_NS_CREATE_ACK. |
5a101df
to
ceddd67
Compare
ceddd67
to
6787ae6
Compare
This pull request has been marked as a stale pull request because it has been open (more than) 45 days with no activity. |
without this notificaiton, user has to call is_rpmsg_ept_ready in a busy loop Signed-off-by: Xiang Xiao <[email protected]>
9e0b62d
to
d362ce1
Compare
without this notificaiton, user has to call is_rpmsg_ept_ready in a busy loop