PicoTCP for Linux Kernel tinification

Video in TIB AV-Portal: PicoTCP for Linux Kernel tinification

Formal Metadata

PicoTCP for Linux Kernel tinification
Replacing the kernel's stack with picoTCP
Alternative Title
Internet Of Things - Deviot08
Title of Series
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date
Production Year

Content Metadata

Subject Area
Kernel (computing) Kernel (computing) Point cloud Internet der Dinge Operating system Alpha (investment)
Point (geometry) Kernel (computing) Befehlsprozessor Kernel (computing) Quadrilateral Core dump Figurate number Supercomputer Physical system Supercomputer
Presentation of a group Game controller Flash memory Maxima and minima Microcontroller Real-time operating system Revision control Protein folding Peripheral Computer configuration Kernel (computing) Selectivity (electronic) Computing platform Physical system Authentication Addition Graph (mathematics) Flash memory Software developer Maxima and minima Line (geometry) Kernel (computing) Network topology Order (biology) Revision control Configuration space Right angle Whiteboard Synchronous dynamic random-access memory Physical system
Laptop Game controller Code Demo (music) Flash memory Execution unit Set (mathematics) Stack (abstract data type) Neuroinformatik Revision control Shooting method Semiconductor memory Computer configuration Kernel (computing) Data compression Physical system Default (computer science) Demo (music) Flash memory Projective plane Memory management Code Bit Befehlsprozessor Kernel (computing) Internetworking Software Read-only memory Network topology System programming Internet der Dinge Whiteboard Freeware Operating system Spacetime
Laptop Interface (computing) Demo (music) Virtual machine Bit Stack (abstract data type) Line (geometry) Stack (abstract data type) IP address Neuroinformatik Maskenprogrammierung Proof theory Word Kernel (computing) Software Shooting method Kernel (computing) Source code Hill differential equation PRINCE2 Booting
Scheduling (computing) User interface System administrator Source code Water vapor Kernel (computing) Core dump Damping Office suite Physical system Link (knot theory) Mapping Software developer Electronic mailing list Complete metric space Order (biology) Phase transition System programming Figurate number Reading (process) Spacetime Booting Point (geometry) Socket-Schnittstelle Module (mathematics) Addition Computer file Device driver Online help Average Energy level Data structure Communications protocol Implementation Address space Routing Pairwise comparison Focus (optics) Weight Interface (computing) Core dump Computer network Coma Berenices Line (geometry) Limit (category theory) System call Word Software Function (mathematics) Video game Family System call State of matter Code Set (mathematics) Mereology Stack (abstract data type) Network socket Logic Cuboid Flag Rhombus Source code Boss Corporation Email Logical constant Computer file Flickr Proof theory Configuration space Normal (geometry) Website Right angle Energy level Whiteboard Resultant Functional (mathematics) Server (computing) Freeware Link (knot theory) Field (computer science) 2 (number) Revision control Read-only memory Internetworking Operator (mathematics) Utility software Software testing Proxy server Systems engineering Module (mathematics) Projective plane Kernel (computing) Logic Network socket Communications protocol Routing Abstraction
Kernel (computing) Googol Right angle Stack (abstract data type) Flow separation Mathematical optimization
yeah the are Italo everyone at I'm here to talk about who could this be an and how this can help in that vein ification of the Linux kernel and for debt alphas give you some more complex because we're all here to talk about the Internet of Things and about using small embedded devices to good to communicate with each other to communicate with with the cloud and things like that and we've got this great operating system which is Linux and would like to use it as much as possible and I the so this is briefly there
at the government going going to go to and the 1st point is that the problem what what is a problem that we see for using the Linux kernel in the eye i o the what can you do about it but what what did we do about it and how did we do it but so there's this famous for that
says that Linux runs on everything from cell phones to supercomputers and well that's absolutely true uh cellphone nowadays and here the example makes 5 is a cell phone with the 2 . 3 gigahertz CPU it's a quot cough and it has to gigabytes of RAM this is not what what I think of when I'm thinking of a of an embedded device and certain other devices we wanna use and I O T and small sensor nodes and things like that so did next runs on the systems but this is a figure I
stole from another presentation talking about the authentication of the of the Linux kernel and at the bottom line that you can see that year in a corner there's a kernel version 2 . 0 going to tree built 17 at a right hand side of the of the graph and here we can see the minimum kernel size selection it's not really the minimum kernel size and is this is would make all know conflict so to the fold kernel configuration and what we see is that is steadily growing so you kernels getting bigger and bigger with every version you get is a small but there when when the option was introduced to compile out there the TTY but the order of origin that it's always increasing and is not a good thing for a for a tiny tiny embedded systems so what what
is a tiny embedded system what what kind of system and am I thinking about here a 40 example I'd like to be development board from at from and Croft and this so this has the cortex and for microcontroller on 1 from as the as the turned to a 4 is a microcontroller that's being used a lot on tiny embedded systems and because well it's it's cheap it's small muscle of peripheral board runs at 180 megahertz and In addition to this it is my controller on this board the added some has the ramp 3 2 megabytes which is ample you could do with a lot less and 16 megabytes of flash this just to get comfortable with Linux uh and also as a development platform it's it's nice to have a little little overhead but you think actually go a lot smaller uh on on the system and the court exam for his might and all that you would usually run bare-metal of or with the small real-time operating system on here we're gonna run linux-kernel and and what what can you do to run
Linux comfortably on this kind of board 1st of all you have to use you see Linux because this CPU which I just mentioned has no memory management unit that is the 1st step feel you have to use Linux as other interesting an additional features to to run in inner an efficient way on on small embedded systems this also only kernel 2 . 6 and the at least the version we use finances its like in the behind but OK uh and you can do things like executing place so usually kernel gets loaded in the compressed in in your memory in RAM but you don't wanna do that here because you can and read the read-only data anecdote straight from flash despair some RAM that's 1 of the things you can do a read-write will of course still be in in RAM uh but the trade here is that you cannot use Journal compression anymore because you have to execute code in place of another option that was added lately I think somewhere tree . 17 in the kernel is make tiny conflict because there is there is this movement of making this the Linux Journal smaller and this actually introduce some options like using the minus 0 s switch from GCC to to actually get get that journal size down it's not in favor of performance of course but when you need the space you need a space the but then we talk about something else what if we could replace the TCP IP stack em in linux-kernel runs so so many server computers all around world but we're we're trying to to reach the order and of my controls you're not not too big to air not the big servers with with the tens of CPU was gigabytes of memory we would really wanna go to the small side and the disappeared you think it'll external it's not focused or built in for these kind of devices so that's where we come and we we've got this project that still pick it disappeared so it's a free software project uh that's bag by by the company I work for and uh we want we want to promote this tag as the reference that TCP IP stack for the Internet of Things it's a steak that's that's fully featured that there's really a lot of features in there but it's also very modular so you can reuse like every single thing that you want or don't want and and is highly portable it runs on on anything from an 8 bit AVR up to uh the uh 64 bits server computer you can run its insight in uh inside an operating system or just metal and now you can also run it inside the Linux kernel instead of the TCP IP steak that's by default on the linux-kernel
so that's where I'm going to switch to a little demo and the set of is very simple and it's it's not gonna be anything spectacular of is just to show you that it works it's uh this board and with the cortex and for on and uh my laptop connected by indigenous cable and
1st thing i'm gonna do is with with a machine and go into the boot-loader and from the word learning in around uh and that would command which is gonna boots in the kernel with the disappeared thank from the FTP and there it goes it's starting and as you can see it's also putting pretty quickly so that the girls would now and on the last line here is already output from because the which has of uh assigned the loopback interface now I'm going to configure uh ETH 0 to have an IP address and another mosque Ch like this so OK this again is a is it the prince Gay from including saying that it hasn't been assigned for this uh I t so let me now try to being the device from my machine and we see in the that this works of the great uh how can now be sure because we not just putting some random linux-kernel we had some interface for debts uh to the kernel aswell and and just a small uh variable that you can do that again and indeed OK problem abstract is now because TCP instead of the the standard uh TCP IP stack and the last thing I wanna show them all is uh I'm gonna w gets the the binary from from my computer a this is birth which you can use to to monitor network performance gonna start I prefer server online laptop here and can then it connects from the board but but the search Tredegar nite the and this is also we see we still got some work to do we get an average troop with around 1 megabyte sometimes a bit more sometimes a bit less and and this is just a proof of concept for now uh and this is a tool that we use to to to check if the performance this is up to see if it's up to speed or not so OK we start we saw that the kernel uh running to it is disappear and then
explain and why we did this and how we did this so we did is 1st remove the TCP
IP part of the kernel just you know how how big is this and well if you remove all of the networking you you remove about 400 kilobytes of the kernel size with we kept uh the whole networking infrastructure because you you need suckers a local host to do some things as well and also we reused the devices interface from the little but we removed the TCP IP part so I IPV foreign that saves about 160 kilobytes and that's 10 % of the kernel size of running right here then we had consistently that uh also IPV for only and this added 40 kilobytes so that's where we see that the peak disappears made for embedded systems Sony 40 kilobytes and this means that for the same functionality we reduce the kernel by uh more than 100 kilobytes how did we do this so the 1st part is very easy in the kernel of adult conflict you said I need to know but you still need net equals yes so net is the part was talking about this uh providing you do the devices interfaced to transmit packets there we added the new module think the and you get enable its uh by something because this is the because yes and adopt offered and we added the complete because this the Austria's together then find the could this be on get and we add that to the net slash TCP-IP slash because TCP and there we created a cake office so that he can enable this uh we created a file to select the right sources and we modified the original take on Flickr and then we needed some glue logic because we get the these I think it is to be uh in 1 corner and we got the normal limits kernel with its interfaces that was used to use and we need some grew in between of them so the glue logic uh at this we implement these Brock files which I showed you Proc net because the Proc maps stack before the you don't really need problem at stake this a few water uh proc interface that you do need uh also in Proc proxies and then I O CTL so I've city DLs is 1 of the ways you can communicate with the kernel from user space and there's a lot of sockets IOC CTL sexually in the kernel for example to set your Internet as address as edges that would buy coffee so you need you need a bunch of IOC deals which we also added to this glue logic and the these IOC DLs are down then going to be translated to the native speaker TCP uh an API said it understands what the kernel was trying to do or what any tool from user space was trying to do that we need to register the iron protocol family and especially these IPD for uh protocols again because we just remove them by commenting out finance and then another step that we need to take is to modify and that device which is this layer that allows you to communicate real receive and transmit packets to any to any network device uh that the kernel supports and we have to rear out uh the packets to and from the from the peak at TCP status wall so we did all of this and basically 5 files the 6 this still stop for now and I'm not gonna show you actual code but I'm going to go to this file for 5 files and explain you uh what part of this glue logic it implemented you can find all of these files by the way in Linux slash nets slash a TCP IP which is a new forward that didn't exist before so core is the entry point it has the underscore underscore init and this will call because stacked in its which is the initialization reading for a stack and also a f I nets TCP IP in its which is in order module which is gonna registered this address family and is also gonna scheduled because stock data and this is the the clock that there are state needs to be told every once in a while and we do that using the work you in a kernel the next file is a f finance so that's 4 or address family I know and this is gonna register actually be this protocol family again which we have stripped before and using that there's the the structure the kernel like proto ops and there you can set all kinds of fields to the goal box that the kernel is expecting their and uh in this file we also implement all of the BSD is the socket goals that you would normally use on sockets like blind connects and so on so they and they're not actually implemented in this file but they are uh calling the original BIC-TCP API from their uh but using the API to the kernel with expect from these functions next files net death this is the link between the state and the kernels network device abstraction and it's actually really nice because uh we can really reuse any internet or order network a device driver that already exists in the kernel we don't have to rewrite everything from scratch because we just change TCP IP states and this is where the link happens so Beckett Sandbæk entrancement and also the attach function when you're gonna up or down a device that's also where where the link is happening there and then we have I O C T L so that's the IOC DLs to call kernel functions from from user space uh tools such as uh if goldfish are going to use these and here's a few examples of IOC deals that are implemented that's get address uh get empty you set flags things like this last file is Brock adults see and this will implement the proper net routs and you guessed it you will need is the use the rowdy utility so uh proc Nat wrote gonna set or going to give you a list of all the rights that that are configured right now so pick it is to be although it is a very small embedded static uh has IP filtering and routing and things like this set up uh so you can still use all of these features and it also implements the the problem at stake which I get it before they're just present speaker disappear and lost 1 phase don't see so that's not really there right now just the stop uh but we can we implemented this because the RT net link is a is a new while relatively new configuration uh sockets and that's used for example by IP rights to so if you gonna try IT right to on on on this prove concepts Underwood yet but all the stops are there for the article that's are needed and if someone wants to give us a hand as they can implement these and as we get more functionality so To conclude we have more or less the same level of functionality of course is just a proof of concept not everything is there yet but it's perfectly possible especially when you focus on embedded devices I'm not gonna uh let's say that you can use because TCP and run your server on top of this or or at least not not that in a big server farm least for now but for an embedded system uh I don't think you will miss any functionality because picked this p is really very complete you get a small on a foster kernel you get less RAM usage because speaker this piece Taylor forties embedded systems and you get the less Ronnie uh usage as well because yeah the size of the of the kernel at least 120 kilobytes less and and the blue diamond uh I measured here is about 15 % foster it was already pretty falls with no it takes 1 . 0 4 seconds instead of 1 . 23 which is also nice and you get less RAM usage as I said before but here's 1 of the figures out Proc men in full you get 216 kilobytes of actual uh ran that you can use more OK on the system we had 32 megabytes but if you're using uh aboard that only has 4 megabytes and then this is really really important but of course there's still a lot of things to improve and this is just a proof of concept the said before the throughput is average the same word with original linux-kernel go somewhere between 5 and 10 megabits per 2nd and we think it is if you certainly can handle the speeds we have embedded systems running bare-metal they do internet server line speeds 108 when 1 megabits so it's it's a problem with scheduling inside the kernel for now uh . you link API is not not completely yet as I as I stated before and Rostock also or not supported and so what you need Ross sockets for uh for example the commanders gonna use sockets so therefore not a boss the Board will reply to but you cannot send things to order targets uh because that will require all sockets and we don't have them uh and this is likely because because TCP has no role sockets for now and on your hands there's no IP these 6 support yet and that's not because of because TCP because big it is to be uh supports IP 6 very well that's just the like of do logic and more interfaces to make their the and that said
here and put a a bunch of links and myself landmarks in there so I am a low level embedded systems engineer uh the company I work for is L 2 intelligent systems which is also banking the development of the picket TCP an project it's it's a free software is an open-source project and some give up uh on the kernel and I just demonstrated here is also 1 get up here is the link in and because TCP itself is is has a website because he believed doggone you can find on give help as well uh and you can e-mail us again sent some pool at the request for a for this for this kernel we just demonstrated or just right for yourself and that's it for me so if there's any questions about this I'll be glad to answer yeah and and it is the I so how's say visits to expose this tag to the real Internet so we're doing quite some testing and on or steak as part of the project and we're aiming really hard to comply to uh to all our we implement so it should be pretty safe I'm not saying that there is there is no possibility to find some nasty before all floor to pressure board that that is a point for sure but the state is being used in a lot of embedded systems that are connected to the internet just not true linux-kernel for now so we're testing pretty hard on them yes we and and the so and the and we haven't food is so the question is done it is as yet just click had or is it easy to live in order of another state in the in the Linux kernel surprise but what I must say we haven't focused on making the uh the kernel interface to network states very generic because that's not something you wanna do often and especially for other focus was getting it could disappear that in this In the kernel and not OpenID opening up or making the kernel interface as clean as possible to plug in any static so not really know yeah and what yeah you I think it is CP is already stable absolutely and we're very proud of that and you can even check our test results on GitHub wiggling their and but uh the board to the kernel here which administrators is absolutely not very stable no it's a it's a proof of concept absolutely for now but we plan on developing this furhter special because there is some interest on the linux-kernel mailing lists and and things like this for getting there kernel size down to use it on on cortex entry or even smaller systems which is not possible with plain Linux the yeah especially if you will the rest of the world right and right and you yeah you the and yes it is so the question is there has been some projects where uh TCP IP stacks run in user space to get better latency and things like this we did this with the TCP also we we are actually started off as a running this in in user space 1st because it's it's easier to do that but there was still using the device or at that device that to get it out to the actual network stack and we haven't specifically done any latency comparison only on in that field but it was very good from what I remember we get a lot of troop with them and and really good latency are running a complete stake in users and user space and and uh no because at that point we still kept the whole of networking infrastructure that was in the kernel I'm not sure how easy it is to have it done on that device and short all the all the rest of its exercise wouldn't do but it's perfectly possible to run the topic it is at the end user spaces yeah and back I in the and of the and one's life on the and and yes and yes so well I haven't tried only UDP in the Linux kernel but they could disappear would just UDP support should go somewhere near 20 kilobytes and I can't even maybe show you
the a compilation of and the of ticket severe right here OK the size are not great OK TCP still all of it is able to disappear in CIA how big it ends up it and enable you to so there OK it's 50 kilobytes it's weird too I probably missed some optimization on yeah as should be so somewhere around around this yogurt 24 kilobytes right here yes and we want to do the and the yeah yeah our questions a right thanks a lot and if you miss and