Osmo io » History » Version 7
laforge, 03/14/2024 08:05 AM
some more background info.
1 | 1 | laforge | h1. osmo_io |
---|---|---|---|
2 | |||
3 | 3 | laforge | @osmo_io@ is the new (2023) way of ho we do I/O in osmocom projects. It moves from a raw select/poll abstraction (where every application performs its own read/write once the fd becomes readble/writable) to a submission/completion model, where the actual I/O is performed by the library, an the application just submits write requests (as @struct msgb@) and receives write-completion and read-completion call-backs. |
4 | 1 | laforge | |
5 | 7 | laforge | Apart from having more code reuse and a cleaner split between application and I/O library, this has the added advantage that the underlying operating system I/O mechanism can be swapped out without touching each and every application. Specifically, we have currently the following two back-ends implemented in libosmocore: |
6 | * *POLL*: classic osmo_fd based implementation using @poll(2)@ (default) |
||
7 | * *IO_URING*: a backend using the Linux kernel @io_uring(7)@ API |
||
8 | 1 | laforge | |
9 | 7 | laforge | The choice of back-end is done via setting the @LIBOSMO_IO_BACKEND@ environment variable. If you set it to IO_URING when starting an osmocom program, all sub-systems / interfaces ported over to the osmo_io API will make use of the @io_uring(7)@ API (via liburing). |
10 | |||
11 | The main advantage of io_uring is performance. Benchmarking has shown that a classic, poll-based production osmo-bsc loaded with 400 TRX is spending about 40% of its CPU cycles in the system call overhad (sock_poll, tcp_poll and do_sys_poll) and a lot of system call entry/exit in general, due to the many small read/write/recvmsg/sendmsg/recfrom/sendto and poll calls. |
||
12 | |||
13 | For more information, see: |
||
14 | * the original discussion in #5751 |
||
15 | * FIXME |
||
16 | |||
17 | 3 | laforge | API reference at https://ftp.osmocom.org/api/latest/libosmocore/core/html/osmo__io_8c.html#details |
18 | |||
19 | 1 | laforge | h2. Implementation status |
20 | |||
21 | 2 | laforge | The below tables indicate the implementation status of the osmo_io migration: |
22 | 1 | laforge | |
23 | 2 | laforge | h3. Libraries |
24 | |||
25 | 6 | laforge | |_.library/interface|_.protocol|_.transport|_.users|_.commit|_.issue| |
26 | |libosmocore|gsmtap|UDP|everyone|"libosmocore":https://gerrit.osmocom.org/c/libosmocore/+/34743|#6213| |
||
27 | |libosmo-mgcp-client|MGCP|UDP|osmo-bsc, osmo-msc, osmo-hnbgw|"osmo-mgw":https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw/commit/8b524c9151177d681b35332146d7628fafd82846|#5754| |
||
28 | |libosmogb ns2|NS|UDP|osmo-pcu, osmo-gbproxy, osmo-sgsn|"libosmocore":https://gitea.osmocom.org/osmocom/libosmocore/commit/eb9edbab54463cb705ec7b770e022a215ce503c7|#5751| |
||
29 | |libosmo-netif|stream_cli|TCP|libosmo-sigtran(ipa), osmo-bsc(cbsp), osmo-cbc(cbsp)|"libosmo-netif":https://gitea.osmocom.org/osmocom/libosmo-netif/commit/0e7028f742dedefd9fccc2d5b26875fca4036f58|#5753| |
||
30 | |libosmo-netif|stream_cli|SCTP|libosmo-sigtran|"libosmo-netif":https://gitea.osmocom.org/osmocom/libosmo-netif/commit/7e6d2e0f99ff095f4714f03b1ed991d6c9cb9c61|#5753| |
||
31 | |libosmo-sigtran|xUA ASP (SUA, M3UA)|SCTP|osmo-bsc, osmo-msc, osmo-sgsn, osmo-hnbgw, osmo-smlc|"libosmo-sigtran":https://gitea.osmocom.org/osmocom/libosmo-sccp/commit/9257cd896e255403822bee6f87f5487a92fd3c11|#5752| |
||
32 | 2 | laforge | |
33 | h3. Program |
||
34 | |||
35 | 6 | laforge | |_.program|_.Interface/protocol|_.transport|_.commit|_.issue| |
36 | 2 | laforge | |osmo-gbproxy|Gb/NS|UDP|indirect via "libosmogb ns2":https://gitea.osmocom.org/osmocom/libosmocore/commit/eb9edbab54463cb705ec7b770e022a215ce503c7| |
37 | 6 | laforge | |osmo-bsc|CBSP|TCP client+server|"osmo-bsc":https://gitea.osmocom.org/cellular-infrastructure/osmo-bsc/commit/85687bf176e4b9663f2396a27c28b49221c72fa3|#6170| |
38 | 2 | laforge | |osmo-bsc|meas_feed|UDP|"osmo-bsc":https://gitea.osmocom.org/cellular-infrastructure/osmo-bsc/commit/ea388e1db1465afdcfd2796336732d29d80a2b9f| |
39 | 6 | laforge | |osmo-bsc|MGCP|UDP|indirect via libosmo-mgcp-client|#5755| |
40 | |osmo-bsc|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran|#5755| |
||
41 | 1 | laforge | |osmo-hnbgw|MGCP|UDP|indirect via libosmo-mgcp-client| |
42 | 4 | laforge | |osmo-hnbgw|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran| |
43 | 1 | laforge | |osmo-msc|MGCP|UDP|indirect via libosmo-mgcp-client| |
44 | 4 | laforge | |osmo-msc|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran| |
45 | |osmo-sgsn|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran| |
||
46 | |osmo-sgsn|Gb/NS|UDP|indirect via "libosmogb ns2":https://gitea.osmocom.org/osmocom/libosmocore/commit/eb9edbab54463cb705ec7b770e022a215ce503c7| |
||
47 | 1 | laforge | |osmo-smlc|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran| |
48 | |osmo-stp|M3UA/SUA/IPA|SCTP/TCP|indirect via libosmo-sigtran|#5752| |
||
49 | 7 | laforge | |
50 | h2. Further reading |
||
51 | |||
52 | * "wikipedia page on io_uring":https://en.wikipedia.org/wiki/Io_uring |
||
53 | * "Efficient IO with io_uring":https://kernel.dk/io_uring.pdf by the io_uring creator Jens Axboe. |
||
54 | * "io_uring and networking in 2023":https://kernel.dk/io_uring%20and%20networking%20in%202023.pdf |