Software Architecture for a Multiple AVB Listener and Talker Scenario
Total Page:16
File Type:pdf, Size:1020Kb
Software Architecture for a Multiple AVB Listener and Talker Scenario Christoph Kuhr and Alexander Car^ot Department of Computer Sciences and Languages, Anhalt University of Applied Sciences Lohmannstr. 23, 06366 K¨othen, Germany, fchristoph.kuhr, [email protected] Abstract 1.2 Concept for a Realtime Processing Cloud This paper presents a design approach for an AVB network segment deploying two differ- A specialized and scalable server infrastructure ent types of AVB server for multiple paral- is required to provide the realtime streaming re- lel streams. The first type is an UDP proxy quirements of this research project. The ser- server and the second server type is a digital vice time property of an Ethernet frame arriv- signal processing server. The Linux real time ing on a serial network interface at the wide area operating system configurations are discussed, network (WAN) side of this server cloud, is of as well as the software architecture itself and paramount importance for the software design. the integration of the Jack audio server. A During the service time of a single UDP stream proper operation of the JACK server, along- datagram, no concurrent stream datagrams can side two JACK clients, in this multiprocess- be received. Thus, the latencies of all streams ing environment could be shown, although a arriving on such an interface are accumulated. persisting buffer leak prevents significant jitter In addition to connecting the 60 streams to and latency measurements. A coarse assessment each other, the Soundjack cloud provides dig- shows however, that the operations are within ital signal processing algorithms for audio and reasonable bounds. video streams. Digital signal processing is com- putationally expensive and may cause unwanted latencies. Thus, a GPU based signal processing Keywords in realtime will be investigated in this research AVB, JACK, signal processing, public internet, project as well. A basic and scalable concept multimedia streaming to address these two requirements is shown in fig. 1. 1 Introduction Audio Video Bridging / Time-Sensitive Net- working (AVB / TSN) enables computer net- 1.1 Soundjack and fast-music works to handle audio and video streams in real- time. AVB is a set of IEEE 802.1 industry stan- Soundjack [1] is a realtime communication soft- dards, operating on layer 2 of the OSI model [5]. ware that establishes up to five peer to peer connections. This software was designed from a musical point of view and first published in • IEEE 802.1AS [6] in 2009 [2]. Playing live music via the public Timing and Synchronization for Time- internet is very sensitive to latencies. Thus, the Sensitive Applications in Bridged Local main goal of this application is the minimization Area Networks of latencies and jitter. The goal of the research • IEEE 802.1Qat [7] project fast-music, in cooperation with the two Virtual Bridged Local Area Networks - companies GENUIN [3] and Symonics [4], is the Amendment 14: Stream Reservation Pro- development of a rehearsal environment for con- tocol (SRP) ducted orchestras via the public internet. 60 musicians and one conductor shall play together • IEEE 802.1Qav [8] live. Further field of research is the transmission Virtual Bridged Local Area Networks - of low delay live video streams and motion cap- Amendment 12: Forwarding and Queueing turing of the conductor. Enhancements for Time-Sensitive Streams Figure 1: Soundjack Realtime Processing Cloud Concept • IEEE 1722 [9] mediaclock to synchronize the packet transmis- IEEE Standard for Layer 2 Transport Pro- sion times of the AVB servers. Without such tocol for Time-Sensitive Applications in a synchronization, each server would depend on Bridged Local Area Networks the precise clock of an audio interface hardware, • IEEE 1722.1 [10] the CPU clock indicates too much jitter, which IEEE Standard for Layer 2 Transport Pro- in turn would also require a central synchroniza- tocol for Time-Sensitive Applications in tion mechanism to provide a fully mediaclock- Bridged Local Area Networks synchronized network segment. AVB extends a generic Ethernet computer 2 Software Requirements for a network by the means of synchronization, re- Multiple AVB Listener and Talker source reservation and bandwidth shaping. The AVB server software requires a proper con- This way lower latencies and jitter, the avoid- figuration of the operating system and the AVB ance of packet bursts and bandwitdh shortage hardware support, to use the timestamping, are addressed. bandwidth reservation and shaping. A multi- AVB networks require special hardware for processing design, as shown in fig. 2, takes care timestamping Ethernet frames with seperate of all aspects required for multiple independent bandwidth shaped transmission queues for AVB AVB talkers and listeners. traffic. The Intel corporation provides the I2XX Series of NICs with the open source Open-AVB 2.1 Operating System [11] driver. The ability of Linux to communicate with raw Two server types are required for the Sound- sockets [13, p. 655] and also to be patched to jack cloud, an AVB proxy server and an AVB operate in realtime mode, makes it the operat- processing server. Both server types are con- ing system of our choice. We decided to use the nected to the same AVB network segment. Each Linux Mint distribution release 18 Sarah, which server is also connected to a non-AVB network is based on Ubuntu/Debian. Linux Mint 18 uses segment, together with a Soundjack session the Systemd init process, which makes it easier server, which acts as an IEEE 1722.1 AVDECC to dynamically handle OS services. controller endpoint. IEEE 1722.1 AVDECC AVB requires three background services. A traffic is not necessarily time-sensitive, thus a gPTP daemon, a MAAP daemon and a MRP non-AVB network segment is used for command daemon. Each requires super user permissions and control purposes. The Soundjack session for raw socket communication. server also provides the online services to the In addition to the background services, a one- Soundjack client software and handles the con- time-task to unload the generic Intel e1000/IGB nection management of public internet streams, kernel modul and replace it with the Open-AVB establishes peer to peer and client-server con- AVB IGB kernel module is required. The AVB nections. talkers running on the system need the hard- All AVB servers are registered for a me- ware transmit queues of the Intel I210 Ethernet diaclock stream, which is supplied by an NIC to be redirected to the bandwidth shaper XMOS/Atterotech development board [12]. transmit queues, so that the I210 NIC might use The mediaclock stream maintains a constant the FQTSS mechanism for enqueueing AVTP Figure 2: General AVB Server Architecture (MRP, Talker and Listener Processes) packets from the DMA memory. with CBS was specifically developed for mul- The Open-AVB project provides Shell scripts timedia applications [17] [18]. This scheduler to setup those services. does not rely solely on the priority, but assigns The Linux kernel may be patched, con- an absolute deadline and a budget to each task. figured and compiled for realtime operation At each CPU cycle a specific budget is available [14]. A Linux realtime kernel with either the to the scheduler. If a task is out of budget it is SCHED FIFO or the SCHED RR scheduling preempted to ensure the execution of another enabled, handles CPU tasks based on their pri- task. With EDF scheduling however, it is orities. A task requesting the CPU, that is important to avoid deadlocks that result from scheduled by either scheduler, has a latency CPU over-utilization. The kernel has an inbuilt solely depending on tasks with a higher or equal mechanism to minimize the risk, by disabling priority. Examples for tasks that can still delay CPU affinity for EDF-scheduled tasks. the execution of high priority task are DMA bus The kernel we use in this project is main- mastering, ACPI power management, CPU fre- stream release 4.8.6 with the realtime patch quency scaling and hyperthreading techniques 4.8.6-rt5, which takes care of the above men- [15]. These interfering tasks have to be taken tioned realtime mutexes, userspace interrupt into account and carefully tuned, when config- handlers and priority inheritance. Besides uring a realtime Linux system such as: patching the kernel for realtime operation, sev- • Using POSIX realtime mutexes instead of eral optimization steps are performed. Kernel spinlocks. modules for unnesscary hardware support, e.g. most network interface drivers and peripheral • Interrupt handlers are moved to the device drivers were removed. Furthermore, the userspace process. kernel module for NVidia's proprietary graphic • Avoid priority inversion by priority inheri- adpater and CUDA driver was patched to be tance. used with a realtime kernel. Another scheduler was introduced The optimization of the OS mainly concerns in the Linux kernel version 3.14 [16], AVB. Since the AVB implementation requires SCHED DEADLINE. SCHED DEADLINE the Direct Memory Access (DMA) [19, p. 412] is based on the earliest deadline first (EDF) memory for operation, it is required to use scheduling enhanced by the constant bitrate the Memory Management Unit (MMU) in soft server algorithm (CBS). The EDF scheduling mode in /etc/default/grub, so that direct Figure 3: NCurses Shell User Interface hardware addresses are used instead of a virtual and listeners themselves. The creation of talk- address space, when necessary. The parameter ers and listeners is not covered by the AVDECC iommu=soft prevents the usage of the IOMMU standard, thus a vendor specific command and when communicating with the IGB DMA mem- response [10, p. 151] has been implemented. ory, but allows the Focusrite Solo to use it. Status variables and stream states are written to and accessed by a POSIX shared memory seg- GRUB_CMDLINE_LINUX_DEFAULT="text iommu=soft" ment.