From: Breno Leitao <leitao@debian.org>
To: Arthur Kiyanovski <akiyano@amazon.com>,
David Arinzon <darinzon@amazon.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Shay Agroskin <shayagr@amazon.com>,
harry@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, Breno Leitao <leitao@debian.org>
Subject: [PATCH net] net: ena: Keep the RX buffer mapped if skb allocation fails
Date: Mon, 09 Nov 2026 09:14:29 -0800 [thread overview]
Message-ID: <20261109-ena-rx-skb-alloc-fail-v1-1-aee2927cb51f@debian.org> (raw)
We are seeing the following issue in production on arm64 EC2 hosts
(m8g.metal-24xl, 64K pages, SMMUv3 in strict mode, 6.18 based kernel).
Right after a global OOM, the SMMU reports F_TRANSLATION write faults
from the ENA device, followed by a burst of:
WARNING: CPU: 48 PID: 1656834 at drivers/iommu/dma-iommu.c:1242 iommu_dma_unmap_phys+0xf4/0x108
Call trace:
iommu_dma_unmap_phys+0xf4/0x108 (P)
dma_unmap_phys+0x194/0x2a8
dma_unmap_page_attrs+0x1c/0x38
ena_io_poll+0x7bc/0x1790 [ena]
__napi_poll+0x54/0x220
net_rx_action+0x250/0x520
ena_rx_skb() unmaps the RX buffer, or takes an extra page reference to
reuse it, before napi_build_skb() allocates the skb. If the allocation
fails, it returns NULL with rx_info->page still set. ena_clean_rx_irq()
then puts the req_id back on the free list, and ena_alloc_rx_buffer()
treats the buffer as still mapped and posts its old DMA address to the
device again.
With the IOMMU in strict mode, the device then writes to an unmapped
IOVA, and the next completion of that buffer unmaps it a second time.
If the IOVA was handed to a new mapping in between, the device can
write into that buffer instead. On the reuse path, the extra page
reference is never dropped.
Allocate the skb before touching rx_info, so that a failed allocation
leaves the buffer mapped and unchanged for the refill.
Fixes: 9e5269a915a8 ("net: ena: use build_skb() in RX path")
Fixes: f7d625adeb7b ("net: ena: Add dynamic recycling mechanism for rx buffers")
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 7eb6456ed0d556..15e5cfeb0abe7f 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1009,6 +1009,10 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
buf_len = SKB_DATA_ALIGN(len + buf_offset + tailroom);
+ skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
+ if (unlikely(!skb))
+ return NULL;
+
/* If XDP isn't loaded try to reuse part of the RX buffer */
reuse_rx_buf_page = !is_xdp_loaded &&
ena_try_rx_buf_page_reuse(rx_info, buf_len, len, pkt_offset);
@@ -1016,10 +1020,6 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
if (!reuse_rx_buf_page)
ena_unmap_rx_buff_attrs(rx_ring, rx_info, DMA_ATTR_SKIP_CPU_SYNC);
- skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
- if (unlikely(!skb))
- return NULL;
-
/* Populate skb's linear part */
skb_reserve(skb, buf_offset);
skb_put(skb, len);
---
base-commit: 1d5e2c57e9ffc134e14b3f837c8d7c53b508bd22
change-id: 20261109-ena-rx-skb-alloc-fail-e4f636066c30
Best regards,
--
Breno Leitao <leitao@debian.org>
next reply other threads:[~2026-11-09 17:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 17:14 Breno Leitao [this message]
2026-11-11 23:00 ` 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=20261109-ena-rx-skb-alloc-fail-v1-1-aee2927cb51f@debian.org \
--to=leitao@debian.org \
--cc=akiyano@amazon.com \
--cc=andrew+netdev@lunn.ch \
--cc=darinzon@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=harry@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shayagr@amazon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®