From: Breno Leitao <leitao@debian.org>
To: Gustavo Luiz Duarte <gustavold@gmail.com>
Cc: 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>, Simon Horman <horms@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH net-next 3/5] netconsole: append msgid to sysdata
Date: Wed, 11 Jun 2025 08:30:11 -0700 [thread overview]
Message-ID: <aEmhA0QoZy3LbAu+@gmail.com> (raw)
In-Reply-To: <20250611-netconsole-msgid-v1-3-1784a51feb1e@gmail.com>
On Wed, Jun 11, 2025 at 07:36:05AM -0700, Gustavo Luiz Duarte wrote:
> Add msgcounter to the netconsole_target struct to generate message IDs.
> If the msgid_enabled attribute is true, increment msgcounter and append
> msgid=<msgcounter> to sysdata buffer before sending the message.
>
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
> ---
> drivers/net/netconsole.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index 813f50abaf9f..34b61e299eeb 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -155,6 +155,8 @@ struct netconsole_target {
> size_t userdata_length;
> /* bit-wise with sysdata_feature bits */
> u32 sysdata_fields;
> + /* protected by target_list_lock */
> + u32 msgcounter;
> #endif
> struct netconsole_target_stats stats;
> bool enabled;
> @@ -1345,13 +1347,21 @@ static int sysdata_append_release(struct netconsole_target *nt, int offset)
> init_utsname()->release);
> }
>
> +static int sysdata_append_msgid(struct netconsole_target *nt, int offset)
> +{
> + nt->msgcounter++;
This will eventually wrap. I am wondering if you should use the
overflow.h helpers to avoid warnings in UBSAN and friends.
Quick glanced over that filed, I found:
/**
* wrapping_add() - Intentionally perform a wrapping addition
* @type: type for result of calculation
* @a: first addend
* @b: second addend
*
* Return the potentially wrapped-around addition without
* tripping any wrap-around sanitizers that may be enabled.
*/
> + return scnprintf(&nt->extradata_complete[offset],
> + MAX_EXTRADATA_ENTRY_LEN, " msgid=%u\n",
> + nt->msgcounter);
> +}
> +
> /*
> * prepare_extradata - append sysdata at extradata_complete in runtime
> * @nt: target to send message to
> */
> static int prepare_extradata(struct netconsole_target *nt)
> {
> - u32 fields = SYSDATA_CPU_NR | SYSDATA_TASKNAME;
> + u32 fields = SYSDATA_CPU_NR | SYSDATA_TASKNAME | SYSDATA_MSGID;
This might be gone now, according to your last patch.,
LGTM.
next prev parent reply other threads:[~2025-06-11 15:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 14:36 [PATCH net-next 0/5] netconsole: Add support for msgid in sysdata Gustavo Luiz Duarte
2025-06-11 14:36 ` [PATCH net-next 1/5] netconsole: introduce 'msgid' as a new sysdata field Gustavo Luiz Duarte
2025-06-11 15:14 ` Breno Leitao
2025-06-11 14:36 ` [PATCH net-next 2/5] netconsole: implement configfs for msgid_enabled Gustavo Luiz Duarte
2025-06-11 15:22 ` Breno Leitao
2025-06-11 14:36 ` [PATCH net-next 3/5] netconsole: append msgid to sysdata Gustavo Luiz Duarte
2025-06-11 15:30 ` Breno Leitao [this message]
2025-06-11 20:40 ` Jakub Kicinski
2025-06-12 13:06 ` Gustavo Luiz Duarte
2025-06-11 14:36 ` [PATCH net-next 4/5] selftests: netconsole: Add tests for 'msgid' feature in sysdata Gustavo Luiz Duarte
2025-06-11 14:36 ` [PATCH net-next 5/5] docs: netconsole: document msgid feature Gustavo Luiz Duarte
2025-06-11 15:33 ` Breno Leitao
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=aEmhA0QoZy3LbAu+@gmail.com \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gustavold@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.