Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: muhammad.nazim.amirul.nazle.asmade@altera.com
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/3] arm64: dts: agilex5: Enable pagepool Tx buffer quirk
Date: Tue, 04 Aug 2026 07:05:33 +0000	[thread overview]
Message-ID: <20260804070534.240B31F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260803070513.4657-4-muhammad.nazim.amirul.nazle.asmade@altera.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Unsafe use of page_pool_recycle_direct() from hardirq context causes fast-cache corruption.
- [Medium] Redundant full-page DMA sync due to PP_FLAG_DMA_SYNC_DEV on a TX bounce buffer.
- [Low] Encoding a software optimization policy into Devicetree.
--

--- Patch [3]: [PATCH 3/3] arm64: dts: agilex5: Enable pagepool Tx buffer quirk ---
commit 4b5b56ba27a76622b7269e1715c07a2f16e86382
Author: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

arm64: dts: agilex5: Enable pagepool Tx buffer quirk

Enable snps,pagepool-tx-buf-quirk for Agilex5 gmac0/1/2. These ports
use an IOMMU, where avoiding per-packet dma map/unmap invalidate cost
improves Tx performance.

> diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi b/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi
> index b06c6d5d60eed..525e6a2319c10 100644
> --- a/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi
> +++ b/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi
> @@ -574,6 +574,7 @@ gmac0: ethernet@10810000 {
>  			snps,mtl-tx-config = <&mtl_tx_emac0_setup>;
>  			snps,pbl = <32>;
>  			snps,tso;
> +			snps,pagepool-tx-buf-quirk;

[Severity: Low]
Does a software optimization policy belong in Devicetree? Usually, Devicetree
describes hardware topology rather than software configuration like this quirk.

[Severity: High]
By enabling this quirk, does this expose a fast-cache corruption regression
in the driver?

When a hardware Tx error occurs, the hardirq handler calls stmmac_tx_err(),
which iterates buffers and eventually calls:

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:stmmac_free_tx_buffer()
			page_pool_recycle_direct(tx_q->page_pool,
						 tx_q->tx_skbuff_dma[i].page);

If this interrupts napi softirq running on the same CPU, or races with napi
on another CPU, won't calling the napi-only page_pool_recycle_direct()
without the Tx lock corrupt the lockless page_pool fast cache?

[Severity: Medium]
Will enabling this quirk introduce redundant performance overhead that defeats
its purpose?

The driver initializes the Tx page pool with PP_FLAG_DMA_SYNC_DEV:

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:__alloc_dma_tx_desc_resources()
	pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;

This causes a full 4KB page sync on every recycle. However, the driver
already performs a precise sync manually:

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:stmmac_xmit()
			dma_sync_single_for_device(priv->device, dma_addr,
						   nopaged_len,
						   DMA_BIDIRECTIONAL);

Could the sync upon recycle be syncing stale data before the next packet is
written, making the PP_FLAG_DMA_SYNC_DEV flag redundant?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803070513.4657-1-muhammad.nazim.amirul.nazle.asmade@altera.com?part=3

      reply	other threads:[~2026-08-04  7:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  7:05 [PATCH net-next 0/3] net: stmmac: page pool Tx buffer quirk muhammad.nazim.amirul.nazle.asmade
2026-08-03  7:05 ` [PATCH net-next 1/3] dt-bindings: net: snps,dwmac: Add snps,pagepool-tx-buf-quirk muhammad.nazim.amirul.nazle.asmade
2026-08-04  7:05   ` sashiko-bot
2026-08-04  8:37   ` Krzysztof Kozlowski
2026-08-03  7:05 ` [PATCH net-next 2/3] net: stmmac: Use pagepool instead of streaming buffers for Tx muhammad.nazim.amirul.nazle.asmade
2026-08-03 18:39   ` Mina Almasry
2026-08-03 18:53     ` Mina Almasry
2026-08-04  7:05   ` sashiko-bot
2026-08-03  7:05 ` [PATCH 3/3] arm64: dts: agilex5: Enable pagepool Tx buffer quirk muhammad.nazim.amirul.nazle.asmade
2026-08-04  7:05   ` sashiko-bot [this message]

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=20260804070534.240B31F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
    --cc=robh@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