public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: dhowells@redhat.com
Cc: Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org
Subject: Re: [net,v2] rxrpc: Fix data-race warning and potential load/store tearing
Date: Sat, 17 Jan 2026 16:24:28 -0800	[thread overview]
Message-ID: <20260118002427.1037338-2-kuba@kernel.org> (raw)
In-Reply-To: <89226.1768426612@warthog.procyon.org.uk>

Hi,

This is an AI-generated review of your patch.
Bit of a nit pick but... I guess so..?

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
rxrpc: Fix data-race warning and potential load/store tearing

This commit fixes a KCSAN data-race warning on peer->last_tx_at by changing
it from time64_t to unsigned int (to prevent tearing on 32-bit) and adding
WRITE_ONCE/READ_ONCE annotations for the accesses.

Closes: https://lore.kernel.org/r/695e7cfb.050a0220.1c677c.036b.GAE@google.com/

> diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
> index 7f4729234957..9d02448ac062 100644

[ ... ]

> +static time64_t rxrpc_peer_get_tx_mark(const struct rxrpc_peer *peer, time64_t base)
> +{
> +	s32 last_tx_at = READ_ONCE(peer->last_tx_at);

[ ... ]

> diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
> index d803562ca0ac..ce4fd1af79ba 100644
> --- a/net/rxrpc/proc.c
> +++ b/net/rxrpc/proc.c
> @@ -296,13 +296,13 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v)
>
>  	now = ktime_get_seconds();
>  	seq_printf(seq,
> -		   "UDP   %-47.47s %-47.47s %3u %4u %5u %6llus %8d %8d\n",
> +		   "UDP   %-47.47s %-47.47s %3u %4u %5u %6ds %8d %8d\n",
>  		   lbuff,
>  		   rbuff,
>  		   refcount_read(&peer->ref),
>  		   peer->cong_ssthresh,
>  		   peer->max_data,
> -		   now - peer->last_tx_at,
> +		   (s32)now - (s32)peer->last_tx_at,
                                 ^^^^^^^^^^^^^^^^^

Should this read use READ_ONCE(peer->last_tx_at) for consistency with the
data-race fix?  The new rxrpc_peer_get_tx_mark() uses READ_ONCE for the
same field, and the same seq_printf uses READ_ONCE for recent_srtt_us and
recent_rto_us on the following lines.

> +		   READ_ONCE(peer->recent_srtt_us),
> +		   READ_ONCE(peer->recent_rto_us));
-- 
pw-bot: cr

  reply	other threads:[~2026-01-18  0:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 21:36 [PATCH net v2] rxrpc: Fix data-race warning and potential load/store tearing David Howells
2026-01-18  0:24 ` Jakub Kicinski [this message]
2026-01-18 12:03   ` [net,v2] " David Howells
2026-01-19 17:39     ` Jakub Kicinski
2026-01-19 23:46       ` David Howells

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=20260118002427.1037338-2-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=netdev@vger.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