Linux Kernel Packet Transmission Performance in High-Speed Networks

Total Page:16

File Type:pdf, Size:1020Kb

Linux Kernel Packet Transmission Performance in High-Speed Networks DEGREE PROJECT IN ELECTRICAL ENGINEERING, SECOND CYCLE, 30 CREDITS STOCKHOLM, SWEDEN 2016 Linux Kernel Packet Transmission Performance in High-speed Networks CLÉMENT BERTIER KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF INFORMATION AND COMMUNICATION TECHNOLOGY Kungliga Tekniska hogskolan¨ Master thesis Linux Kernel packet transmission performance in high-speed networks Cl´ementBertier August 27, 2016 Abstract The Linux Kernel protocol stack is getting more and more additions as time goes by. As new technologies arise, more functions are implemented and might result is a certain amount of bloat. However new methods have been added to the kernel to circumvent common throughput issues and to maximize overall performances, given certain circumstances. To assess the ability of the kernel to produce packets at a given rate, we will use the pktgen tool. Pktgen is a loadable kernel module dedicated to traffic generation based on UDP. Its philosophy was to be in a low position in the kernel protocol stack to minimize the amount of overhead caused by usual APIs. As measurements are usually done in packets per second instead of bandwidth, the UDP protocol makes perfect sense to minimize the amount of time creating a packet. It has several options which will be investigated, and for further insights its transmission algorithm will be analysed. But a software is not just a compiled piece of code, it is a set of instructions ran on top of hardware. And this hardware may or may not comply with the design of one's software, making the execution slower than expected or in extreme cases even not functional. This thesis aims to investigate the maximum capabilities of Linux packet transmissions in high-speed networks, e.g. 10 Gigabits or 40 Gigabits. To go deeper into the understanding of the kernel behaviour during transmission we will use profiling tools, as perf and the newly adopted eBPF framework. Abstract Linux Kernel protokollstacken blir fler och fler till¨aggsom tiden g˚ar.Som ny teknik uppst˚ar,fler funk- tioner har genomf¨ortsoch kan leda till en viss m¨angdsv¨alla.Men nya metoder har lagts till k¨arnanf¨or att kringg˚avanliga genomstr¨omningproblem och att maximera den totala f¨orest¨allningar,med tanke p˚avissa omst¨andigheter. Att fastst¨allaf¨orm˚aganhos k¨arnanf¨oratt producera paket med en given hastighet, kommer vi att anv¨andapktgen verktyget. Pktgen ¨aren laddbar k¨arnmodul till¨agnadtrafik generation baserad p˚aUDP. Dess filosofi var att vara i en l˚agposition i k¨arnanprotokollstacken f¨oratt minimera m¨angdenav overhead orsakad av vanliga API: er. Som m¨atningarnag¨orsvanligtvis i paket per sekund i st¨alletf¨orbandbredd, g¨orUDP-protokollet vettigt att minimera m¨angdentid p˚aatt skapa ett paket. Det har flera alternativ som kommer att unders¨okas, och f¨orytterligare insikter sin s¨andningsalgoritmenkommer att analyseras. Men en programvara ¨arinte bara en kompilerad bit kod, ¨ardet en upps¨attninginstruktioner sprang ovanp˚ah˚ardvara. Och den h¨armaskinvaran kan eller inte kan f¨oljamed utformningen av en program- vara, vilket g¨orutf¨orandetl˚angsammare¨anv¨antat eller i extrema fall ¨aven fungerar inte. Denna avhandling syftar till att unders¨oka de maximala kapacitet Linux pakets¨andningari h¨oghastighetsn¨at, t.ex. 10 gigabit eller 40 Gigabit. F¨oratt g˚adjupare in i f¨orst˚aelsenav k¨arnanbeteende under ¨overf¨oringen kommer vi att anv¨andaprofilverktyg, som perf och det nyligen antagna ramen eBPF. Contents 1 Introduction 5 1.1 Problem . .6 1.2 Methodology . .6 1.3 Goal . .7 1.4 Sustainability and ethics . .7 1.5 Delimitation . .7 1.6 Outline . .7 2 Background 9 2.1 Computer hardware architecture . 10 2.1.1 CPU . 10 2.1.2 SMP . 11 2.1.3 NUMA . 11 2.1.4 DMA . 11 2.1.5 Ethernet . 11 2.1.6 PCIe . 13 2.1.7 Networking terminology . 14 2.2 Linux . 15 2.2.1 OS Architecture design . 15 2.2.2 /proc pseudo-filesystem . 16 2.2.3 Socket Buffers . 17 2.2.4 xmit more API . 18 2.2.5 NIC drivers . 18 2.2.6 Queuing in the networking stack . 19 2.3 Related work { Traffic generators . 20 2.3.1 iPerf . 20 2.3.2 KUTE . 20 2.3.3 PF RING......................................... 20 2.3.4 Netmap . 20 2.3.5 DPDK . 21 2.3.6 Moongen . 21 2.3.7 Hardware solutions . 21 2.4 Pktgen . 22 2.4.1 pktgen flags . 22 2.4.2 Commands . 23 2.4.3 Transmission algorithm . 24 2.4.4 Performance checklist . 27 2.5 Related work { Profiling . 28 2.5.1 perf . 28 2.5.2 eBPF . 29 1 3 Methodology 33 3.1 Data yielding . 33 3.2 Data evaluation . 34 3.3 Linear statistical correlation . 34 4 Experimental setup 35 4.1 Speed advertisement . 35 4.2 Hardware used . 36 4.2.1 Machine A { KTH . 36 4.2.2 Machine B { KTH . 37 4.2.3 Machine C { Ericsson . 38 4.2.4 Machine D { Ericsson . 39 4.3 Choice of Linux distribution . 40 4.4 Creating a virtual development environment . 40 4.5 Empirical testing of settings . 41 4.6 Creation of an interface for pktgen . 41 4.7 Enhancing the system for pktgen . 43 4.8 pktgen parameters clone conflict . 44 5 eBPF Programs with BCC 45 5.1 Introduction . 45 5.2 kprobes . 45 5.3 Estimation of driver transmission function execution time . 46 6 Results 49 6.1 Settings tuning . 49 6.1.1 Influence of kernel version . 49 6.1.2 Optimal pktgen settings . 49 6.1.3 Influence of ring size . 52 6.2 Evidence of faulty hardware . 53 6.3 Study of the packet size scalability . 54 6.3.1 Problem detection . 54 6.3.2 Profiling with perf . 55 6.3.3 Driver latency estimation with eBPF . 56 7 Conclusion 58 7.1 Future work . 58 A Bifrost install 62 A.1 How to create a bifrost distribution . 62 A.2 Compile and install a kernel for bifrost . 63 B Scripts 64 C Block diagrams 66 2 List of Figures 2.1 Caches location in a 2-core CPU. 10 2.2 Theoretical limits of the link according to packet size on a 10G link. 12 2.3 Theoretical limits of the link according to packet size on a 40G link. 13 2.4 Tux, the mascot of Linux . 15 2.5 Overview of the kernel [4] . 16 2.6 How pointers are mapped to retrieve data within the socket buffer [18]. 17 2.7 Example of a shell command to interact with pktgen. 22 2.8 pktgen transmission algorithm . ..
Recommended publications
  • Administració De Sistemes GNU Linux Mòdul4 Administració
    Administració local Josep Jorba Esteve PID_00238577 GNUFDL • PID_00238577 Administració local Es garanteix el permís per a copiar, distribuir i modificar aquest document segons els termes de la GNU Free Documentation License, Version 1.3 o qualsevol altra de posterior publicada per la Free Software Foundation, sense seccions invariants ni textos de la oberta anterior o posterior. Podeu consultar els termes de la llicència a http://www.gnu.org/licenses/fdl-1.3.html. GNUFDL • PID_00238577 Administració local Índex Introducció.................................................................................................. 5 1. Eines bàsiques per a l'administrador........................................... 7 1.1. Eines gràfiques i línies de comandes .......................................... 8 1.2. Documents d'estàndards ............................................................. 10 1.3. Documentació del sistema en línia ............................................ 13 1.4. Eines de gestió de paquets .......................................................... 15 1.4.1. Paquets TGZ ................................................................... 16 1.4.2. Fedora/Red Hat: paquets RPM ....................................... 19 1.4.3. Debian: paquets DEB ..................................................... 24 1.4.4. Nous formats d'empaquetat: Snap i Flatpak .................. 28 1.5. Eines genèriques d'administració ................................................ 36 1.6. Altres eines .................................................................................
    [Show full text]
  • Storage Administration Guide Storage Administration Guide SUSE Linux Enterprise Server 12 SP4
    SUSE Linux Enterprise Server 12 SP4 Storage Administration Guide Storage Administration Guide SUSE Linux Enterprise Server 12 SP4 Provides information about how to manage storage devices on a SUSE Linux Enterprise Server. Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see https://www.suse.com/company/legal/ . All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its aliates. Asterisks (*) denote third-party trademarks. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xii 1 Available Documentation xii 2 Giving Feedback xiv 3 Documentation Conventions xiv 4 Product Life Cycle and Support xvi Support Statement for SUSE Linux Enterprise Server xvii • Technology Previews xviii I FILE SYSTEMS AND MOUNTING 1 1 Overview
    [Show full text]
  • Interrupt Handling in Linux
    Department Informatik Technical Reports / ISSN 2191-5008 Valentin Rothberg Interrupt Handling in Linux Technical Report CS-2015-07 November 2015 Please cite as: Valentin Rothberg, “Interrupt Handling in Linux,” Friedrich-Alexander-Universitat¨ Erlangen-Nurnberg,¨ Dept. of Computer Science, Technical Reports, CS-2015-07, November 2015. Friedrich-Alexander-Universitat¨ Erlangen-Nurnberg¨ Department Informatik Martensstr. 3 · 91058 Erlangen · Germany www.cs.fau.de Interrupt Handling in Linux Valentin Rothberg Distributed Systems and Operating Systems Dept. of Computer Science, University of Erlangen, Germany [email protected] November 8, 2015 An interrupt is an event that alters the sequence of instructions executed by a processor and requires immediate attention. When the processor receives an interrupt signal, it may temporarily switch control to an inter- rupt service routine (ISR) and the suspended process (i.e., the previously running program) will be resumed as soon as the interrupt is being served. The generic term interrupt is oftentimes used synonymously for two terms, interrupts and exceptions [2]. An exception is a synchronous event that occurs when the processor detects an error condition while executing an instruction. Such an error condition may be a devision by zero, a page fault, a protection violation, etc. An interrupt, on the other hand, is an asynchronous event that occurs at random times during execution of a pro- gram in response to a signal from hardware. A proper and timely handling of interrupts is critical to the performance, but also to the security of a computer system. In general, interrupts can be emitted by hardware as well as by software. Software interrupts (e.g., via the INT n instruction of the x86 instruction set architecture (ISA) [5]) are means to change the execution context of a program to a more privileged interrupt context in order to enter the kernel and, in contrast to hardware interrupts, occur synchronously to the currently running program.
    [Show full text]
  • User Manual Issue 2.0.2 September 2017
    The Embedded I/O Company TDRV015-SW-82 Linux Device Driver Reconfigurable FPGA Version 2.0.x User Manual Issue 2.0.2 September 2017 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany Phone: +49 (0) 4101 4058 0 Fax: +49 (0) 4101 4058 19 e-mail: [email protected] www.tews.com TDRV015-SW-82 This document contains information, which is Linux Device Driver proprietary to TEWS TECHNOLOGIES GmbH. Any Reconfigurable FPGA reproduction without written permission is forbidden. Supported Modules: TEWS TECHNOLOGIES GmbH has made any TAMC631 (TPLD001) effort to ensure that this manual is accurate and TAMC640 (TPLD002) complete. However TEWS TECHNOLOGIES GmbH TAMC641 (TPLD003) reserves the right to change the product described TAMC651 (TPLD004) in this document at any time without notice. TPMC632 (TPLD005) TEWS TECHNOLOGIES GmbH is not liable for any damage arising out of the application or use of the device described herein. 2011-2017 by TEWS TECHNOLOGIES GmbH Issue Description Date 1.0.0 First Issue March 14, 2011 1.0.1 SupportedModulesadded September30,2011 2.0.0 New API implemented March 7, 2012 2.0.1 IncludestatementinExampleCodescorrected August 18, 2015 Reference to Engineering Documentation removed 2.0.2 Filelistmodified(licenseadded) September28,2017 TDRV015-SW-82 - Linux Device Driver Page 2 of 75 Table of Contents 1 INTRODUCTION......................................................................................................... 4 2 INSTALLATION.........................................................................................................
    [Show full text]
  • USB Composite Gadget Using CONFIG-FS on Dra7xx Devices
    Application Report SPRACB5–September 2017 USB Composite Gadget Using CONFIG-FS on DRA7xx Devices RaviB ABSTRACT This application note explains how to create a USB composite gadget, network control model (NCM) and abstract control model (ACM) from the user space using Linux® CONFIG-FS on the DRA7xx platform. Contents 1 Introduction ................................................................................................................... 2 2 USB Composite Gadget Using CONFIG-FS ............................................................................. 3 3 Creating Composite Gadget From User Space.......................................................................... 4 4 References ................................................................................................................... 8 List of Figures 1 Block Diagram of USB Composite Gadget............................................................................... 3 2 Selection of CONFIGFS Through menuconfig........................................................................... 4 3 Select USB Configuration Through menuconfig......................................................................... 4 4 Composite Gadget Configuration Items as Files and Directories ..................................................... 5 5 VID, PID, and Manufacturer String Configuration ....................................................................... 6 6 Kernel Logs Show Enumeration of USB Composite Gadget by Host ................................................ 6 7 Ping
    [Show full text]
  • Faux Disk Encryption: Realities of Secure Storage on Mobile Devices August 4, 2015 – Version 1.0
    NCC Group Whitepaper Faux Disk Encryption: Realities of Secure Storage On Mobile Devices August 4, 2015 – Version 1.0 Prepared by Daniel A. Mayer — Principal Security Consultant Drew Suarez — Senior Security Consultant Abstract In this paper, we discuss the challenges mobile app developers face in securing data stored on devices including mobility, accessibility, and usability requirements. Given these challenges, we first debunk common misconceptions about full-disk encryption and show why it is not sufficient for many attack scenarios. We then systematically introduce the more sophisticated secure storage techniques that are available for iOS and Android respectively. For each platform, we discuss in-depth which mechanisms are available, how they technically operate, and whether they fulfill the practical security and usability requirements. We conclude the paper with an analysis of what still can go wrong even when current best-practices are followed and what the security and mobile device community can do to address these shortcomings. Table of Contents 1 Introduction ......................................................................... 3 2 Challenges in Secure Mobile Storage .................................................. 4 3 Threat Model Considerations ......................................................... 5 4 Secure Data Storage on iOS .......................................................... 6 4.1 Fundamentals of iOS Data Protection .................................................. 7 4.2 Filesystem Encryption ..............................................................
    [Show full text]
  • Linux Kernel and Driver Development Training Slides
    Linux Kernel and Driver Development Training Linux Kernel and Driver Development Training © Copyright 2004-2021, Bootlin. Creative Commons BY-SA 3.0 license. Latest update: October 9, 2021. Document updates and sources: https://bootlin.com/doc/training/linux-kernel Corrections, suggestions, contributions and translations are welcome! embedded Linux and kernel engineering Send them to [email protected] - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 1/470 Rights to copy © Copyright 2004-2021, Bootlin License: Creative Commons Attribution - Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0/legalcode You are free: I to copy, distribute, display, and perform the work I to make derivative works I to make commercial use of the work Under the following conditions: I Attribution. You must give the original author credit. I Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. I For any reuse or distribution, you must make clear to others the license terms of this work. I Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. Document sources: https://github.com/bootlin/training-materials/ - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 2/470 Hyperlinks in the document There are many hyperlinks in the document I Regular hyperlinks: https://kernel.org/ I Kernel documentation links: dev-tools/kasan I Links to kernel source files and directories: drivers/input/ include/linux/fb.h I Links to the declarations, definitions and instances of kernel symbols (functions, types, data, structures): platform_get_irq() GFP_KERNEL struct file_operations - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 3/470 Company at a glance I Engineering company created in 2004, named ”Free Electrons” until Feb.
    [Show full text]
  • Linux Kernal II 9.1 Architecture
    Page 1 of 7 Linux Kernal II 9.1 Architecture: The Linux kernel is a Unix-like operating system kernel used by a variety of operating systems based on it, which are usually in the form of Linux distributions. The Linux kernel is a prominent example of free and open source software. Programming language The Linux kernel is written in the version of the C programming language supported by GCC (which has introduced a number of extensions and changes to standard C), together with a number of short sections of code written in the assembly language (in GCC's "AT&T-style" syntax) of the target architecture. Because of the extensions to C it supports, GCC was for a long time the only compiler capable of correctly building the Linux kernel. Compiler compatibility GCC is the default compiler for the Linux kernel source. In 2004, Intel claimed to have modified the kernel so that its C compiler also was capable of compiling it. There was another such reported success in 2009 with a modified 2.6.22 version of the kernel. Since 2010, effort has been underway to build the Linux kernel with Clang, an alternative compiler for the C language; as of 12 April 2014, the official kernel could almost be compiled by Clang. The project dedicated to this effort is named LLVMLinxu after the LLVM compiler infrastructure upon which Clang is built. LLVMLinux does not aim to fork either the Linux kernel or the LLVM, therefore it is a meta-project composed of patches that are eventually submitted to the upstream projects.
    [Show full text]
  • Singularityce User Guide Release 3.8
    SingularityCE User Guide Release 3.8 SingularityCE Project Contributors Aug 16, 2021 CONTENTS 1 Getting Started & Background Information3 1.1 Introduction to SingularityCE......................................3 1.2 Quick Start................................................5 1.3 Security in SingularityCE........................................ 15 2 Building Containers 19 2.1 Build a Container............................................. 19 2.2 Definition Files.............................................. 24 2.3 Build Environment............................................ 35 2.4 Support for Docker and OCI....................................... 39 2.5 Fakeroot feature............................................. 79 3 Signing & Encryption 83 3.1 Signing and Verifying Containers.................................... 83 3.2 Key commands.............................................. 88 3.3 Encrypted Containers.......................................... 90 4 Sharing & Online Services 95 4.1 Remote Endpoints............................................ 95 4.2 Cloud Library.............................................. 103 5 Advanced Usage 109 5.1 Bind Paths and Mounts.......................................... 109 5.2 Persistent Overlays............................................ 115 5.3 Running Services............................................. 118 5.4 Environment and Metadata........................................ 129 5.5 OCI Runtime Support.......................................... 140 5.6 Plugins.................................................
    [Show full text]
  • Oracle® Linux 7 Managing File Systems
    Oracle® Linux 7 Managing File Systems F32760-07 August 2021 Oracle Legal Notices Copyright © 2020, 2021, Oracle and/or its affiliates. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract.
    [Show full text]
  • Unionfs: User- and Community-Oriented Development of a Unification File System
    Unionfs: User- and Community-Oriented Development of a Unification File System David Quigley, Josef Sipek, Charles P. Wright, and Erez Zadok Stony Brook University {dquigley,jsipek,cwright,ezk}@cs.sunysb.edu Abstract If a file exists in multiple branches, the user sees only the copy in the higher-priority branch. Unionfs allows some branches to be read-only, Unionfs is a stackable file system that virtually but as long as the highest-priority branch is merges a set of directories (called branches) read-write, Unionfs uses copy-on-write seman- into a single logical view. Each branch is as- tics to provide an illusion that all branches are signed a priority and may be either read-only writable. This feature allows Live-CD develop- or read-write. When the highest priority branch ers to give their users a writable system based is writable, Unionfs provides copy-on-write se- on read-only media. mantics for read-only branches. These copy- on-write semantics have lead to widespread There are many uses for namespace unifica- use of Unionfs by LiveCD projects including tion. The two most common uses are Live- Knoppix and SLAX. In this paper we describe CDs and diskless/NFS-root clients. On Live- our experiences distributing and maintaining CDs, by definition, the data is stored on a read- an out-of-kernel module since November 2004. only medium. However, it is very convenient As of March 2006 Unionfs has been down- for users to be able to modify the data. Uni- loaded by over 6,700 unique users and is used fying the read-only CD with a writable RAM by over two dozen other projects.
    [Show full text]
  • ODROID-HC2: 3.5” High Powered Storage  February 1, 2018
    ODROID WiFi Access Point: Share Files Via Samba February 1, 2018 How to setup an ODROID with a WiFi access point so that an ODROID’s hard drive can be accessed and modied from another computer. This is primarily aimed at allowing access to images, videos, and log les on the ODROID. ODROID-HC2: 3.5” High powered storage February 1, 2018 The ODROID-HC2 is an aordable mini PC and perfect solution for a network attached storage (NAS) server. This device home cloud-server capabilities centralizes data and enables users to share and stream multimedia les to phones, tablets, and other devices across a network. It is an ideal tool for many use Using SquashFS As A Read-Only Root File System February 1, 2018 This guide describes the usage of SquashFS PiFace: Control and Display 2 February 1, 2018 For those who have the PiFace Control and Display 2, and want to make it compatible with the ODROID-C2 Android Gaming: Data Wing, Space Frontier, and Retro Shooting – Pixel Space Shooter February 1, 2018 Variations on a theme! Race, blast into space, and blast things into pieces that are racing towards us. The fun doesn’t need to stop when you take a break from your projects. Our monthly pick on Android games. Linux Gaming: Saturn Games – Part 1 February 1, 2018 I think it’s time we go into a bit more detail about Sega Saturn for the ODROID-XU3/XU4 Gaming Console: Running Your Favorite Games On An ODROID-C2 Using Android February 1, 2018 I built a gaming console using an ODROID-C2 running Android 6 Controller Area Network (CAN) Bus: Implementation
    [Show full text]