From: Gustavo Luiz Duarte <gustavold@gmail.com>
To: Breno Leitao <leitao@debian.org>,
Andre Carvalho <asantostc@gmail.com>,
Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Gustavo Luiz Duarte <gustavold@gmail.com>
Subject: [PATCH net-next v2 0/4] netconsole: Allow userdata buffer to grow dynamically
Date: Thu, 13 Nov 2025 08:42:17 -0800 [thread overview]
Message-ID: <20251113-netconsole_dynamic_extradata-v2-0-18cf7fed1026@meta.com> (raw)
The current netconsole implementation allocates a static buffer for
extradata (userdata + sysdata) with a fixed size of
MAX_EXTRADATA_ENTRY_LEN * MAX_EXTRADATA_ITEMS bytes for every target,
regardless of whether userspace actually uses this feature. This forces
us to keep MAX_EXTRADATA_ITEMS small (16), which is restrictive for
users who need to attach more metadata to their log messages.
This patch series enables dynamic allocation of the userdata buffer,
allowing it to grow on-demand based on actual usage. The series:
1. Refactors send_fragmented_body() to simplify handling of separated
userdata and sysdata (patch 1/4)
2. Splits userdata and sysdata into separate buffers (patch 2/4)
3. Implements dynamic allocation for the userdata buffer (patch 3/4)
4. Increases MAX_USERDATA_ITEMS from 16 to 256 now that we can do so
without memory waste (patch 4/4)
Benefits:
- No memory waste when userdata is not used
- Targets that use userdata only consume what they need
- Users can attach significantly more metadata without impacting systems
that don't use this feature
Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
Changes in v2:
- Added null pointer checks for userdata and sysdata buffers
- Added MAX_SYSDATA_ITEMS to enum sysdata_feature
- Moved code out of ifdef in send_msg_no_fragmentation()
- Renamed variables in send_fragmented_body() to make it easier to
reason about the code
- Link to v1: https://lore.kernel.org/r/20251105-netconsole_dynamic_extradata-v1-0-142890bf4936@meta.com
---
Gustavo Luiz Duarte (4):
netconsole: Simplify send_fragmented_body()
netconsole: Split userdata and sysdata
netconsole: Dynamic allocation of userdata buffer
netconsole: Increase MAX_USERDATA_ITEMS
drivers/net/netconsole.c | 370 ++++++++++-----------
.../selftests/drivers/net/netcons_overflow.sh | 2 +-
2 files changed, 179 insertions(+), 193 deletions(-)
---
base-commit: 68fa5b092efab37a4f08a47b22bb8ca98f7f6223
change-id: 20251007-netconsole_dynamic_extradata-21bd9d726568
Best regards,
--
Gustavo Duarte <gustavold@meta.com>
next reply other threads:[~2025-11-13 16:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:42 Gustavo Luiz Duarte [this message]
2025-11-13 16:42 ` [PATCH net-next v2 1/4] netconsole: Simplify send_fragmented_body() Gustavo Luiz Duarte
2025-11-14 12:02 ` Breno Leitao
2025-11-13 16:42 ` [PATCH net-next v2 2/4] netconsole: Split userdata and sysdata Gustavo Luiz Duarte
2025-11-14 12:44 ` Breno Leitao
2025-11-13 16:42 ` [PATCH net-next v2 3/4] netconsole: Dynamic allocation of userdata buffer Gustavo Luiz Duarte
2025-11-14 13:04 ` Breno Leitao
2025-11-18 18:51 ` Gustavo Luiz Duarte
2025-11-19 9:07 ` Breno Leitao
2025-11-13 16:42 ` [PATCH net-next v2 4/4] netconsole: Increase MAX_USERDATA_ITEMS Gustavo Luiz Duarte
2025-11-14 13:07 ` Breno Leitao
2025-11-19 22:58 ` Gustavo Luiz Duarte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251113-netconsole_dynamic_extradata-v2-0-18cf7fed1026@meta.com \
--to=gustavold@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=asantostc@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox