Attention is currently required from: pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40493?usp=email )
Change subject: Add multiple messages buffers to io_uring write operations
......................................................................
Patch Set 8:
(2 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/747f89ec_2678ed2c?… :
PS4, Line 444: /* Re-enqueue remaining buffers. */
> No, what I mean is that in here a function should be called to re-arrange msgs inside msghdrs in the […]
There will be a follow-up commit.
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40493/comment/dc039d0b_33123e35?… :
PS7, Line 442: /* Re-enqueue the complete msgb. */
> This can be moved to the top of the function before the for loop, to simplify function now that you […]
Done
--
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: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c4e0a785cf66becd7fb5b2caf718c9724b56686
Gerrit-Change-Number: 40493
Gerrit-PatchSet: 8
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 28 Jul 2025 10:19:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40492?usp=email )
Change subject: Add multiple messages buffers to io_uring read operations
......................................................................
Patch Set 7:
(2 comments)
File src/core/osmo_io_uring.c:
https://gerrit.osmocom.org/c/libosmocore/+/40492/comment/ba5f15dc_d48d8b9a?… :
PS3, Line 179: if (idx)
> Because it is already allocated above at: iofd_msgb_alloc(iodfd); and then added to the msghdr durin […]
Done
https://gerrit.osmocom.org/c/libosmocore/+/40492/comment/31c00280_a1b8f037?… :
PS3, Line 185:
> the cases below have all "/* fall-through */". I still need to check if action == IOFD_ACT_READ.
Done
--
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: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic4544b8fcbad5a266db748d6864d3ae93ee06bce
Gerrit-Change-Number: 40492
Gerrit-PatchSet: 7
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 28 Jul 2025 10:19:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40491?usp=email )
Change subject: Add multiple messages buffers to struct iofd_msghdr
......................................................................
Patch Set 7:
(8 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/ef361154_bc712529?… :
PS3, Line 165: hdr->msg_max = (g_io_backend == OSMO_IO_BACKEND_IO_URING) ? g_io_uring_iov : 1;
> this info should be obtained from osmo_io_fd struct.
Done
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/c1736551_2110a685?… :
PS3, Line 406: struct msgb *msg = msghdr->msg[0];
> I see now, because this commit is actually not yet adding support for >1 msgb per msghdr, it's only […]
Done
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/97886b07_25aada17?… :
PS5, Line 727: iofd->io_buffers = (g_io_backend == OSMO_IO_BACKEND_IO_URING) ? g_io_uring_iov : 1;
> sounds like we want to have this per-backend logic as part of the per-backend ops, and not here.
It is set by an API function now.
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/ecc7525f_6e3dcb0d?… :
PS6, Line 747: * If your osmo_io_fd is in OSMO_IO_FD_MODE_READ_WRITE mode, this API function can be used to tell the
> Please add proper doxygen documentation of params here.
Done
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/12c1d822_38847e71?… :
PS6, Line 748: * osmo_io code how many buffers should be read or written with a single read or write operation.
> "read or write". Extra space.
Done
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/5a0c93ff_615b47a6?… :
PS6, Line 751: int osmo_iofd_set_io_buffers(struct osmo_io_fd *iofd, int buffers)
> unsigned int buffers? […]
Done
File src/core/osmo_io_internal.h:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/c79bae45_5b9c7630?… :
PS6, Line 143: int io_len;
> this can also be a unsigned int. And even actually a uint8_t.
Done
File src/core/osmo_io_uring.c:
https://gerrit.osmocom.org/c/libosmocore/+/40491/comment/84b14b5c_5b18e99a?… :
PS3, Line 110: g_io_uring_iov = atoi(env);
> afaict this is not some information which is needed really early in the startup of the program, befo […]
It is configured in an API function now.
--
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: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4fb1067de4615cc22cc6caf99b481491e7f2ef92
Gerrit-Change-Number: 40491
Gerrit-PatchSet: 7
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: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 28 Jul 2025 10:19:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email )
Change subject: Avoid reusing pending buffer; append incoming data instead
......................................................................
Patch Set 5:
(4 comments)
Commit Message:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/b4a76037_8b68c451?… :
PS3, Line 17: This change ensures that newly received data is appended to the existing
> This is still confusing to me, because you are still using the term "pending buffer" twice. […]
Done
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/e6b64bd4_78726884?… :
PS3, Line 178: struct msgb *iofd_msgb_alloc2(struct osmo_io_fd *iofd, size_t size)
> I agree with @pespin@sysmocom.de here. […]
Yes the pending buffer that is created with given size is always larger than the msgb_size configured by the user. It cannot be smaller, because it is created when a regular pending buffer (of msgb_size) is too small to append subsequent received data.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/5332c687_6661cb75?… :
PS3, Line 335: * If the pending message is not large enough, create a larger message. */
> > The application should only care about the length of data in the buffer not the size. […]
The larger buffer is only used for segentation process. The data that is sent to the user will have the length that the user requested as segment size. This less or equal the msgb_size that the user configured.
https://gerrit.osmocom.org/c/libosmocore/+/40584/comment/5334a098_81e901c4?… :
PS3, Line 344: memcpy(msgb_put(iofd->pending, msgb_length(msg)), msgb_data(msg), msgb_length(msg));
> How? The fist memcopy is used, if the pending buffer must be enlarged. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
Gerrit-Change-Number: 40584
Gerrit-PatchSet: 5
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: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 28 Jul 2025 10:19:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/40760?usp=email )
Change subject: osmo-io: Put together message buffers when dequeued from tx queue
......................................................................
osmo-io: Put together message buffers when dequeued from tx queue
Write operations may be incomplete. osmo-io processs will remove
complete message buffers after a write operation from msghdr and put
the msghdr with the remaining buffers back into tx_queue.
If the user requests multiple messages buffers per write operation, the
msghdr of an incomplete write may have less message buffers than the
user requested. The remaining buffers are buffers are taken from next
msghdr in the queue, if exists.
Change-Id: I97c366211dd266fd58ec252890ec017d6d334534
---
M src/core/osmo_io.c
1 file changed, 36 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/40760/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 8c71efe..b70fd35 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -239,21 +239,52 @@
*/
struct iofd_msghdr *iofd_txqueue_dequeue(struct osmo_io_fd *iofd)
{
- struct llist_head *lh;
+ struct iofd_msghdr *msghdr;
if (iofd->tx_queue.current_length == 0)
return NULL;
- lh = iofd->tx_queue.msg_queue.next;
+ msghdr = llist_first_entry_or_null(&iofd->tx_queue.msg_queue, struct iofd_msghdr, list);
- OSMO_ASSERT(lh);
+ OSMO_ASSERT(msghdr);
iofd->tx_queue.current_length--;
- llist_del(lh);
+ llist_del(&msghdr->list);
+
+ /* Fill up empty buffers in dequeued msghdr with buffers from the next msghdr.
+ * There can be empty buffers, when a msghdr is queued to the front with incomplete write. */
+ while (OSMO_UNLIKELY(msghdr->io_len < iofd->io_write_buffers)) {
+ struct iofd_msghdr *next;
+ int i;
+
+ if (iofd->tx_queue.current_length == 0)
+ break;
+ next = llist_first_entry_or_null(&iofd->tx_queue.msg_queue, struct iofd_msghdr, list);
+ OSMO_ASSERT(next->io_len > 0);
+ /* Get first message buffer from next msghdr and store them in the dequeued one. */
+ msghdr->iov[msghdr->io_len] = next->iov[0];
+ msghdr->msg[msghdr->io_len] = next->msg[0];
+ msghdr->hdr.msg_iovlen = ++msghdr->io_len;
+ /* Remove the message buffer from the next msghdr and free, if empty. */
+ next->io_len--;
+ for (i = 0; i < next->io_len; i++) {
+ next->iov[i] = next->iov[i + 1];
+ next->msg[i] = next->msg[i + 1];
+ }
+ if (next->io_len == 0) {
+ iofd->tx_queue.current_length--;
+ llist_del(&next->list);
+ iofd_msghdr_free(next);
+ } else {
+ memset(&next->iov[next->io_len], 0, sizeof(struct iovec));
+ next->msg[next->io_len] = NULL;
+ next->hdr.msg_iovlen = --next->io_len;
+ }
+ }
if (iofd->tx_queue.current_length == 0)
osmo_iofd_ops.write_disable(iofd);
- return llist_entry(lh, struct iofd_msghdr, list);
+ return msghdr;
}
/*! Handle segmentation of the msg. If this function returns *_HANDLE_ONE or MORE then the data in msg will contain
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40760?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: I97c366211dd266fd58ec252890ec017d6d334534
Gerrit-Change-Number: 40760
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Attention is currently required from: jolly, laforge.
Hello Jenkins Builder, 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 (#7).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
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/osmo_io.c
M src/core/osmo_io_internal.h
M src/core/osmo_io_poll.c
M src/core/osmo_io_uring.c
5 files changed, 74 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/91/40491/7
--
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: 7
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: laforge <laforge(a)osmocom.org>
Attention is currently required from: jolly, laforge, pespin.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40489?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review-1 by pespin, Verified+1 by Jenkins Builder
Change subject: Allow io_uring_submit batching just ahead of poll/select
......................................................................
Allow io_uring_submit batching just ahead of poll/select
Let's add a mode (enabled via the LIBOSMO_IO_URING_BATCH environment
variable), where we don't call io_uring_submit() after every operation
we add to the submission queue. Rather, do that once before we go into
poll.
This should massively reduce the amount of io_uring_enter() syscalls
we're seeing.
Related: OS#6705
Change-Id: Id34fe2ced32c63d15b14810e145744f7509064cc
---
M src/core/osmo_io_uring.c
M src/core/select.c
2 files changed, 46 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/89/40489/5
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40489?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: Id34fe2ced32c63d15b14810e145744f7509064cc
Gerrit-Change-Number: 40489
Gerrit-PatchSet: 5
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: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Attention is currently required from: jolly, pespin.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/40584?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: Avoid reusing pending buffer; append incoming data instead
......................................................................
Avoid reusing pending buffer; append incoming data instead
When reading from a stream, a single read may return only part of a
message segment. In such cases, the partial data was stored in
'iofd->pending' and reused for subsequent reads to complete the message.
With upcoming changes that submit multiple read SQEs to io_uring,
each read uses its own pre-submitted buffer. Reusing 'iofd->pending' for
submitting next read is not possible, as the next read buffer is already
submitted.
Instead, create a new msgb which is used for the read operation and,
once completed, memcopy to the existing pending buffer, allowing message
segments to accumulate until complete.
Change-Id: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
---
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
4 files changed, 26 insertions(+), 28 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/40584/5
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40584?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: I08df9736ccc5e9a7df61ca6dcf94629ee010752f
Gerrit-Change-Number: 40584
Gerrit-PatchSet: 5
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: 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/+/40492?usp=email
to look at the new patch set (#7).
The following approvals got outdated and were removed:
Code-Review+1 by pespin, 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_uring.c
1 file changed, 42 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/40492/7
--
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: 7
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>