Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and...
Transcript of Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and...
![Page 1: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/1.jpg)
Asymmetric Multiprocessing
and Embedded LinuxMarek NOVAK, Dusan CERVENKA
October 24, 2017
![Page 2: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/2.jpg)
Who are we?
• Marek NOVAK
– Author/maintainer of RPMsg-Lite library
– PhD student
• Dusan CERVENKA
– Author/maintainer of eRPC library
• Both
– Linux entousiasts
– Working at NXP Semiconductors
![Page 3: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/3.jpg)
OutlineAsymmetric Multiprocessing (AMP)
Remote Processor Messaging (RPMsg)
in Linux kernel
RPMsg-Lite – RPMsg for RTOS
Embedded Remote Procedure Call (eRPC)
![Page 4: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/4.jpg)
Asymmetric Multiprocessing (AMP)
![Page 5: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/5.jpg)
Motivation – why AMP? 1/2
• Thanks to AMP, your system can:
– Be faster
– Consume less power
– Be safer
– Be more secure
• How?
![Page 6: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/6.jpg)
Motivation – why AMP? 2/2
• Not all CPUs in the system are treated equally
• The cores can:
– Run independently
– Have different operating systems
– Have different architecture, clock frequency
– Be tailored for a specific task (DSP)
![Page 7: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/7.jpg)
How does it work?
• There is a concept of master and slave
• Master manages shared memory
• Master may control slave’s life-cycle
![Page 8: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/8.jpg)
Remote Processor Messaging
(RPMsg) in Linux kernel
![Page 9: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/9.jpg)
What is RPMsg?
• RPMsg defines a
UDP-like header
• Only the header is
strictly defined,
there exist multiple
transport mechanism
![Page 10: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/10.jpg)
RPMsg in Linux - History
• RPMsg used to have only one transport layer
based on VirtIO
• Initially maintained by Ohad Ben Cohen
• Now maintained by Bjorn Andersson (Linaro)
• New transport layers added – Glink and SMD
– Mostly for Qualcomm platforms
![Page 11: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/11.jpg)
RPMsg in Linux – Current State 1/2
![Page 12: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/12.jpg)
RPMsg in Linux – Current State 2/2
![Page 13: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/13.jpg)
RPMsg/VirtIO 1/3
• Single writer single reader approach
• Allows for zero-copy
• 2 ring buffers for each direction
![Page 14: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/14.jpg)
RPMsg/VirtIO 2/3
![Page 15: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/15.jpg)
RPMsg/VirtIO 3/3
![Page 16: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/16.jpg)
RPMsg-Lite – RPMsg for RTOS
![Page 17: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/17.jpg)
Library Architecture 1/2
![Page 18: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/18.jpg)
Library Architecture 2/2
• Environment (“RTOS”) porting layer
• Platform (“hardware”) porting layer
• Modular and simple
• BSD licensed
• FreeRTOS port (done) and Zephyr port (TBD)
• Github: https://github.com/NXPmicro/rpmsg-lite
![Page 19: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/19.jpg)
Embedded Remote Procedure Call
(eRPC)
• What is RPC?
• Why eRPC?
• How to use eRPC?
![Page 20: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/20.jpg)
What is RPC?
![Page 21: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/21.jpg)
Why eRPC? 1/2
Other RPC:• Apache Thrift• Microsoft RPC• Google RPC• JSON-RPC• …
![Page 22: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/22.jpg)
Why eRPC? 2/2
• Small code size
• Programing languages: C/C++, Python, … ?
• APIs style defined by user.
• Generated stub code
• Easy to port: BM, FreeRTOS, Zephyr(TBD)
• Modular and simple
• BSD-3: https://github.com/EmbeddedRPC/erpc
![Page 23: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/23.jpg)
How to use eRPC? 1/3
Dual core device – Linux core + Cortext-M core
• Main core – Multimedia applications, web server, …
• Second core – communicating through radio
![Page 24: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/24.jpg)
How to use eRPC? 2/3
• Interface Definition Language (IDL):
• Generated declaration:
interface Radio {send_packet(uint16 addr, uint8 dataLength,
binary data @length(dataLength)) -> bool}
bool send_packet(uint16_t addr, uint8_t dataLength,const uint8_t* data);
![Page 25: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/25.jpg)
How to use eRPC? 3/3
![Page 26: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/26.jpg)
Q & A
• RPMsg-Lite: https://github.com/NXPmicro/rpmsg-lite
• Marek NOVAK: [email protected]
• eRPC: https://github.com/EmbeddedRPC/erpc
• Dusan CERVENKA: [email protected]
![Page 27: Asymmetric Multiprocessing and Embedded Linux · · 2017-10-24Asymmetric Multiprocessing and Embedded Linux Marek NOVAK ... •Not all CPUs in the system are treated ... –Have](https://reader031.fdocuments.us/reader031/viewer/2022020303/5b1991a27f8b9a37258ccd59/html5/thumbnails/27.jpg)