From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795136848; b=cz1MgHrXkCRSqaZWCpEtZg8i6dl5+oGtp4jVvgqnFi0KMX1QhSf2Lw+huJCIwBf+Rz2S PqsEgT1FmJLroXDDK1rrLSf7t4YXVsKChnaGpzDAwgFkD5NJuBcmGyDqbYORHRMnuzIpQ 2jGCL+CpltD2RG0g9pG3Gxjvyn04KnBrYm7vCGYE8OY7Fzj7lDPZdpCAfJwGvSojAIFk3 5NkNRy7+vlCCMnsWBWOgVEFP9wYK0T/l2MX6Wo+q8c2cywzcaD6yiuc8lUGs6fgxsECT2 E9jplmsQaYGVk48auwD8hN0EMfas5NYQi9B+IoIPhFKRFtI1WJO3qVbX4L/xV7gjc+w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795136848; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=G58QRfdEQzG7y46akZhuXorptjXMkpo3OuC8LCJ2NV0=; b=wv+RLt/vdGjYaMBqDu0hOXKQFt1UQU/0FveYFHZIX1cw/0r1G827BPrA2w+AUJmw7RDW qXPwGqeWW8hCoZy6zSxmFdzonV3KYU0mnEvuipI8v+qotr6+JO4NcJGIDUB1JuHzuVkZT DqwbGqqHJih1FqpW91oA1vmj8949uaBcm1SkDx9bpGuLhccAKtNcpjxppTGu5lCwPpxKn +zjxDJcybWt4pTsoqf0fT6BPLEQzP4tT29/UAJ26YryCKuVdZ9TDaigkhxJEsQWJBruTk 2qGsTkyp8NTfPHBkQeJKmRXwuVHZKo8zPIlVAu2DTLrQmRZjw7J+vJlO8YYkE5lvAww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--lrizzo.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="i/NRDXeT"; arc=none smtp.remote-ip=209.85.208.69 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92DB060A5BE7 for ; Fri, 20 Nov 2026 01:07:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 92DB060A5BE7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--lrizzo.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=i/NRDXeT Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-6ba1338b185so297224a12.0 for ; Thu, 19 Nov 2026 17:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795136846; x=1795741646; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=G58QRfdEQzG7y46akZhuXorptjXMkpo3OuC8LCJ2NV0=; b=i/NRDXeTSYEfEezD5V1XCNniH5DnQR9vfzm+vN5gKK7HSmUVNFLhUWOtZn4LXRiIJQ 7lOr84/ZOjXvt7ritNVVu/osy3RhSUyU3FCk+Pw9T0yIlE0tS9M7K5m0c5cvKVY4vcRh vDQGrnMk78tO+qeqC8ad8KBdcWSowlXT2FagYVCCZtB/EJiLRo+yck6vYxjyaPewi4vR UL0d9YPpJ3xayrffRlaaHIljkm3oTX4gKw2dicVuQ8h3dJIW5pRCbKERyujSv1BcD6ie J2zwyS0rwBonSC+WfgiN2c/3IOZmtmGZKJHfgc25vf4U4QDfGhET0Dxyxo5sdg5s1aQI Jd6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795136846; x=1795741646; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=G58QRfdEQzG7y46akZhuXorptjXMkpo3OuC8LCJ2NV0=; b=zguhrJSNAT6xjg+5utFi4T4sejTHTlozeyvIepbDR27pHSN1yjQo9pLVJDeZJJ9Tci jY8KYVDLuoY0dnKpUyt9TscPFcnUn9hO0IT3YI438jC25k96SkzhOzo6vjJHsU0weCxu SQx36iEhjP/3vblTNImlZPlGrZwR+djbvBlFhdFwnK5hjL8jTvEyFLON66CqQ0HAuomE usDpKEwUbk5wekoSdUcgh3f4DHIQcJpwxedq37NOMXVCl+ZzrEtDgVP2AM+oaqQdm4Br hrV4Z6uYYsqB3jzJOzS2j0/ZdwTyII2Q+KrLk/CRcxDM6LXU6z3f2C3iz6f9QPyH3CJp LMAg== X-Forwarded-Encrypted: i=1; AL+hErEeLRxb//zseh+e+1N5o3k76gJCmDK9+zhyyQe1OdyHp+5OCJdrv17Gyy8zLrG6imJcFMjA4qNhrPk=@vger.kernel.org X-Gm-Message-State: APuU4Z/l2DSQfcBmM0ewLA8xHqa3fNdp2j2WEIwrS1R+/1nLsY2qo1rd pjA++7nAw+gt6t09ZGDOucYPkn+ua9dtWV1KUaRC2AYyEi4AkNakh5pXd70fP57X0z3hO4HTOQA /NFmyig== X-Received: from edag35.prod.google.com ([2002:a05:6402:3223:b0:6b7:7926:2af4]) (user=lrizzo job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:1c05:b0:6b9:c43d:892 with SMTP id 4fb4d7f45d1cf-6ba37c7bebdmr666829a12.1.1795136845436; Thu, 19 Nov 2026 17:07:25 -0800 (PST) Date: Fri, 20 Nov 2026 01:06:52 +0000 In-Reply-To: <20261120010655.467825-1-lrizzo@google.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261109182533.3594984-1-lrizzo@google.com> <20261120010655.467825-1-lrizzo@google.com> X-Mailer: git-send-email 2.56.1.809.ga0b61035b5-goog Message-ID: <20261120010655.467825-23-lrizzo@google.com> Subject: [RFC PATCH v3 22/25] net/libeth: Use GFP_KERNEL when pre-filling RX rings From: Luigi Rizzo To: Andrew Morton , David Hildenbrand , Johannes Weiner , Vlastimil Babka , Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Jens Axboe , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Luigi Rizzo Cc: Lorenzo Stoakes , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , Harry Yoo , Christoph Lameter , David Rientjes , Roman Gushchin , Hao Li , Matthew Wilcox , Jan Kara , Jann Horn , Catalin Marinas , Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Jonathan Corbet , Simon Horman , Jesper Dangaard Brouer , Ilias Apalodimas , Willem de Bruijn , Kuniyuki Iwashima , Joshua Washington , Harshitha Ramamurthy , Alexander Lobakin , Christoph Hellwig , Jason Gunthorpe , Dragos Tatulea , Naman Gulati , Pranjal Shrivastava , Mostafa Saleh , Randy Dunlap , linux-mm@kvack.org, iommu@lists.linux.dev, netdev@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, driver-core@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Luigi Rizzo Content-Type: text/plain; charset="UTF-8" libeth_rx_alloc() is called both when pre-filling RX fill queues in process context (for indices 0 .. fq->count - 2, when buf->truesize is still 0) and when refilling RX buffers from NAPI softirq. Use GFP_KERNEL during the initial process-context ring fill so page_pool and PISA page allocations (including set_memory_decrypted() under CoCo) are not forced into GFP_ATOMIC context. Signed-off-by: Luigi Rizzo --- include/net/libeth/rx.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/net/libeth/rx.h b/include/net/libeth/rx.h index 0e736846c5e8a..4361dbcf03cb1 100644 --- a/include/net/libeth/rx.h +++ b/include/net/libeth/rx.h @@ -106,10 +106,17 @@ void libeth_rx_fq_destroy(struct libeth_fq *fq); static inline dma_addr_t libeth_rx_alloc(const struct libeth_fq_fp *fq, u32 i) { struct libeth_fqe *buf = &fq->fqes[i]; + /* fq->fqes is zero-allocated and pre-filled in process context for + * indices [0 .. fq->count - 2]; slot fq->count - 1 is first allocated + * in NAPI. Use GFP_KERNEL for initial pre-fill and GFP_ATOMIC after. + */ + gfp_t gfp = (buf->truesize || i == fq->count - 1 || in_softirq()) ? + GFP_ATOMIC : GFP_KERNEL; buf->truesize = fq->truesize; - buf->netmem = page_pool_dev_alloc_netmem(fq->pp, &buf->offset, - &buf->truesize); + buf->netmem = page_pool_alloc_netmem(fq->pp, &buf->offset, + &buf->truesize, + gfp | __GFP_NOWARN); if (unlikely(!buf->netmem)) return DMA_MAPPING_ERROR; -- 2.56.1.809.ga0b61035b5-goog