pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41980?usp=email )
Change subject: Use same queue length for gsmtap_log and gsmtap_file
......................................................................
Use same queue length for gsmtap_log and gsmtap_file
Take the chance to also deduplicate MAX_LOG_SIZE.
Change-Id: I3772d291f97626ee325731f3515a5110eda70d3d
---
M include/osmocom/core/logging_internal.h
M src/core/logging_file.c
M src/core/logging_gsmtap.c
3 files changed, 8 insertions(+), 9 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/include/osmocom/core/logging_internal.h b/include/osmocom/core/logging_internal.h
index 0cc82a4..e898758 100644
--- a/include/osmocom/core/logging_internal.h
+++ b/include/osmocom/core/logging_internal.h
@@ -11,6 +11,9 @@
/* maximum length of the log string of a single log event (typically line) */
#define MAX_LOG_SIZE 4096
+/* maximum number of log statements we queue in file/stderr target write queue */
+#define LOG_WQUEUE_LEN 156
+
struct log_thread_state {
/* Whether we are inside a code path to generate logging output: */
bool logging_active;
diff --git a/src/core/logging_file.c b/src/core/logging_file.c
index aa5ef63..9c7cf36 100644
--- a/src/core/logging_file.c
+++ b/src/core/logging_file.c
@@ -41,9 +41,6 @@
#include <osmocom/core/osmo_io.h>
#include <osmocom/core/logging_internal.h>
-/* maximum number of log statements we queue in file/stderr target write queue */
-#define LOG_WQUEUE_LEN 156
-
/* NOTE: We use target->tgt_file.wqueue->except_cb to store the struct osmo_io_fd, because the
* struct log_target is public and we cannot add pointers to it under tgt->tgt_file...
* It can be moved to target->tgt_file.iofd if we are ever able to make struct log_target private... */
diff --git a/src/core/logging_gsmtap.c b/src/core/logging_gsmtap.c
index 062efd9..38e305b 100644
--- a/src/core/logging_gsmtap.c
+++ b/src/core/logging_gsmtap.c
@@ -44,15 +44,14 @@
#include <osmocom/core/utils.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h>
-#include <osmocom/core/logging.h>
+#include <osmocom/core/logging_internal.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/core/thread.h>
-#define GSMTAP_LOG_MAX_SIZE 4096
#define GSMTAP_MSG_MAX_SIZE (sizeof(struct gsmtap_hdr) + \
sizeof(struct gsmtap_osmocore_log_hdr) + \
- GSMTAP_LOG_MAX_SIZE)
+ MAX_LOG_SIZE)
static __thread uint32_t logging_gsmtap_tid;
@@ -156,10 +155,10 @@
#ifndef ENABLE_PSEUDOTALLOC
size_t num_pool_objects;
if (ofd_wq_mode) {
- /* Allocate a talloc pool to avoid malloc() on the first 100
- * concurrently queued msgbs (~400KB per gsmtap_log target).
+ /* Allocate a talloc pool to avoid malloc() on the first 156
+ * concurrently queued msgbs (~624KB per gsmtap_log target).
* Once the talloc_pool is full, new normal talloc chunks will be used. */
- num_pool_objects = 100;
+ num_pool_objects = LOG_WQUEUE_LEN;
} else {
/* When in synchronous mode (blocking & non-blocking), there's
* no queueing in gsmtap_sendmsg() so there's no need to have a
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41980?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3772d291f97626ee325731f3515a5110eda70d3d
Gerrit-Change-Number: 41980
Gerrit-PatchSet: 7
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41988?usp=email )
Change subject: osmo_io: Remove outdated comment in API doc of osmo_iofd_set_io_buffers()
......................................................................
osmo_io: Remove outdated comment in API doc of osmo_iofd_set_io_buffers()
Multiple iov buffers are supported in poll backend since
4272cd46b1e5b264e6f6b65d38bcb08e3a139a9e.
Related: OS#6705
Change-Id: I9b75f3597081c6cd7e24f75f0e289b93edb3aa86
---
M src/core/osmo_io.c
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 3cd9dc5..7c931d3 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -910,7 +910,6 @@
*
* If the osmo_io_fd is in OSMO_IO_FD_MODE_READ_WRITE mode, this API function can be used to tell the
* osmo_io proecess how many buffers should be read or written with a single read or write operation.
- * This feature is supported with io_uring backend only.
*
* \param[in] iofd the iofd file descriptor
* \param[in] op the osmo_io_op (read or write) to set the number of IO buffers for
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41988?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9b75f3597081c6cd7e24f75f0e289b93edb3aa86
Gerrit-Change-Number: 41988
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41989?usp=email )
Change subject: osmo_io: Allow fetching maximum value allowed by osmo_iofd_set_io_buffers()
......................................................................
osmo_io: Allow fetching maximum value allowed by osmo_iofd_set_io_buffers()
Before this patch, there's no way for a user of the API to know whether
a requested buffers value is actually going to be accepted or not.
Change-Id: Id3d8413c119eb3d9b60aa068295a59561236938c
---
M src/core/osmo_io.c
1 file changed, 9 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, but someone else must approve
jolly: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 7c931d3..8ee6967 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -915,15 +915,23 @@
* \param[in] op the osmo_io_op (read or write) to set the number of IO buffers for
* \param[in] buffers the number of IO buffer for each specified operation
* \returns zero on success, a negative value on error
+ *
+ * The minimum valid buffers to set is always 1.
+ * The maximum valid buffers is implementation defined, and trying to set a
+ * value greater than the maximum will return an error.
+ * Passing \ref buffers with a value of 0 can be used to fetch the maximum value allowed.
*/
int osmo_iofd_set_io_buffers(struct osmo_io_fd *iofd, enum osmo_io_op op, uint8_t buffers)
{
if (iofd->mode != OSMO_IO_FD_MODE_READ_WRITE)
return -EINVAL;
- if (buffers < 1 || buffers > IOFD_MSGHDR_IO_BUFFERS)
+ if (buffers > IOFD_MSGHDR_IO_BUFFERS)
return -EINVAL;
+ if (buffers == 0)
+ return IOFD_MSGHDR_IO_BUFFERS;
+
switch (op) {
case OSMO_IO_OP_READ:
iofd->io_read_buffers = buffers;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41989?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id3d8413c119eb3d9b60aa068295a59561236938c
Gerrit-Change-Number: 41989
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41990?usp=email )
Change subject: logging_file: Request up to 8 iofd write buffers if available
......................................................................
logging_file: Request up to 8 iofd write buffers if available
This should help in decreasing latency between submitting a logging line
and getting it written to file. It should, for the same reason, optimize
CPU use.
Change-Id: Ia88b27948922d278e0f72fc2aac4b4ae88465b4d
---
M src/core/logging_file.c
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
jolly: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/core/logging_file.c b/src/core/logging_file.c
index 9c7cf36..067f993 100644
--- a/src/core/logging_file.c
+++ b/src/core/logging_file.c
@@ -253,6 +253,10 @@
_log_target_file_setup_talloc_pool(target);
osmo_iofd_set_txqueue_max_length(iofd, OSMO_MAX(osmo_iofd_get_txqueue_max_length(iofd), LOG_WQUEUE_LEN));
+ /* Request to use 8 write buffers, or less if not as many are available: */
+ rc = osmo_iofd_set_io_buffers(iofd, OSMO_IO_OP_WRITE, 0);
+ rc = osmo_iofd_set_io_buffers(iofd, OSMO_IO_OP_WRITE, OSMO_MIN(rc, 8));
+
rc = osmo_iofd_register(iofd, -1);
if (rc < 0) {
osmo_iofd_free(iofd);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41990?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia88b27948922d278e0f72fc2aac4b4ae88465b4d
Gerrit-Change-Number: 41990
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41990?usp=email )
Change subject: logging_file: Request up to 8 iofd write buffers if available
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41990?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: Ia88b27948922d278e0f72fc2aac4b4ae88465b4d
Gerrit-Change-Number: 41990
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 02 Feb 2026 13:51:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria, pespin.
jolly has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41990?usp=email )
Change subject: logging_file: Request up to 8 iofd write buffers if available
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41990?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: Ia88b27948922d278e0f72fc2aac4b4ae88465b4d
Gerrit-Change-Number: 41990
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 02 Feb 2026 13:43:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes