Implementation and Performance Analysis of Precision Time Protocol on Linux Based System-On-Chip Platform
Total Page:16
File Type:pdf, Size:1020Kb
Implementation and Performance Analysis of Precision Time Protocol on Linux based System-On-Chip Platform Mudassar Ahmed [email protected] MASTERPROJECT Kiel University of Applied Science MSc. Information Engineering in Kiel im Mai 2018 Declaration I hereby declare and confirm that this project is entirely the result of my own original work. Where other sources of information have been used, they have been indicated as such and properly acknowledged. I further declare that this or similar work has not been submitted for credit elsewhere. Kiel, May 9, 2018 Mudassar Ahmed [email protected] i Contents Declaration i Abstract iv List of Symbols and Abbreviations vii 1 Introduction 1 1.1 Research Objectives and Goals . 2 1.2 Approach . 2 1.3 Outline . 2 2 Literature Review 3 2.1 Time Synchronization . 3 2.2 Time Synchronization Technologies . 4 2.3 Overview of IEEE 1588 Precision Time Protocol (PTP) . 4 2.3.1 Scope of PTP Standard: . 5 2.3.2 Protocol Standard Messages . 5 2.3.3 Protocol Standard Devices . 6 2.3.4 Message Exchange and Delay Computation . 7 2.3.5 Protocol Hierarchy Establishment Mechanism . 9 3 PTP Infrastructure in Linux 11 3.1 Timestamping Mechanisms . 11 3.1.1 Software Timestamping . 11 3.1.2 Hardware Timestamping . 12 3.1.3 Linux kernel Support for Timestamping . 13 3.2 PTP Clock Infrastructure and Control API . 14 4 Design and Implementation 16 4.1 Tools and technologies . 16 4.1.1 LinuxPTP . 16 4.1.2 PTPd . 18 4.1.3 stress-ng . 18 4.1.4 iPerf . 18 4.1.5 Matlab . 18 4.1.6 Beaglebone Black . 18 ii Contents iii 4.2 Design Consideration and System Hierarchy . 19 5 Test and Measurements 20 5.1 Test Case Scenarios . 21 5.1.1 Software Timestamping . 21 5.1.2 Hardware Timestamping . 23 5.1.3 Comparison of Software and Hardware based Synchronization . 26 5.1.4 Hardware Assisted Time Synchronization under CPU Load . 27 5.1.5 Hardware Assisted Time Synchronization under I/O Load . 29 5.1.6 Hardware Assisted Time Synchronization under Network Load . 30 6 Conclusion 34 6.1 Improvements and Future Work . 34 A Appendix: Technical Details 36 B Appendix: Installation Guide 38 C Appendix: Additional Tests and Measurements 44 References 47 Literature . 47 Online sources . 48 Abstract Associated control and measurement applications require time synchronization and many embedded systems have on-board sense of time. The specific clock in a networked system needs to be checked whether the time deviation is acceptable for the particular application or there is a need for correction in time. So, parallel to control and measure- ment related communication there is a strong need for clock communication between system nodes. The Precision Time Protocol (PTP) specified in IEEE 1588-2008 standard is aself- organizing and optionally hardware supported time synchronization protocol, the proto- col operates on master/slave hierarchy on local area networked devices and provides the opportunity to achieve the sub-microsecond level accuracy on existing multicast sup- ported LAN network. The PTP protocol does not require additional physical network infrastructure to establish PTP network, it uses existing LAN network infrastructure. It is possible that the existing applications running on same system node or in overall network may affect the performance of the PTP clock synchronization process. The project aimed to implement and analyze the PTP protocol on hardware-assisted IEEE 1588 clock based system-on-chip platform (Beaglebone) by using an open-source solution. The document summarizes PTP protocol and PTP infrastructure in Linux, and it represents the comparison between software and hardware assist PTP implementation. In order to analyze the performance and behavior of established PTP network, multiple tools are used to simulate the load scenario in different dimensions (CPU, I/O and Network). iv List of Figures 2.1 PTP Transparent Clock [9] . 6 2.2 PTP Delay Request-Response Mechanism (End-to-End) [14] . 8 2.3 PTP Peer delay Mechanism [11] . 9 3.1 Software Timestamping . 12 3.2 Hardware Timestamping . 13 3.3 PTP Infrastructure in Linux [7] . 15 3.4 PHC API features [7] . 15 4.1 PTP Clock based Time Synchronization in Linux [15] . 17 4.2 LinuxPTP based Hardware Assisted Time Synchronization . 18 4.3 Architecture of Test Environment . 19 5.1 Timestamping Capabilities of Beaglebone . 20 5.2 Software Timestamping based Time Synchronization I . 22 5.3 Software Timestamping based Time Synchronization II . 22 5.4 Precision of Software based PTP Implementations . 23 5.5 Hardware Timestamping based Time Synchronization . 24 5.6 Hardware Timestamping based Time Synchronization (Multiple Slaves) 25 5.7 Hardware Timestamping based Time Synchronization (Single Slave) . 25 5.8 Precision of Hardware based PTP Implementation . 26 5.9 Comparison of Software and Hardware based Synchronization . 27 5.10 Hardware Assisted Time Synchronization under CPU Load . 28 5.11 Precision of Hardware Assisted Time Synchronization under CPU Load 28 5.12 Hardware Assisted Time Synchronization under I/O Load . 29 5.13 Hardware Assisted Time Synchronization under Network Load . 30 5.14 Hardware Assisted Time Synchronization under Network Load (Low) . 31 5.15 Precision of Hardware Assisted Time Synchronization under Network Load (Low) . 31 5.16 Hardware Assisted Time Synchronization under Network Load (High) . 32 5.17 Precision of Hardware Assisted Time Synchronization under Network Load (High) . 33 A.1 Beaglebone Black Key Components . 36 A.2 Beaglebone Black Features . 37 v List of Figures vi B.1 Output of Yocto build . 41 List of Symbols and Abbreviations PTP: Precision Time Protocol NTP: Network Time Protocol GPS : Global Positioning System SoC : System-On-Chip BBB : BeagleBone Black TTP : Time-Triggered Protocol IEEE :Institute of Electrical and Electronics Engineers UDP : User Datagram Protocol GM : Grand Master Clock OC : Ordinary Clock BC : Boundary Clock TC : Transparent Clock BMCA : Best Master Clock Algorithm PHC : PTP Hardware Clock API : Application programming interface OS : Operating System LAN : Local Area Network ns : Nano-Second us : Micro-Second ms : Mili-Second sec : Second POSIX : Portable Operating System Interface Mb : Megabits ioctl : input/output control vii Chapter 1 Introduction Continuous transformation of computer systems from large-scale isolated units to ap- plication specific distributed units is rising the challenge of time synchronization dueto their associated and time-critical actions. These kinds of transformation can clearly be seen in many industries like, automation, distributed measurement systems and power distribution systems. Several solutions like GPS and NTP emerged to overcome synchro- nization challenges. As the large-scale distributed systems are becoming more complex and modular, where each distributed module/node is communicating via standardized communication medium, the demand for precision and accuracy of time synchroniza- tion is increasing, while existing solutions are either limited in term of synchronization accuracy or requires specialized additional hardware and operational support to ensure the common time in distributed nodes. On the other hand, installation of additions time keeping networks and devices makes the system more complex and increases the troubleshooting and maintenance problems. IEEE 1588 Precision Time Protocol (PTP) developed to overcome these challenges, it provides the self-organizing time synchronization protocol while utilizing the existing system for timekeeping applications. The widespread adaptation of IEEE 1588 Preci- sion Time Protocol (PTP) is not just limited to industrial automation and measurement systems, the integration of PTP is also realized and standardized in many leading tech- nologies/sectors like Audio-Video Bridging, Smart Power Grids and Financial Systems. Due to widespread recognition of PTP, the silicon vendors are also offering on-board sense of time support with hardware-assisted timestamping capabilities for the wide variety of embedded solutions. Additionally, PTP hardware support in mainline Linux kernel is becoming a catalyst in the development and adaptation of Linux based software solution for time synchronization applications in different sectors. Advanced features of System-on-Chip (SoC) platforms are becoming a powerful tool to implement the different industrial solution as a prototype and PTP community is providing continuous support for PTP software solutions for Linux based SoC devices, which are having Hardware timestamping capabilities but these applications are devel- oped for Linux like operating systems. So, different Linux kernel level resource scheduling procedures can effect the time timestamping process. The source of these latencies can be other resource exhausting applications running on the same system. In some cases, these resource exhausting applications cannot be avoided as an overall system. In this project, PTP protocol is implemented on SoC platform on which the PTP hardware 1 1. Introduction 2 capabilities are enabled by using Linux kernel PHC API and hardware timestamping socket option. An opensource PTP solution is used to establish the PTP network for further analysis. 1.1 Research Objectives and Goals Goals • Enabling Hardware timestamping capabilities of Linux bases SoC Platform (Bea- gleBone Black). • Analyzing the behavior of open source software solution for PTP implementation, while simulating different load scenarios (Network load, Processing load) inLinux OS. Research Objectives/Questions • Analysis of precision