Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joe Damato" <joe@dama.to>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 4/5] net/mlx4: track whether a TX doorbell is pending
Date: Wed, 11 Nov 2026 23:13:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-209848@kernel.org> (raw)
In-Reply-To: <20261110231304.1859217-5-joe@dama.to>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net/mlx4: doorbell_pending placed in read-mostly cacheline of
  mlx4_en_tx_ring
--

commit c4a2c0626cb72780e7edec3e4335fdf04dad4de9
Author: Joe Damato <joe@dama.to>

net/mlx4: track whether a TX doorbell is pending

This commit adds a doorbell_pending flag to struct mlx4_en_tx_ring to track
when a TX doorbell write has been deferred due to xmit_more.

> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> index aab97694f86b3..601c09020f380 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> @@ -281,6 +281,7 @@ struct mlx4_en_tx_ring {
>  	unsigned long		tso_packets;
>  	unsigned long		xmit_more;
>  	struct mlx4_bf		bf;
> +	bool			doorbell_pending;
>  
>  	/* Following part should be mostly read */
>  	void __iomem		*doorbell_address;

[Severity: Low]
Does placing doorbell_pending after struct mlx4_bf put a per-packet written
field into the read-mostly cacheline of struct mlx4_en_tx_ring?

On 64-bit SMP builds, the TX producer cacheline starting at prod (offset
0x40) is filled through bf.uar, while the read-only bf.reg pointer starts
the next cacheline at offset 0x80 alongside doorbell_address, size_mask,
buf, and tx_info, as arranged by commit e3f42f845390 ("mlx4: reorganize
struct mlx4_en_tx_ring").

Because mlx4_en_tx_write_desc() and mlx4_en_xmit_doorbell() write
doorbell_pending on every packet, placing it at offset 0x88 dirties that
read-mostly cacheline on every TX packet, causing false sharing with TX
completion polling in mlx4_en_process_tx_cq().  The 7 bytes of alignment
padding before doorbell_address also push bf_enabled and hwtstamp_tx_type
into a third cacheline.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110231304.1859217-1-joe@dama.to?part=4

  reply	other threads:[~2026-11-11 23:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 23:12 [PATCH net-next 0/5] mlx4: cleanup and doorbell fix Joe Damato
2026-11-10 23:12 ` [PATCH net-next 1/5] net/mlx4: factor VLAN parsing into mlx4_en_prep_vlan() Joe Damato
2026-11-11 23:13   ` sashiko-bot
2026-11-10 23:12 ` [PATCH net-next 2/5] net/mlx4: factor csum flags into mlx4_en_csum_flags() Joe Damato
2026-11-11 23:13   ` sashiko-bot
2026-11-10 23:12 ` [PATCH net-next 3/5] net/mlx4: factor HW loopback DMAC into mlx4_en_set_loopback_dmac() Joe Damato
2026-11-11 23:13   ` sashiko-bot
2026-11-10 23:12 ` [PATCH net-next 4/5] net/mlx4: track whether a TX doorbell is pending Joe Damato
2026-11-11 23:13   ` sashiko-bot [this message]
2026-11-10 23:12 ` [PATCH net-next 5/5] net/mlx4: flush pending doorbell when dropping a TX skb Joe Damato
2026-11-11 23:13   ` sashiko-bot
2026-11-10 23:17 ` [PATCH net-next 0/5] mlx4: cleanup and doorbell fix netdev-bot+sinfo
2026-11-10 23:21   ` Joe Damato

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=sashiko-outbox-209848@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=joe@dama.to \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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