From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.133 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794439264; b=KQMUd/8fs0Cj/UD6dUgJezlYS/+xYkUHpHDpAtbO/boQ12lBd4Xa8ocYDM8iLM683V5e 8GFlX3r07qB3+7HLOS876AzIiFVrACZI9HL4AhmgwBoLJkj0w4TIIuUf/w6G9S73Thky9 5PEPWTWQObrNnZMDel8Y64uuSuKLiUyuTPs7Wcwu8sfUd+HNIDITWPq4QYYa8rhBTRYsV oBFc//1e6FqZkEgtXd66YRnaJSJP9HNrdSBM2Wcx6X/f2ByLsOYDdNK4qh+heuN9DwcTN QC/WVImKTZOWwiV1yyCucgqLo39mdfvXKs7EN+Nrv01CAwUo5UlVJCcad4wFExbZ1+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794439264; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=eE9X9IsI4DGKfcKaEqbUpAyTJeGhuPKiIV6pCis8+mc=; b=gplCviw7R0HENrk5QMS70Z9MdlcEeaFhtg5fu1Q+grnnYMNonQPNe7yAJvC+057DzMWN vaOCWJOtEIcaQIaCdnqlxMUqP+eDz/yS6OF1PdM14Yj+7DBYREqBRY+7fGEWaksAbB2J9 rovqoArnuiRO+P3he+oLbHLcbVF1XDvSpmDYBRl8n/95YEYjZD/hIsVfonZx/VWKu2dXU fXekYH3kBdEwDCyLhGMvrwyKMl7V4N/7BABjkjdark0JeDXPVoexe6dRBAhB78KvKBjUU 04WzsQCVgvidWnu4rXUN5reLjuyxGdhUtXTqJIa5JmhSyNk2/Doiaemsjy3pt872ETg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=AS4FCx2D; arc=none smtp.remote-ip=74.125.229.133 Received: from mail-dl2-f5.google.com (mail-dl2-f5.google.com [74.125.229.133]) (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 CE1A0606A8A8 for ; Wed, 11 Nov 2026 23:21:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CE1A0606A8A8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=AS4FCx2D Received: by mail-dl2-f5.google.com with SMTP id a92af1059eb24-1ac216daf7dso2074477c88.1 for ; Wed, 11 Nov 2026 15:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794439263; x=1795044063; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=eE9X9IsI4DGKfcKaEqbUpAyTJeGhuPKiIV6pCis8+mc=; b=AS4FCx2Dzy3knLqQU0KfBNqF5KUSlkLF7ulR+nDPovTotbPJqyuHWJZbdiqD0hnert Fjrod0191CeZY5GKnOqJQFXEdEHnEc9RnGOSGH5h4p748bHPLDNJ0byXo7dSycqqcU13 OyILZU4dK6tcd2Ci05DZ8FF8yEvMkGJErFQBNpoVdDDqtfOvSHLZqPU/NPmpqdQ/5ur1 G0ewEQXkjx0av1/XfhNJuB0qBTb2u6LImLfzoX4gBMIL2Eoag2sL2m+gsCjyN778IkpV 3mYuBiwwgs25VP7eFbwR1g1h0EZbnCDVpu2l2LNGRuQnz/SV5so618qySg3qt6ExWr2C Jtpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794439263; x=1795044063; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=eE9X9IsI4DGKfcKaEqbUpAyTJeGhuPKiIV6pCis8+mc=; b=ZdW4aSG37M8bhHXinYbmWcGkJGzDG719bhLdEJPw7T3/Xi5DZo9/pqPe6RF3IZnq+1 bLsvLEBr9IOrsdHb8LItdtWnmsGmaw9xPsEV/VwBulBvzHs3EJyvZV6WtFuXTDgJSW7h T0CbEzoOBXV9WFXeHA12rlVo72Q3/vKUn5nU01eqmRuZEiRM/3k+5V5oq6iPgNji+F43 im86NwFi/fSnFrS8Yv+6HQjxH6tvnIWSrxn3zt73XtpsQkGm/WQd6CLmmpMFG/b2SViM l1OCfH7gIrPq7WHlLFivAbGB6ljvDLrVHmXgrybLJK+yeWXtqTzWT9iNXcNzTPWE+ifK HSJA== X-Forwarded-Encrypted: i=1; AL+hErEsrkc1oOy8+/7tj3RYDET2A7O9jLhH27Y8zWduG/OOid7vExwz/ykoZnN39hslb84sT7JT9Ep6nJI=@vger.kernel.org X-Gm-Message-State: APuU4Z/3sillFfVAMQm9Gx4/C7hXfn85/OJuqzWfegNucDBHfIXWMF26 mwKwZS/STxdAO26MoBnHciNX9oXkDuH+Yhb6csVKrXdzapLbV6jWnzx5 X-Gm-Gg: AYBFou0cZg4nQ4lKlKI5MS5rCbSWesFmyVvHsUE6t8PAgmCGnnFyAFBg06NH/49yxNs 6ZEJxnnVSRcHEujME10SaIke1lVSMTVnBtoGEPNay92DFwn1rEayw6TcjXj3cYWM5ekWrj7yC2a eDNTEDNuXVJoatfI4/MGtEtc9K4PttbWHotDZxA4IIPS8fYMxFXUrYoJO+EKFbMhzetVLmFROhz tbIoNUWd0aZhJJ/NZR8Ln/S438p5KMnYeJcik+ouMY7q7mu+QT67mIbU/8k76CZ1PIbv3uwYx10 gKLDWZZToBeBeXDcdLBje7IGNPY2fbBv9Xj6zjxOE9Wt3L30N/h2P5cNouacvQ+xoBpraf5ov59 tLDlRpVY+pqD5U0UDy7x2oWOwiJAOrb9fF3xra99SlyqSGZmxnarrC8ZUNE5zVV7cM2eg0NkPSK nSPiJU2maEiFIlUZCITpEogh7X1Wsi5CFZ0aekppXu0MWA20eFmRvYZr9rMcLxnK8UjcCHnFH7J iWNPa0uSFLsS5Ui2yq/76C+z2cwsVXxj0jbczgKMdsRYzlsk/oQFkJBktly4WPp4RQb6PQ+NYHu ftPrIJfl0KYNPxyAQxEpc60= X-Received: by 2002:a05:7300:1899:b0:376:b957:c01 with SMTP id 5a478bee46e88-376b9570fd3mr5155040eec.16.1794439263001; Wed, 11 Nov 2026 15:21:03 -0800 (PST) Received: from localhost ([2a03:2880:9ff:66::]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3751fe2ff5dsm19921294eec.5.2026.11.11.15.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 15:21:02 -0800 (PST) Date: Wed, 11 Nov 2026 15:05:25 -0800 From: Stanislav Fomichev To: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= Cc: Magnus Karlsson , Maciej Fijalkowski , Stanislav Fomichev , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , Alexander Duyck , kernel-team@meta.com, Andrew Lunn , Jesper Dangaard Brouer , Ilias Apalodimas , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Pavel Begunkov , Jens Axboe , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , netdev@vger.kernel.org, bpf@vger.kernel.org, io-uring@vger.kernel.org, Mina Almasry , "Mike Marciniszyn (Meta)" , Weiming Shi , Nikolay Aleksandrov , David Wei , Alexander Lobakin , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Stuart Clark Subject: Re: [PATCH net-next v1 03/11] xdp: Copy buffers with restricted lifetime Message-ID: References: <20261110102039.1002605-1-bjorn@kernel.org> <20261110102039.1002605-4-bjorn@kernel.org> <87eccra46g.fsf@all.your.base.are.belong.to.us> 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87eccra46g.fsf@all.your.base.are.belong.to.us> On 11/11, Björn Töpel wrote: > Stanislav Fomichev writes: > > > On 11/10, Björn Töpel wrote: > > >> diff --git a/include/net/xdp.h b/include/net/xdp.h > >> index 07231adfb5f8..1105bb9e3292 100644 > >> --- a/include/net/xdp.h > >> +++ b/include/net/xdp.h > >> @@ -81,6 +81,16 @@ enum xdp_buff_flags { > >> * XDP program is not attached. > >> */ > >> XDP_FLAGS_FRAGS_UNREADABLE = BIT(2), > >> + /* Internal: the head netmem and the shared info are in &xdp_buff.ext. > >> + * Not copied to xdp_frames or skbs. > >> + */ > >> + XDP_FLAGS_EXT = BIT(3), > >> +}; > >> + > >> +/* For a head buffer that cannot hold kernel data, see xdp_init_buff_netmem() */ > >> +struct xdp_buff_ext { > >> + netmem_ref netmem; > > > > nit: netmem -> head ? and the same for xdp_init_buff_netmem netmem arg? > > Yup, will fix. > > >> @@ -138,7 +153,7 @@ static __always_inline void xdp_buff_set_frag_unreadable(struct xdp_buff *xdp) > >> > >> static __always_inline u32 xdp_buff_get_skb_flags(const struct xdp_buff *xdp) > >> { > >> - return xdp->flags; > >> + return xdp->flags & ~XDP_FLAGS_EXT; > > > > The only consumer is xdp_update_skb_frags_info, so probably not worth > > filtering out XDP_FLAGS_EXT here? Or is it for > > xdp_update_frame_from_buff? Can we explicitly clear it at the caller? > > It was for xdp_update_frame_from_buff(), but looking closer EXT never > gets there... > > I'll drop the mask. Thanks! > > >> diff --git a/net/core/devmem.c b/net/core/devmem.c > >> index 8f190b574beb..dea4a4a17e86 100644 > >> --- a/net/core/devmem.c > >> +++ b/net/core/devmem.c > >> @@ -698,5 +698,5 @@ static const struct memory_provider_ops dmabuf_devmem_ops = { > >> .release_netmem = mp_dmabuf_devmem_release_page, > >> .nl_fill = mp_dmabuf_devmem_nl_fill, > >> .uninstall = mp_dmabuf_devmem_uninstall, > >> - .caps = MP_CAP_FRAG, > >> + .caps = MP_CAP_FRAG | MP_CAP_RETAIN, > > > > Not sure I understand this part, can you explain? > > These are MP_CAP_RETAIN because they are unreadable? > > No, RETAIN is about lifetime: the stack may hold page pool references > after the RX poll, e.g. skbs on a TCP receive queue. That's how devmem > and zcrx work; without it the stack would try to copy them, and they'd > trip the DEBUG_NET check in skb_add_rx_frag_netmem(). > > A provider without RETAIN gets copied, so it must be readable. I'll try > to make that more clear in the kdoc, and probably refuse a provider that > is neither. Ah, yes, thanks, I did miss that warn in skb_add_rx_frag_netme, makes sense!