Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp297104rdb; Thu, 21 Dec 2023 09:19:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0D1Xthbw0VZ6hGieHPqh4V6y1T54fNORm6KYA0tgNJjdaPmcjZTYZ2+0j495Mhj5SzS+a X-Received: by 2002:a17:90a:a589:b0:28b:fb7d:80ef with SMTP id b9-20020a17090aa58900b0028bfb7d80efmr50928pjq.74.1703179190209; Thu, 21 Dec 2023 09:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703179190; cv=none; d=google.com; s=arc-20160816; b=J839q4UifD++LElyQfeKyMEXcLA94qZt1O0s7BZg7uJxov69EinSugg6OIjauyZNAk LnsHHGOMB86VEm52feTmowD47LazDprTe7ewOHZuUCOg77B+HQ7VLVVti2jO6NS2xM66 lJzt04oNSFRObhO96d0rU2VetdSom6PM2WJbjrEzKc/ecXhVHIZSOsDno//l/22v1ZlJ hJKpay0AasJ6/LzxKipU+7h0AF4rLJ9NHBMmjC2YPXas9EYdOkdQf2JLDfwWZ15FPyim bZLjQ/npJO6OLkAySHMTpB5qBfmVuRPyuUgpC/Q5J3RZerPj/+T93F5S/61lkNIWgUjs ciDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HwOvid8Bp/OOg15IUwG7EumwuVxLJHEoKSckWsOPqmM=; fh=ydBaZLuqGI8Ar4bbdKd8mexBbISRc8mfkb3xREPmtZE=; b=ypo58x0hklVr3l8Tb/UUZ7kMMmO/5G44NWyaW2X+FP7Aaq20sBxeuqmTjrNeyTOehC deTiMkv2ZuYlJrkfEXVb8+m/shDwQZ4vnN/Euo8UiVHNO7N4NB7K/I47S6Eec7HnNL4u 7v2cHtNuX15lX+XYspkjWLvnlzoYpVxYdK3dMCIK98P+HbWFr6KRF9HJoIWABtyKnpIW xhzAfaQ5Mdt+fXe+OOfSWuCCOfyQ/DiScQAn+WhOx802Kz5HRaGXXflVZuGNseqLNvGg NyCRtUifjHUP5/YyoU8om99iwwMZDfOAdelHHkIhjR6aD8k+nu3b4NByWsKjFuM/O9y7 MaFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNV7lZS0; spf=pass (google.com: domain of linux-kernel+bounces-8833-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8833-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 22-20020a17090a0b9600b0028bece0ef43si1609003pjr.85.2023.12.21.09.19.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:19:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8833-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNV7lZS0; spf=pass (google.com: domain of linux-kernel+bounces-8833-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8833-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 07808B2456C for ; Thu, 21 Dec 2023 17:18:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27ED6280B; Thu, 21 Dec 2023 17:16:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sNV7lZS0" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D14D559918; Thu, 21 Dec 2023 17:16:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D50C433C8; Thu, 21 Dec 2023 17:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703179018; bh=bDav0XbsAfuTS75hQIrAGbf6XOHLOBml3F4jrPJKbRM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sNV7lZS04yNfQwBOYBAjWpKOF+0V2PPVAW68IkXvXWxedJEnFFhibjmEp3yYsxluM QZv5qNHowjdEWDoJwnYNeOtH0vBKQJ+lsgvXKSpoX1NXUWE+maLerg1iZ/5KQFAebZ n7QFC8A2JK4Fbe+cnDjhHmYJWUBm1RiBW2Us0yy2U/u93Zvbl93f8Ohs72AzTpmBmP ufO+nqrK3HupBJMJ2oXHpxdvbWGZWoNZu1GZZ7s2B2K07g3cJL7UUBhkuFlTki609y EngdiAURpPL2ToYxfKp72oEKGnwF64ErvAMSS6TfTlc1S5ulyHFmI+SNGregsIPAmi zfO8K47XcAEyA== Date: Thu, 21 Dec 2023 18:16:48 +0100 From: Simon Horman To: Mina Almasry Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Hajnoczi , Stefano Garzarella , David Howells , Jason Gunthorpe , Christian =?utf-8?B?S8O2bmln?= , Shakeel Butt , Yunsheng Lin , Willem de Bruijn Subject: Re: [PATCH net-next v3 3/3] net: add netmem_ref to skb_frag_t Message-ID: <20231221171648.GC1056991@kernel.org> References: <20231220214505.2303297-1-almasrymina@google.com> <20231220214505.2303297-4-almasrymina@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231220214505.2303297-4-almasrymina@google.com> On Wed, Dec 20, 2023 at 01:45:02PM -0800, Mina Almasry wrote: > Use netmem_ref instead of page in skb_frag_t. Currently netmem_ref > is always a struct page underneath, but the abstraction allows efforts > to add support for skb frags not backed by pages. > > There is unfortunately 1 instance where the skb_frag_t is assumed to be > a bio_vec in kcm. For this case, add a debug assert that the skb frag is > indeed backed by a page, and do a cast. > > Add skb[_frag]_fill_netmem_*() and skb_add_rx_frag_netmem() helpers so > that the API can be used to create netmem skbs. > > Signed-off-by: Mina Almasry ... > diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c > index 65d1f6755f98..3180a54b2c68 100644 > --- a/net/kcm/kcmsock.c > +++ b/net/kcm/kcmsock.c > @@ -636,9 +636,15 @@ static int kcm_write_msgs(struct kcm_sock *kcm) > for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) > msize += skb_shinfo(skb)->frags[i].bv_len; > > + /* The cast to struct bio_vec* here assumes the frags are > + * struct page based. WARN if there is no page in this skb. > + */ > + DEBUG_NET_WARN_ON_ONCE( > + !skb_frag_page(&skb_shinfo(skb)->frags[0])); > + > iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, > - skb_shinfo(skb)->frags, skb_shinfo(skb)->nr_frags, > - msize); > + (const struct bio_vec *)skb_shinfo(skb)->frags, > + skb_shinfo(skb)->nr_frags, msize); > iov_iter_advance(&msg.msg_iter, txm->frag_offset); > > do { Hi Mina, something isn't quite right here. ...//kcmsock.c:637:39: error: no member named 'bv_len' in 'struct skb_frag' 637 | msize += skb_shinfo(skb)->frags[i].bv_len; | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ -- pw-bot: changes-requested