performance evaluation of linux can related system calls
play

Performance evaluation of Linux CAN-related system calls Michal - PowerPoint PPT Presentation

Performance evaluation of Linux CAN-related system calls Michal Sojka , Pavel P sa, Zden ek Hanz alek Czech Technical University in Prague, Faculty of Electrical Engineering Email: { sojkam1,pisa,hanzalek } @fel.cvut.cz SESAMO


  1. Performance evaluation of Linux CAN-related system calls Michal Sojka , Pavel P´ ıˇ sa, Zdenˇ ek Hanz´ alek Czech Technical University in Prague, Faculty of Electrical Engineering Email: { sojkam1,pisa,hanzalek } @fel.cvut.cz SESAMO Security and Safety Modelling Workshop on Factory Communication Systems (WFCS) May 7, 2014 – Toulouse, France M. Sojka, et al. Linux CAN-related system calls WFCS2014 1 / 15

  2. Introduction Motivation Security of on-board networks M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  3. Introduction Motivation Security of on-board networks S D I Intrusion detection system M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  4. Introduction Motivation Security of on-board networks S D I Intrusion detection system Needs to be "tuned" to avoid false positives M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  5. Introduction Motivation Security of on-board networks S D I Intrusion detection system Needs to be "tuned" to avoid false positives Data from outdoor experiments M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  6. Introduction Motivation Security of on-board networks S D I Intrusion detection system Needs to be "tuned" to avoid false positives Data from outdoor experiments Logging M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  7. Introduction Motivation Security of on-board networks S D I Intrusion detection system Needs to be "tuned" to avoid false positives Data from outdoor experiments Logging M. Sojka, et al. Linux CAN-related system calls WFCS2014 2 / 15

  8. Introduction Requirements ◮ All CAN traffic from a car has to be logged in real-time. ◮ Up to 20 CAN buses needs to be logged simultaneously. ◮ Logs are analyzed off-line. M. Sojka, et al. Linux CAN-related system calls WFCS2014 3 / 15

  9. Introduction Outline CAN support in Linux Virtual CAN interface method Gateway-based method Low-latency sockets Conclusion M. Sojka, et al. Linux CAN-related system calls WFCS2014 4 / 15

  10. CAN support in Linux Linux networking subsystem Application (user space) RX/TX path overheads: Socket layer (can/raw.c) ◮ Interrupt ◮ Socket, protocol, Protocol layer (af_can.c) Qdisc Kernel ◮ System call Queuing Device driver discipline Poll ◮ We are interested in the interface between ISR applications and the kernel. CAN controller (HW) M. Sojka, et al. Linux CAN-related system calls WFCS2014 5 / 15

  11. CAN support in Linux Linux networking subsystem Application (user space) RX/TX path overheads: Socket layer (can/raw.c) ◮ Interrupt ◮ Socket, protocol, Protocol layer (af_can.c) Qdisc Kernel ◮ System call Queuing Device driver discipline Poll ◮ We are interested in the interface between ISR applications and the kernel. CAN controller (HW) M. Sojka, et al. Linux CAN-related system calls WFCS2014 5 / 15

  12. CAN support in Linux Linux networking API Sockets: ◮ Raw CAN sockets – most common ◮ Memory mapped socket (PF PACKET) ◮ Non-blocking I/O (O NONBLOCK) ◮ New “Low-latency” sockets (Linux 3.11 – 9/2013) Operations on sockets: ◮ read/write (send/recv) ◮ sendmmsg/recvmmsg M. Sojka, et al. Linux CAN-related system calls WFCS2014 6 / 15

  13. CAN support in Linux Memory-mapped sockets PF PACKET Application (user space) Reception ◮ no system call Protocol & socket layer (af_packet.c) ◮ wait: poll() Kernel Queuing Device driver Transmission discipline Poll ◮ Notify the kernel ISR about ready messages. CAN controller (HW) M. Sojka, et al. Linux CAN-related system calls WFCS2014 7 / 15

  14. Virtual CAN interface method Single/multiple messages per system call ◮ Comparison of recv() and recvmmsg() system calls ◮ Use of virtual CAN interface (vcan) Application TX socket RX socket read/recv write/send RX queue Kernel af_can.c, raw.c vcan Experiment 1. Send X messages – kernel queues them in an RX queue 2. Receive X messages from the RX queue M. Sojka, et al. Linux CAN-related system calls WFCS2014 8 / 15

  15. Virtual CAN interface method With or without mmsg – results Embedded system (MPC5200B) PC 16 40 450 3000 read read 14 35 400 recvmmsg 2500 recvmmsg 350 12 30 write write 300 2000 Time [ms] 10 sendmmsg 25 Time [ms] sendmmsg 250 8 20 1500 200 6 15 150 1000 4 10 100 500 2 5 50 0 0 0 0 0 5 10 15 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Frames [×1000] Frames [×1000] ◮ recvmmsg 7% faster ◮ recvmmsg 19% faster ◮ sendmmsg 12% faster ◮ sendmmsg 35% faster M. Sojka, et al. Linux CAN-related system calls WFCS2014 9 / 15

  16. Gateway-based method Embedded system used for experiments ◮ PowerPC ◮ Freescale MPC5200B ◮ 400 Mhz ◮ 128 MB RAM ◮ on-chip CAN controller ◮ Linux 3.12.3 M. Sojka, et al. Linux CAN-related system calls WFCS2014 10 / 15

  17. ff Gateway-based method Gateway-based experiments msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  18. ff Gateway-based method Gateway-based experiments msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  19. ff Gateway-based method Gateway-based experiments msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  20. ff Gateway-based method Gateway-based experiments msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  21. ff Gateway-based method Gateway-based experiments msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  22. Gateway-based method Gateway-based experiments Di ff erent implemntations msg 1 CAN bus 0 CAN gateway (Linux) msg 1' CAN bus 1 GW latency Duration time T otal latency RX timestamp 1 RX timestamp 2 M. Sojka, et al. Linux CAN-related system calls WFCS2014 11 / 15

  23. Gateway-based method Results – one message at a time 250 ◮ Blocking system GW latency [µs] 200 calls 150 ◮ Non-blocking/busy 100 waiting ◮ Linux kernel & 50 RTEMS (no Linux) 0 read-write mmap-write mmap-mmap mmsg-mmsg M. Sojka, et al. Linux CAN-related system calls WFCS2014 12 / 15

  24. Gateway-based method Results – one message at a time 250 ◮ Blocking system GW latency [µs] 200 calls 150 ◮ Non-blocking/busy 100 waiting ◮ Linux kernel & 50 RTEMS (no Linux) 0 mmapbusy-mmap mmapbusy-write readnb-write readbusy-write readbusynoirq-write readnb-mmap read-write mmap-write mmap-mmap mmsg-mmsg M. Sojka, et al. Linux CAN-related system calls WFCS2014 12 / 15

  25. Gateway-based method Results – one message at a time 250 ◮ Blocking system GW latency [µs] 200 calls 150 ◮ Non-blocking/busy 100 waiting ◮ Linux kernel & 50 RTEMS (no Linux) 0 rtems kernel mmapbusy-mmap mmapbusy-write readnb-write readbusy-write readbusynoirq-write readnb-mmap read-write mmap-write mmap-mmap mmsg-mmsg M. Sojka, et al. Linux CAN-related system calls WFCS2014 12 / 15

  26. Gateway-based method Results – periodic messages 70 µ s 70 µ s Bitrate: 1 Mbps, Payload: 2 bytes period Median of 3200 frames read-write 20000 10000 GW latency [µs] ± packet loss 5000 2000 1000 500 200 100 50 8-byte frame length 20 120 125 130 135 140 145 150 155 160 Frame period [µs] M. Sojka, et al. Linux CAN-related system calls WFCS2014 13 / 15

  27. Gateway-based method Results – periodic messages 70 µ s 70 µ s Bitrate: 1 Mbps, Payload: 2 bytes period Median of 3200 frames read-write 20000 mmap-write 10000 GW latency [µs] ± packet loss 5000 2000 1000 500 200 100 50 8-byte frame length 20 120 125 130 135 140 145 150 155 160 Frame period [µs] M. Sojka, et al. Linux CAN-related system calls WFCS2014 13 / 15

  28. Gateway-based method Results – periodic messages 70 µ s 70 µ s Bitrate: 1 Mbps, Payload: 2 bytes period Median of 3200 frames read-write 20000 mmap-write mmsg-mmsg 10000 mmap-mmap GW latency [µs] ± packet loss 5000 2000 1000 500 200 100 50 8-byte frame length 20 120 125 130 135 140 145 150 155 160 Frame period [µs] M. Sojka, et al. Linux CAN-related system calls WFCS2014 13 / 15

  29. Gateway-based method Results – periodic messages 70 µ s 70 µ s Bitrate: 1 Mbps, Payload: 2 bytes period Median of 3200 frames read-write 20000 mmap-write mmsg-mmsg 10000 mmap-mmap GW latency [µs] ± packet loss kernel 5000 2000 1000 500 200 100 50 8-byte frame length 20 120 125 130 135 140 145 150 155 160 Frame period [µs] M. Sojka, et al. Linux CAN-related system calls WFCS2014 13 / 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend