From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 CBBDF606A322 for ; Sat, 5 Dec 2026 12:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=y1lT0tQd; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=feCGBomG Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A2E106064F; Sat, 5 Dec 2026 12:52:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id t9sBn2O34bCJ; Sat, 5 Dec 2026 12:52:42 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org BC86060651 Authentication-Results: smtp3.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=1796475162; b=sSw020oyOkGBKXEIOcq31wUahkyckU/l5mavf4jaw0XaE03xFat24vtaqE6NhC46S1mB xj7OZuYaCJuqH6oRBz+p7lZIwrI/hUG3GASh2Klqb7H4MIsTUieML6UtoO0kDeyd4US/D J8iwTpy21mqAZS1/OZc1Kgdc4RNOtuX1rQ01wjzSBQ11kHzxazNwgiuqkJdILkOWvS0nc 9QI35rrLoLyY/ECNY7zuCnSpbtJSXrMFxNMgClDZAstIKky3kxzpGXextfELek6V29zsc cXT4X+llykkJxKvPahprnoVIKONEy7ywr8Mz0o9tSEtfZJr9CCvYDcj67S/lps5YGfQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796475162; 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=As1BBpQnOZMMS55YtdN9wPzlprOqtfvuSBZkbEKCfPw=; b=nfYnJE5EeWzZ9giCK8QzJvKKVP/Qo0h2WN0+t9/Ywn+CAJfy0WYCgZvCFLdnq6OtiYVY YvXfSsMRpN5vi31Fm8vhOto6SORgr4MM/Q2siQvfe3yWsYL4UB9RwrngE8dgTirbrnIxx 9V+TvK7UAvZ06MG9rNCfGkWOlW0xhf3pe2+Z8wrgEvZCFP/xVQyy+csBxlx6bje/pmc4L 9yzVrZlW6KFmqMJhWDG1/msjFkwK0iutdtEt6+Qc1Go6F1MDL/as70nSOl44IvvzwHIXz qPpaTd/up9/yyvbkgNYODaBWnSjVKcIR+uQ7XqXsMEN7SaJ++3zk1UJAa6eIct8Qcjw== ARC-Authentication-Results: i=1; smtp3.osuosl.org; dmarc=pass header.from=google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=feCGBomG; 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=1796475162; bh=As1BBpQnOZMMS55YtdN9wPzlprOqtfvuSBZkbEKCfPw=; h=Date:Subject:From:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=y1lT0tQdlOSYzdIIk0/F3rS13xaF1VYc+JxvggnRHZGG6Y3TZS56wYj82lUrotd+G 5jhfcKVpU8UZJW6jliL1ASN4C+dZxv8YFQLDtFIcY/oag4jvSAPor3ZDn5U+KGriav tTgHB3tGNxTIi/vjo/Vo09eynpepsTTsNsJfTBx+vClUmtZiI2Pl1DrLiOw2Y4vbxE tW22+ohQ3dWk353zkGai3OpKpVaf6jIhVCsIXmBKGw5D5GFPf+M+8oQElnccyKXB29 F3yEWl4+84OoA83O53pvMpeMMOwW4O2idGHGoZpzMU15X1M4PFhgQeic7JxgbO0uOu AlnD3E12covJA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id BC86060651; Sat, 5 Dec 2026 12:52:42 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id BF02A2BD for ; Sat, 5 Dec 2026 12:52:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A4C6660651 for ; Sat, 5 Dec 2026 12:52:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3itYg9CKLoFN for ; Sat, 5 Dec 2026 12:52:40 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 6781B6064F Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip="2607:f8b0:4864:20::646" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::646; helo=mail-pl1-x646.google.com; envelope-from=3fwkuawykd9geohcsoaiiaf8.6igchn8f-qcl87-f4hfcmnm.imoimf.ila@flex--kuniyu.bounces.google.com; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=feCGBomG Received: from mail-pl1-x646.google.com (mail-pl1-x646.google.com [IPv6:2607:f8b0:4864:20::646]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6781B6064F for ; Sat, 5 Dec 2026 12:52:40 +0000 (UTC) Received: by mail-pl1-x646.google.com with SMTP id d9443c01a7336-2f19a986336so12489525ad.2 for ; Sat, 05 Dec 2026 04:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796475159; x=1797079959; 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=As1BBpQnOZMMS55YtdN9wPzlprOqtfvuSBZkbEKCfPw=; b=feCGBomGtTJ8Bp8JQ11Gh9y2+V8PkxBq/k1SnU183LBkZdNzwi357KDpGWiSi9gvhn EQwwPnZizTyYQi/QMuEdCD5lo8PyGn0PMY/Azp3bVzNE5egnZf+evsMWOR4w5AWf4clh dpMJ4OBzl0GvkJCAA5WMya3N2SsA2sAnr1uuoo2xdKhSM/M5Abonn4CRaBDI5aK/+H1K Hx1OG5lRFzXrn1KBQC0Fa06Cn8BN4W+HO18CEDtVV10uTTJfmAFYFjXcS7fESBfNmrBc qomB+Capbg+DDYwU854DksbrEaY754zSm2R4fqIt4s6vgizgikFB9lbKUnfL3NlRSFv9 UBGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796475159; x=1797079959; 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=As1BBpQnOZMMS55YtdN9wPzlprOqtfvuSBZkbEKCfPw=; b=Ue5jgvYBAIDB3dG7Dv4NARKjLsySkkRdS4GOPKsHuOKJvu1/3LChKTo7YIzohGrkug NFpG8ZiVi2pFTp2sPUdjxcO7t2UdWrIERGQ9U5LSoNAyOl4HQ36ONykSsPTs8T1sQTsL Z8uO6sCgkOIX61/iwZQOUPQlbSpmwsZMobDb4ZnHUBSCr9S2viEKDlkbgBJyW9r9UJXS 2FF+4udHwJFNK2YREEBnJ6hhr5XRt0Cmm7bDWA4ArLiec8a1dUB2VPaVySZZfGbdvv6I c4MkYu9ZwrH9YtVvWmetabJwzLOOFDAx8ltAtXW425hBMCW9qs9qQ/nwNWg+avsC4rCX tjyQ== X-Forwarded-Encrypted: i=1; AL+hErEb5ktOTOc3oF3RroGb9cYMLy4anWs6oTaPajyXdfr9zeC1A4U+DXCONPpZaxH3uNC1M+7rTs+c9nNuSL7ntv4=@lists.osuosl.org X-Gm-Message-State: AB4q+uG9R5Koybx9RHYxNj5IWJTipgZz5y995V1nxFQkVaPmmSzqNFSR 44pqoZ1PPsiHrUZtc709DARuJlQJs+k9+aR9r749v+dLB2GJrwPkpQeaVLL8pNSJgKo0KzXfs0a F01hy/Q== X-Received: from plal21.prod.google.com ([2002:a17:903:55:b0:2e9:5b68:4b7d]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:1111:b0:2ef:d7ed:80dc with SMTP id d9443c01a7336-2f1ba21dac9mr47953765ad.49.1796475159178; Sat, 05 Dec 2026 04:52:39 -0800 (PST) Date: Sat, 5 Dec 2026 21:52:18 +0900 X-Archived-By: Mime-Version: 1.0 X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261205125237.2290932-1-kuniyu@google.com> Subject: [PATCH v2 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU. From: Kuniyuki Iwashima To: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Jesper Dangaard Brouer , Ilias Apalodimas Cc: Brian Vazquez , David Decotigny , Li Li , 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.6 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_NONE,SPF_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 allowing page_pool pages to be unmapped early in idpf once active DMA mappings exceed a per-queue threshold: 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 annotate concurrent accesses around pp_magic and add opt-in page_pool early DMA unmapping (page_pool_enable_dma_unmap(), page_pool_dma_mapped_pages(), and page_pool_dma_unmap_netmem()). Patch 5 enables early DMA unmapping for idpf Rx payload queues without XDP on DMA-coherent devices under IOMMU_DOMAIN_DMA_FQ. Normal page_pool DMA caching is kept while active mappings remain at or below a per-queue threshold (splitting a 2G IOVA budget across all vports), and pages above the threshold are unmapped once their descriptors complete. With this series on the same 100k-flow workload, server-side Rx drops fall from 13.8M to ~460K (steady state), client retransmissions drop by ~8x (from 20.8M to ~2.5M), throughput recovers from 161 Gbps to 177 Gbps mean with zero 56-bit DMA fallback, and single-flow same-CPU tcp_stream (1 queue) shows no regression (97.35 Gbps vs 97.35 Gbps baseline, compared to 68.49 Gbps / -29.6% with v1). Note: Two pre-existing Rx header split overflow fixes (in idpf_rx_hsplit_wa() and idpf_rx_rsc()) are sent separately to iwl-net: https://lore.kernel.org/intel-wired-lan/20261205124319.2264197-1-kuniyu@google.com/ Changes: v2: * Replace v1's unconditional DMA unmapping (page_pool dma_sync_for_cpu and libeth fq.no_dma_map patches, which regressed single-flow throughput by ~30%) with opt-in page_pool early DMA unmapping (patches 3-4) and threshold-based unmapping in idpf (patch 5) * Coalesce contiguous payload frags and count dropped EOP frames against NAPI budget in idpf_rx_splitq_clean_skb() (patch 2) v1: https://lore.kernel.org/intel-wired-lan/20261202065737.207610-1-kuniyu@google.com/ 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. netmem: Annotate data-races around pp_magic. page_pool: Allow drivers to unmap DMA before returning pages. idpf: Unmap Rx payload pages above mapped threshold under DMA-FQ IOMMU. drivers/net/ethernet/intel/idpf/idpf_txrx.c | 569 +++++++++++++++++--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 29 +- include/linux/mm.h | 4 +- include/net/page_pool/helpers.h | 26 + include/net/page_pool/types.h | 16 + net/core/netmem_priv.h | 8 +- net/core/page_pool.c | 107 +++- 7 files changed, 651 insertions(+), 108 deletions(-) -- 2.56.1.915.g69d5ec7298-goog