From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68BB6606A31A for ; Wed, 2 Dec 2026 06:57:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=rv1ZF7XT; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=R/9SW9/i Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3BCCD80BD4; Wed, 2 Dec 2026 06:57:44 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id uXfojgtHXuN7; Wed, 2 Dec 2026 06:57:43 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 9DEEB80EF4 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796194663; b=rfLytZnBnxFvCKmMalTbgbhm94PijrJ684AkhOKQkFOyMyY6dba4OuX40DJ5jC5KWYkS x4pKTnnjW+j5YLqR845iY+zGN5FMxiXaeihPzt5kHKIyjNDOY5SOF6r7UmU9D0WwH7BAv 9GFpL2UhSiNvNLZuc1XTBHLdQtXP1TkNcbwXjHybSf88k3USBqjizcoLlPGkJ/WG/Mk9a mcY2BRDl9Gwr2UTPvHrNqOx3ZFFG32pe0FhR7EaLisjQFY33Re5sJIBaMINWY1Q8NyjyM tNVPCOzHVu7vFcgSRDKflAjb+hHFNOFvs86IYLXlxIZOEl0kkyH0XIwWpmw+zgpBVsA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796194663; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Received:Date:Mime-Version:X-Mailer:Message-ID: Subject:From:To:Cc:Content-Type:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=y5ffPP4z5O5CnUAGa7f2a6Scyw13JAfDsQQjPAwuQBU=; b=YmBsUZJaPPfC4Y+VocKO0juhmgfIWs6dNcWSxEvdMhKxSiRPQw08mobeyFdKHrBNn8/C FVQLaHHQ2XvRrX51i85x94SiX7LQvZovJt8yerHIahTHxMcGdxcjnCGvAhvIRrKpFyQiv scNmD5cXxXfu+BAUxxAc/f7uJoTt0vaolg2ZYRo88bf1xV5uHk2Og9rUIzopLhh9GnvJv CDKek8JsEbePDh6Z2TJ4mEIueERKeNU1y/BgoePGj7bJ4OisntxyJIia5lfrca98vBajd c+yMqMFPn8QFXbh0jCawSq81jbOqnHZZHxhO0r7MT3RBnILHzJbxj5FPHuSqU5eewiQ== ARC-Authentication-Results: i=1; smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796194663; bh=y5ffPP4z5O5CnUAGa7f2a6Scyw13JAfDsQQjPAwuQBU=; h=Date:Subject:From:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=rv1ZF7XTYGnZEAtgKhs93PO0ZyEcg2Zi3V6mCnnTSEMYSoZUCfH7Q+tvS4O69GjJp Tf/0L6ST5VSiS7LGiX88A3GsXEX20WkPesISSmQv6zKa7moH1js3doA+d6DutIzYrk gH9PkJMxbnoIFjsexQZQaPUvYIZqDUqju+o63JGjKw6kKc/ich8dZpyWCNTcT/UO6I PcC//g17CcO2oxYhEDf5eApikrLth1UgYQwgFxpoPyVMnqcsfu63HMaXnvIokl/dqs Gl8PoqiZyLydeNKyDThcmgNiKe4REPQNw5eQZhfqD+0RoOxfIiRkbK/R3AXKrm5isF xJ2TzrSWOKWHw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 9DEEB80EF4; Wed, 2 Dec 2026 06:57:43 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 06ECD2E4 for ; Wed, 2 Dec 2026 06:57:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id ED8734063E for ; Wed, 2 Dec 2026 06:57:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ES_is_wZI9xK for ; Wed, 2 Dec 2026 06:57:41 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org 4361D40608 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2607:f8b0:4864:20::445" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::445; helo=mail-pf1-x445.google.com; envelope-from=3y8epawykd4qs2vq62owwotm.kwuqv1mt-4qzml-tivtq010.w02w0t.wzo@flex--kuniyu.bounces.google.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=R/9SW9/i Received: from mail-pf1-x445.google.com (mail-pf1-x445.google.com [IPv6:2607:f8b0:4864:20::445]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4361D40608 for ; Wed, 2 Dec 2026 06:57:40 +0000 (UTC) Received: by mail-pf1-x445.google.com with SMTP id d2e1a72fcca58-8a01e2962a1so10158367b3a.2 for ; Tue, 01 Dec 2026 22:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796194660; x=1796799460; darn=lists.osuosl.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=y5ffPP4z5O5CnUAGa7f2a6Scyw13JAfDsQQjPAwuQBU=; b=R/9SW9/idaMkB7qPSOD6jvA7nYc6RHPNcFTdNjOwO/LznDE1jFPvHvqIvolrOtREXL T7Huq7qAXJubSJlloRUdVJIm+bzmCH+c+WTBZHGigqWt8jJiiG93DU7vE5RjddU9oFql nVJ3gRYqS3t1TmJV2aeuhXKJhNIBL20wt+GweXiQT/EsOJ+3Tzbs12eJqKmKC6SpYbhf 7tSVVCA7OMtKzLwfCoYuDWcIbozBuxF5uxWkjXGFreUYiuXPINW79gZfsE8D81b+xs/K t88WCPK4dLNrIKO2dT1e2++mcWdtC5OCXk9GrTAXDyZlRj6mYVLcfb4RsJq3h1g9IBbS kTiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796194660; x=1796799460; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=y5ffPP4z5O5CnUAGa7f2a6Scyw13JAfDsQQjPAwuQBU=; b=C/eGIEb4U5RcjH2rQf8lRMDFiUFIGbtvzfGH9MQfXkCt7jwroNxMELwE+FVA8BbqfN c1Psj/zBPZEojHvcUeM/Ke+9mfXacnGVrbXUKRtROVvMkoXmQLN3VbZI8oXxtbgk8kBk uEPRPO/sJW3sUoLnhbU4zuKp4zzZxvQvNJ4f25cJFqARTBWTvRLqSEvHaZ4ANZB8kTWl qg3Ec+lGBlxBDYuJdSfYQVM15rHqCpMBhOIQ0pLwzqxtZ6YZMQX9HGA4VSL0tof4xCGf e8PYJm2HtRKF0WkWFwlv1bOKW/SeWUCZ5bi96tmUmK5Y1t+FCH+gfAyuKEWURIGMoxkG L6fw== X-Forwarded-Encrypted: i=1; AL+hErE4j6xYV1Ov6BrSRyVh2+SqDGOJzAqr9GjvU281nWyTVDkMD9fPsxKX+myEhh0fv5Aa2zyfcu84dFbxKWyYjqo=@lists.osuosl.org X-Gm-Message-State: APuU4Z8Z2IEYqBWUdzPlprqWC79SAqb3Vhb+kaBiLfPOt1gbxAxg3ZRm nViPRu89ppPWfDwaBy20YYAPu5oA0AywBTAQp897flQavFSF1MIoR7/8Sr9mFMBqEEwpSTtz3Kd wl1RcFA== X-Received: from pfai2.prod.google.com ([2002:aa7:9082:0:b0:8b6:bd4f:bca9]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:130f:b0:89f:9fdb:a99c with SMTP id d2e1a72fcca58-8c87daf673cmr39964611b3a.55.1796194659928; Tue, 01 Dec 2026 22:57:39 -0800 (PST) Date: Wed, 2 Dec 2026 15:57:18 +0900 X-Archived-By: Mime-Version: 1.0 X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202065737.207610-1-kuniyu@google.com> Subject: [PATCH v1 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU. From: Kuniyuki Iwashima To: Alexander Lobakin , Tony Nguyen , Przemek Kitszel Cc: Kuniyuki Iwashima , Kuniyuki Iwashima , intel-wired-lan@lists.osuosl.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-21.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Under an IOMMU DMA-FQ domain, page_pool keeps Rx pages DMA-mapped until they are returned to the pool. With many concurrent TCP flows, packets waiting in receive and out-of-order queues during retransmissions pin thousands to millions of payload pages in sockets, exhausting the 32-bit IOVA space and causing alloc_iova() contention and Rx drops. When running tcp_stream with 100000 flows, # tcp_stream -6 --suicide-length=2000 --min-rto=5 --num-threads=256 \ --test-length=30 --num-flows=100000 --num-ports=20 -B 65536 on the server side, Rx payload pages pinned in socket queues saturate the 32-bit IOVA window, causing every subsequent DMA mapping (including Tx in idpf_tx_splitq_frame()) to contend on alloc_iova(), and perf shows heavy contention with 13.8M dropped packets: 21.62% switchto-defaul [kernel.kallsyms] [k] queued_spin_lock_slowpath | ---queued_spin_lock_slowpath _raw_spin_lock_irqsave alloc_iova alloc_iova_fast iommu_dma_alloc_iova __iommu_dma_map __iommu_dma_map_phys iommu_dma_map_phys dma_map_phys idpf_tx_splitq_frame dev_hard_start_xmit sch_direct_xmit __qdisc_run # ethtool -S eth1 | grep -E 'ingress_drop3|rx-hsplit' rx-hsplit: 92006 rx-hsplit_hbo: 393 ingress_drop3.packets: 488310980 # before neper ingress_drop3.bytes: 1989178010650 rx-hsplit: 27779097 rx-hsplit_hbo: 611 ingress_drop3.packets: 502138587 # after neper ingress_drop3.bytes: 2046991419840 # dmesg [ 1291.279869] idpf 0000:01:00.0: Using 56-bit DMA addresses On the client side, we can see many retransmissions, and the throughput is 161 Gbps w/ 200G NIC. remote_throughput=161031856462 TcpInSegs 19235891 0.0 TcpOutSegs 225122216 0.0 TcpRetransSegs 20767366 0.0 This series fixes the issue by using a coherent DMA buffer for fixed-size Rx headers and unmapping Rx payload pages in idpf once their descriptors complete: Patch 1 refactors idpf_rx_post_buf_desc() to reuse idpf_rx_update_bufq_desc() ahead of the DMA changes. Patch 2 allocates a coherent DMA buffer array per buffer queue for Rx header split when an IOMMU DMA domain is active on a DMA-coherent device without XDP, copying headers into napi_alloc_skb() to avoid header page pinning and per-packet IOMMU mapping churn. Patches 3-4 fix page_pool_init() to enable dma_sync_for_cpu only under PP_FLAG_DMA_MAP and allow libeth Rx queues to opt out of page_pool DMA mapping. Patch 5 opts out of page_pool DMA mapping for idpf Rx payload queues without XDP under IOMMU_DOMAIN_DMA_FQ, tracking per-page active descriptor counts so sub-page fragment sharing and skb truesize are preserved while each page is unmapped as soon as its descriptors complete. With this series on the same 100k-flow workload, server-side Rx drops fall from 13.8M to 84K, client retransmissions drop by 19x (from 20.8M to 1.1M), and throughput recovers from 161 Gbps to 178 Gbps. Kuniyuki Iwashima (5): idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc(). idpf: Use coherent DMA buffer for Rx header split without XDP. page_pool: Set dma_sync_for_cpu only under PP_FLAG_DMA_MAP. libeth: Allow opting out of page_pool DMA mapping on Rx. idpf: Unmap Rx payload pages under DMA-FQ IOMMU. drivers/net/ethernet/intel/idpf/idpf_txrx.c | 617 +++++++++++++++++--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 30 +- drivers/net/ethernet/intel/libeth/rx.c | 3 +- include/net/libeth/rx.h | 2 + net/core/page_pool.c | 2 +- 5 files changed, 553 insertions(+), 101 deletions(-) -- 2.56.1.911.g883d8bcb20-goog