All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, andrew+netdev@lunn.ch,
	netdev@vger.kernel.org, david.butler@appgate.com,
	emil.s.tantilov@intel.com, luoxuanqiang@kylinos.cn,
	bryan.fraschetti@canonical.com, tristan@talencesecurity.com,
	tomasz.lichwala@linux.intel.com, horms@kernel.org,
	aleksander.lobakin@intel.com, stable@vger.kernel.org,
	jacob.e.keller@intel.com, aleksandr.loktionov@intel.com
Subject: Re: [PATCH net 3/6] ice: Restore Ordered MMIO Writes for Tx Doorbells
Date: Wed, 30 Sep 2026 00:58:33 +0000	[thread overview]
Message-ID: <179072991356.434549.1211761359531074249@kernel.org> (raw)
In-Reply-To: <20260928230429.495442-4-anthony.l.nguyen@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch fixes only the writer side of the ordering chain
  behind the dql_completed() BUG_ON.

--

ice: Restore Ordered MMIO Writes for Tx Doorbells

This commit changes the Tx ring and tstamp ring tail doorbell writes in
ice_tx_map() from writel_relaxed() back to writel(). The goal is to make
the dql->num_queued update from __netdev_tx_sent_queue() visible before
the NIC can start on the new descriptors. That avoids the BUG_ON in
dql_completed() seen on arm64.

Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2161572

> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
> index 31303ab5be175..a2c7c4962882d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
> @@ -1561,10 +1561,10 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first,
>  			}
>  		}
>  		tstamp_ring->next_to_use = j;
> -		writel_relaxed(j, tstamp_ring->tail);
> +		writel(j, tstamp_ring->tail);
>  	} else {
>  ring_kick:
> -		writel_relaxed(i, tx_ring->tail);
> +		writel(i, tx_ring->tail);
>  	}
>  	return;

[Severity: Medium]

This orders the xmit side. Is there a matching read barrier on the
completion side?

ice_clean_tx_irq() reads the DONE bit that the device writes, and then
completes the queue:

drivers/net/ethernet/intel/ice/ice_txrx.c:ice_clean_tx_irq() {
    ...
		if (!(eop_desc->cmd_type_offset_bsz &
		      cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE)))
			break;
    ...
	netdev_tx_completed_queue(txring_txq(tx_ring), total_pkts, total_bytes);
    ...
}

netdev_tx_completed_queue() then calls dql_completed(), which uses a
relaxed load:

lib/dynamic_queue_limits.c:dql_completed() {
	num_queued = READ_ONCE(dql->num_queued);
    ...
	BUG_ON(count > num_queued - dql->num_completed);
    ...
}

The smp_mb() in netdev_tx_completed_queue() runs after dql_completed(), so
it does not order this load. On arm64, a control dependency on the DONE
bit does not order a later load either.

The barriers that happen to sit on this path are not always there:

- The smp_rmb() at the top of the ice_clean_tx_irq() loop runs again only
  when the next tx_buf has a non-NULL next_to_watch. It is skipped when
  the loop stops on a NULL next_to_watch or when the budget runs out.

- skb_unref() issues smp_rmb() only when skb->users == 1 and
  CONFIG_DEBUG_NET is off. With users > 1 (for example pktgen with burst,
  which does refcount_add(burst, &skb->users)), napi_consume_skb() skips
  the defer path. The failing refcount_dec_and_test() then gives only
  release ordering.

- u64_stats_update_begin()/end() in ice_update_tx_ring_stats() are no-ops
  on 64-bit. dma_unmap_single() does nothing for coherent dma-direct
  without an IOMMU.

On that path, can the num_queued load complete before the DONE bit load?
If so, it would return a value from before the xmit CPU's dql_queued()
update and hit the same BUG_ON this commit is meant to fix.

The window is probably very small in practice. The num_queued store comes
before the doorbell, the descriptor fetch, the transmit and the DONE
write-back, and testing shows the observed crash is gone. This reader-side
pattern is also older than both this patch and commit ccde82e90946.

Would a dma_rmb() or smp_rmb() in ice_clean_tx_irq() help close this
fully? It could go after the DONE check or before the
netdev_tx_completed_queue() call.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260928230429.495442-1-anthony.l.nguyen%40intel.com

  reply	other threads:[~2026-09-30  0:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 23:04 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-09-28 (idpf, ice, iavf) Tony Nguyen
2026-09-28 23:04 ` [PATCH net 1/6] idpf: fix possible race on remove during a reset Tony Nguyen
2026-09-30  0:58   ` netdev-bot+sashiko
2026-10-01 23:40     ` Tantilov, Emil S
2026-09-28 23:04 ` [PATCH net 2/6] ice: fix use-after-free in dynamic port cleanup Tony Nguyen
2026-09-28 23:04 ` [PATCH net 3/6] ice: Restore Ordered MMIO Writes for Tx Doorbells Tony Nguyen
2026-09-30  0:58   ` netdev-bot+sashiko [this message]
2026-10-01 16:35     ` Tony Nguyen
2026-09-28 23:04 ` [PATCH net 4/6] ice: fix metadata_dst refcount handling on representor teardown Tony Nguyen
2026-09-28 23:04 ` [PATCH net 5/6] iavf: fix VF stats not updating due to PTP command preemption Tony Nguyen
2026-09-30  0:58   ` netdev-bot+sashiko
2026-09-30 15:07     ` Tomasz Lichwala
2026-09-28 23:04 ` [PATCH net 6/6] iavf: cap advertised max_pkt_size at the single-buffer HW limit Tony Nguyen
2026-09-29 16:18   ` Alexander Lobakin
2026-09-29 20:32     ` Dave Butler
2026-09-30 11:32       ` Alexander Lobakin
2026-09-30  0:58   ` netdev-bot+sashiko
2026-09-30  6:02     ` Dave Butler
     [not found]       ` <IA3PR05MB22078430E404FAD12912A706298B892@IA3PR05MB220784.namprd05.prod.outlook.com>
     [not found]         ` <CANm61jc37jivo=XmRwN8ic8PNJFXZK+6Gsw5VRy=b-oZKpMsMA@mail.gmail.com>
2026-10-02 21:09           ` Fw: " David Butler
2026-09-28 23:10 ` [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-09-28 (idpf, ice, iavf) netdev-bot+sinfo
2026-09-29  1:41   ` Dave Butler
     [not found]     ` <IA3PR05MB22078467309FA5DFF33EF712488B892@IA3PR05MB220784.namprd05.prod.outlook.com>
2026-10-02 21:21       ` Fw: " David Butler
2026-09-29 17:16   ` Tantilov, Emil S
2026-09-30 15:06   ` Tomasz Lichwala
2026-10-01 23:47 ` Tony Nguyen
2026-10-02 20:39   ` Jakub Kicinski
     [not found]     ` <IA3PR05MB220784D3846E12367B0CA1D3738B892@IA3PR05MB220784.namprd05.prod.outlook.com>
     [not found]       ` <CANm61jco98RoBmBAtbnjRZCPwqS0Vt6SqXjYAEUwSD4-bWLuZA@mail.gmail.com>
2026-10-02 21:06         ` Fw: " David Butler
2026-10-02 20:50 ` patchwork-bot+netdevbpf

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=179072991356.434549.1211761359531074249@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bryan.fraschetti@canonical.com \
    --cc=davem@davemloft.net \
    --cc=david.butler@appgate.com \
    --cc=edumazet@kernel.org \
    --cc=emil.s.tantilov@intel.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=luoxuanqiang@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tomasz.lichwala@linux.intel.com \
    --cc=tristan@talencesecurity.com \
    /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.