-
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
rpmsg: bring back zero copy transfer #162
Conversation
@wjliang, this patch bring back @MarekNovakNXP's zero copy transfer, please review it. |
thanks for you patch, could you share your use case to have this feature? |
We have several drivers use this feature:
Ok, I will refine the implementation to save the length in some reserved field as before. |
My concern is these rpmsg APIs may only work with single buffer. E.g. it will not work with chained buffers. Also please also post the zero-copy to kernel RPMsg, as you are using the reserved fields from the RPMsg header. Thanks for you use cases list, I just have some questions:
|
If we extend the rpmsg to use the chained buffer, we can extend this API too(e.g. return the chained buffer). Actually, each offical OpenAMP release isn't compatible with the previous one, so I think it isn't a big issue to change this API for the chained buffer.
I will provide one, but I think this change is different from:
Yes, I have, but:
I expect that the message embedded directly in rpmsg buffer is around 1KB, the huge data(several ten/hundred KB) should pass through as a pointer, because: |
6804841
to
4b29dcd
Compare
Rebase to the latest mainline, no function change. |
4b29dcd
to
f3d7efe
Compare
cf04b18
to
5f2287c
Compare
@wjliang fix the build break. |
c24071d
to
5e3ed51
Compare
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.
with minor comments
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.
For me this patch answers to a limited use cases vs big data need:
- DMA transfer for copies ( cyclic mode)
- big buffers
- buffer reuses (data processing on same buffer).
...
I don't want to block it but just a concerns vs a global solution base on a service on top of rpmsg...
i suppose that you define some shared buffers for the Sound Open Firmware use cases, and rpmsg are used for control, right?
Concerning the patch itself: seem correct. Just one remark:
Something may be missing to release all buffers on application crash or on service destruction ( local or remote). But this would means that reserved buffers should be associated to the ept...
Good point, just in some cases of crashing, one end may not even able to do any cleaning. |
Since many above cases normally involve the dedicated memory management, I expect:
Yes, the audio data buffer is preallocated after the hardware parameter is lock down and recycle in the whole playback/capture stage. The buffer location exchange when the state change from stop/pause to run and read/write directly by DSP, from that the rpmsg is just used to notify the buffer position, no real audo data send/receive through IPC.
Yes, it's a problem if application get a buffer but crash before return back. But since the memory protection is very weak for most OpenAMP usage, the action can be taken is to reboot MCU/DSP if some application crash, so what we need here is to teardown all resource and restart if the peer happen reboot. |
5e3ed51
to
36cd627
Compare
@arnop2, the new pull request split the change into two patches. |
protection is very weak for most OpenAMP usage, the action can be taken is to reboot MCU/DSP if some application crash, so what we need here is to teardown all resource and restart if the peer happen reboot. |
31c6a30
to
a05f227
Compare
@arnopo the sgement fault is fixed. @kr-satish, thanks for your help. |
@xiaoxiang781216 Thanks for the patches. |
From my point of view the feature and associated patch are Ok. If you have some suggestions to minimize the impact don't hesitate... |
I performed measurements for some zehyr samples, building for the NXP expresso and STm32MP1 platforms. I note a library increase of about 10% for the ROM and 16 bytes for the RAM.
w/o zero copy:
w zero copy:
w/o zero copy:
w zero copy:
w/o zero copy:
w zero copy:
|
The absolute number is from 172 bytes to 252 bytes. Should we still need add a macro to enable/disable this feature? |
I tested using macros, which saves about half the extra footprint but adds complexity. |
Hi @galak |
8649c90
to
e0f42a4
Compare
@arnopo how about we merge this PR now? so it get more time to test before release. |
I waiting @edmooring and @galak feedback first. As everyone is busy on there own stuff we need to allow a reasonable time for review. |
Hi @galak, @edmooring |
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.
If @galak is OK with this, I think we're good to go.
Commit-id: b16ca55 Adding RPMsg Extension layer implementing zero-copy send and receive. Signed-off-by: Chao An <anchao@pinecone.net>
to demo the usage of zero copy API Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
e0f42a4
to
cad86c7
Compare
Hi @xiaoxiang781216 |
Two simplify the review, I split two small independent patch to new PR:
#240
#241