jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/40855?usp=email )
Change subject: Remove old empty io_uring
......................................................................
Remove old empty io_uring
A previous patch creates a new io_uring, if it becomes too small to
store all SQEs. When all SQEs of the old ring are completed, the old
ring will be destroyed.
A counter is incremented whenever an SQE is submitted to an io_uring.
The counter is decrements whenever a CQE is received and handled. This
counter will determine when a ring is empty and can be destroyed.
Related: OS#6705
Change-Id: Id2d2a0400ad442198c684ea0ead4eaeaead4c53d
---
M src/core/osmo_io_uring.c
1 file changed, 27 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/40855/1
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index 1a817dd..a867968 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -65,7 +65,7 @@
bool g_io_uring_batch = false;
bool g_io_uring_submit_needed = false;
-static unsigned int g_io_uring_size = IOFD_URING_INITIAL_SIZE;
+static int g_io_uring_size = IOFD_URING_INITIAL_SIZE;
static int g_io_uring_read_sqes = 1;
@@ -73,6 +73,7 @@
struct osmo_fd event_ofd;
struct io_uring ring;
struct llist_head cancel_queue;
+ unsigned int in_flight;
};
static __thread struct osmo_io_uring *g_ring = NULL;
@@ -167,13 +168,27 @@
}
}
+static void osmo_iofd_uring_exit(struct osmo_io_uring *ring)
+{
+ LOGP(DLIO, LOGL_DEBUG, "Old empty io_uring will be destroyed.");
+
+ io_uring_queue_exit(&ring->ring);
+
+ osmo_fd_unregister(&ring->event_ofd);
+ close(ring->event_ofd.fd);
+
+ talloc_free(ring);
+}
+
static struct io_uring_sqe *iofd_uring_get_sqe(bool current_ring)
{
struct io_uring_sqe *sqe;
sqe = io_uring_get_sqe(&g_ring->ring);
- if (sqe)
+ if (sqe) {
+ g_ring->in_flight++;
return sqe;
+ }
if (g_io_uring_size < IOFD_URING_MAXIMUM_SIZE) {
LOGP(DLIO, LOGL_NOTICE, "io_uring too small to handle all SQEs with its current size of %d. "
@@ -197,6 +212,7 @@
sqe = io_uring_get_sqe(&g_ring->ring);
OSMO_ASSERT(sqe);
+ g_ring->in_flight++;
return sqe;
}
@@ -424,6 +440,7 @@
struct osmo_io_uring *orig_ring = container_of(ring, struct osmo_io_uring, ring);
while (io_uring_peek_cqe(ring, &cqe) == 0) {
+ orig_ring->in_flight--;
msghdr = io_uring_cqe_get_data(cqe);
if (!msghdr) {
@@ -448,13 +465,18 @@
}
/* If there are unsubmitted cancel SQEs, try to queue them now. */
- if (OSMO_LIKELY(llist_empty(&orig_ring->cancel_queue)))
+ if (OSMO_LIKELY(llist_empty(&orig_ring->cancel_queue))) {
+ /* Old ring is empty, remove it. */
+ if (OSMO_UNLIKELY(orig_ring != g_ring && orig_ring->in_flight == 0))
+ osmo_iofd_uring_exit(orig_ring);
return;
+ }
llist_for_each_entry_safe(msghdr, msghdr2, &orig_ring->cancel_queue, list) {
struct io_uring_sqe *sqe;
sqe = io_uring_get_sqe(&orig_ring->ring);
if (!sqe)
break;
+ orig_ring->in_flight++;
io_uring_sqe_set_data(sqe, NULL);
LOGP(DLIO, LOGL_DEBUG, "Cancelling queued read/write\n");
io_uring_prep_cancel(sqe, msghdr, 0);
@@ -462,7 +484,6 @@
msghdr->in_cancel_queue = false;
}
io_uring_submit(&orig_ring->ring);
-
}
/*! will submit the next to-be-transmitted message for given iofd */
@@ -584,6 +605,7 @@
/* If the submission queue is full, use cancel queue. We cannot cancel SQEs on the new ring. */
sqe = io_uring_get_sqe(&ring->ring);
if (sqe) {
+ ring->in_flight++;
io_uring_sqe_set_data(sqe, NULL);
LOGPIO(iofd, LOGL_DEBUG, "Cancelling read\n");
io_uring_prep_cancel(sqe, msghdr, 0);
@@ -614,6 +636,7 @@
/* If the submission queue is full, use cancel queue. We cannot cancel SQEs on the new ring. */
sqe = io_uring_get_sqe(&ring->ring);
if (sqe) {
+ ring->in_flight++;
io_uring_sqe_set_data(sqe, NULL);
LOGPIO(iofd, LOGL_DEBUG, "Cancelling write\n");
io_uring_prep_cancel(sqe, msghdr, 0);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40855?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id2d2a0400ad442198c684ea0ead4eaeaead4c53d
Gerrit-Change-Number: 40855
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Attention is currently required from: jolly, laforge, pespin.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email
to look at the new patch set (#10).
The following approvals got outdated and were removed:
Code-Review+2 by pespin, Verified+1 by Jenkins Builder
The change is no longer submittable: Code-Review and Verified are unsatisfied now.
Change subject: Add multiple messages buffers to struct iofd_msghdr
......................................................................
Add multiple messages buffers to struct iofd_msghdr
This is a prerequisite for transfering multiple buffers with a single
SQE or CQE when using osmo_io with io_uring.
The message buffers at struct iofd_msghr, as well as the io vectors are
arrays. A maximum number is stored, as well as the current number.
As this patch does not implement multiple buffers yet, only index 0 of a
message buffer is used. (msg[0])
Having more than one buffer is optional and the number can be controlled
via environment variable.
Related: OS#6705
Change-Id: I4fb1067de4615cc22cc6caf99b481491e7f2ef92
---
M include/osmocom/core/osmo_io.h
M src/core/libosmocore.map
M src/core/osmo_io.c
M src/core/osmo_io_internal.h
M src/core/osmo_io_poll.c
M src/core/osmo_io_uring.c
6 files changed, 74 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/91/40491/10
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4fb1067de4615cc22cc6caf99b481491e7f2ef92
Gerrit-Change-Number: 40491
Gerrit-PatchSet: 10
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Attention is currently required from: jolly.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email
to look at the new patch set (#11).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
The change is no longer submittable: Verified is unsatisfied now.
Change subject: Add multiple messages buffers to io_uring write operations
......................................................................
Add multiple messages buffers to io_uring write operations
Multiple message buffers can be writen by sending a single SQE when
using io_uring. If there is less data written, the completely written
buffers are removed and the partly written buffers are truncated.
Afterwards they are re-queued for next write operation.
Having more than one buffer is optional and the number can be controlled
via environment variable.
Related: OS#6705
Change-Id: I8c4e0a785cf66becd7fb5b2caf718c9724b56686
---
M src/core/osmo_io.c
M src/core/osmo_io_uring.c
2 files changed, 103 insertions(+), 46 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/40493/11
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c4e0a785cf66becd7fb5b2caf718c9724b56686
Gerrit-Change-Number: 40493
Gerrit-PatchSet: 11
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Attention is currently required from: jolly, laforge.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40492?usp=email
to look at the new patch set (#10).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Verified+1 by Jenkins Builder
Change subject: Add multiple messages buffers to io_uring read operations
......................................................................
Add multiple messages buffers to io_uring read operations
Multiple message buffers can be read by receiving a single CQE when
using io_uring. If there is less data available than available buffers,
not all buffers will be filled.
Having more than one buffer is optional and the number can be controlled
via environment variable.
Related: OS#6705
Change-Id: Ic4544b8fcbad5a266db748d6864d3ae93ee06bce
---
M src/core/osmo_io.c
M src/core/osmo_io_uring.c
2 files changed, 60 insertions(+), 24 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/40492/10
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40492?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic4544b8fcbad5a266db748d6864d3ae93ee06bce
Gerrit-Change-Number: 40492
Gerrit-PatchSet: 10
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: jolly, laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40725?usp=email
to look at the new patch set (#10).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: Automatically increase io_uring, if too small.
......................................................................
Automatically increase io_uring, if too small.
The ring may be too small to store all SQEs before the kernel can
handle them. If this happens, a new ring is allocated with twice of the
size of the old ring. The old ring will not be destroyed, as it still
contains uncompleted elements. Some of them may never be completed.
A pointer to the current ring will be stored within the msghdr
structure. It is used when cancelling an SQE. The cancellation must be
performed in the same ring where it was created.
It is quite unlikely that the old ring cannot store the cancellation
SQE. If this happens, the cancellation is queued and submitted, once
the ring can store it.
The old ring will not be removed, because there is currently no counter
to determine when all submissions are completed.
Related: OS#6705
Change-Id: Id9230146acc8d54bfd44834e783c31b37bd64bca
---
M src/core/osmo_io_internal.h
M src/core/osmo_io_uring.c
2 files changed, 148 insertions(+), 39 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/40725/10
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40725?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id9230146acc8d54bfd44834e783c31b37bd64bca
Gerrit-Change-Number: 40725
Gerrit-PatchSet: 10
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: jolly, pespin.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40782?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review+1 by pespin, Verified+1 by Jenkins Builder
Change subject: Add environment variable to set io_uring size
......................................................................
Add environment variable to set io_uring size
The term "LIBOSMO_IO_URING_INITIAL_SIZE" is related to the following
patch, which will increment the size of the io_uring automatically if
the initial size is too small.
Related: OS#6705
Change-Id: I55289d9282e13aa1bf82f3931c85c196752f1484
---
M src/core/osmo_io_uring.c
1 file changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/40782/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40782?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I55289d9282e13aa1bf82f3931c85c196752f1484
Gerrit-Change-Number: 40782
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Attention is currently required from: jolly, pespin.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40494?usp=email
to look at the new patch set (#11).
The following approvals got outdated and were removed:
Code-Review+1 by pespin, Verified+1 by Jenkins Builder
Change subject: Send multiple read/recvfrom/recvmsg SQEs in advance
......................................................................
Send multiple read/recvfrom/recvmsg SQEs in advance
Multiple read or recvfrom operations can be submitted via SQEs when
using io_uring. This allows reading multiple packet / more data between
calls of osmo_select_main() the main loop.
Having more than one SQE submitted is optional and the number can be
controlled via environment variable.
Related: OS#6705
Change-Id: Id50a8900fa2fe6de553e5025feae7e1e8d501e30
---
M include/osmocom/core/osmo_io.h
M src/core/libosmocore.map
M src/core/osmo_io.c
M src/core/osmo_io_internal.h
M src/core/osmo_io_uring.c
5 files changed, 86 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/94/40494/11
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40494?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id50a8900fa2fe6de553e5025feae7e1e8d501e30
Gerrit-Change-Number: 40494
Gerrit-PatchSet: 11
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
lynxis lazus has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/40813?usp=email )
Change subject: Re-introduce Iu/UTRAN support
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/40813?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I1b1aedd2a7c358bd388aa3d8a9f3c6a0011b4889
Gerrit-Change-Number: 40813
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Thu, 07 Aug 2025 13:15:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No