-
Notifications
You must be signed in to change notification settings - Fork 294
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
set_status in virtio_dispatch inconsistency for remote/slave role #139
Comments
Hello Diego, Thanks to point the issue. You are right this not properly handled. Wendy, |
HI Arnaud, Diego Based on the virtio specification (http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html), the virtio_config_status_needs_reset can be set by slave side to require master to reset the slave. The code in rpmsg_virtio.c implementation to check this flag in slave was because there was a case that master restarts, but there is no way for master to notify slave, and thus, it reuse this status bit as a work around. When the slave sees this bit, it resets the status bit to 0 (to indicate the slave knows master restarted). The master monitors the status bit, it will not reinitialize the virtio rings until it sees slave clear the status. This workaround is not very proper. And what I have described about the master behaviour only exists in a customized Linux kernel. The code is "left over" from the effort when we did restructuring for the v2018.10 release. I think we can:
Best Regards, |
Unfortunately, I'm not very familiar with the protocol specifications, so I do not know if I can comment on this. I'd suggest for now to include the |
Hi Wendy, Diego
On 11/21/18 7:28 PM, wjliang wrote:
HI Arnaud, Diego
Based on the virtio specification
(http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html), the
virtio_config_status_needs_reset can be set by slave side to require
master to reset the slave.
Please could you point out the chapter please?
I can not see specific description about a master and a slave status
management, only device and driver access description...
The code in rpmsg_virtio.c implementation to check this flag in slave
was because there was a case that master restarts, but there is no way
for master to notify slave, and thus, it reuse this status bit as a work
around. When the slave sees this bit, it resets the status bit to 0 (to
indicate the slave knows master restarted). The master monitors the
status bit, it will not reinitialize the virtio rings until it sees
slave clear the status. This workaround is not very proper. And what I
have described about the master behaviour only exists in a customized
Linux kernel. The code is "left over" from the effort when we did
restructuring for the v2018.10 release.
I think we can:
* remove the "if (status & VIRTIO_CONFIG_STATUS_NEEDS_RESET) {"
checking for virtio slave.
aligned with this solution for short term.
proposed patch (not tested):
@@ -221,14 +221,18 @@ static int rpmsg_virtio_wait_remote_ready(struct
rpmsg_virtio_device *rvdev)
uint8_t status;
while (1) {
status = rpmsg_virtio_get_status(rvdev);
/* Busy wait until the remote is ready */
+#ifndef VIRTIO_SLAVE_ONLY
if (status & VIRTIO_CONFIG_STATUS_NEEDS_RESET) {
rpmsg_virtio_set_status(rvdev, 0);
/* TODO notify remote processor */
- } else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
+ continue;
+ }
+#endif /*!VIRTIO_MASTER_ONLY*/
+ if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
return true;
}
/* TODO: clarify metal_cpu_yield usage*/
metal_cpu_yield();
}
* Will need to raise this issue to the resource table to describe the
issue, because today, both slave and master are using the same u8
for status, when master/slave set the status, it will overwrite the
other's status bit. for the shared memory based virtio config space,
we should have master_status and slave status separate. We have
talked this before with Linux kernel maintainer, but no conclusion yet.
For time being we have to ensure that only master update the status
field. Reset request could be handled by remote proc based on mailbox or
other signals, or by a specific rpmsg service.
Then agree that a remote proc status field could be useful, to inform
master about remote proc state.
Regards
Arnaud
… * Raise the virtio gap (for the virtio master/slave to notify the
other end that it restarted) in virtio specification for a community
acceptable solution.
Best Regards,
Wendy
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#139 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYTZgwoXHPMT_bIMier7B0zXpW8aXC9eks5uxZtJgaJpZM4Ysg-m>.
|
Hi Diego, Best Regards, |
Reset request is only available for non-crash case, for crashing case, you cannot rely on the reset request. |
Chapter "2.1 Device Status Field" |
But Wendy, currently even with or without the remoteproc framework if you compile the OpenAMP with What I don't understand is why the ".set_status" is removed from |
I think it is OK to have a dummy implementation, as it matches the "not VIRTIO_SLAVE_ONLY" case. |
We currently have in remoteproc_virtio.c:
If compiling for SLAVE only the
.set_status
callback is not defined, but in rpmsg_virtio.c we can end up calling it (viarpmsg_virtio_set_status
function) in therpmsg_virtio_wait_remote_ready
function:The text was updated successfully, but these errors were encountered: