Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp476557rdb; Thu, 21 Dec 2023 15:25:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6Gc5mL4KS7y4nQUyXOXrzm6fwcEeEK763Iy51xrAt5Gs2ZGv48ZuKsUHgGydzWAufrAbf X-Received: by 2002:a05:600c:1f91:b0:40d:18c4:d744 with SMTP id je17-20020a05600c1f9100b0040d18c4d744mr259841wmb.97.1703201119356; Thu, 21 Dec 2023 15:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703201119; cv=none; d=google.com; s=arc-20160816; b=EuqQbKcsL0piCrNl65T1Qx4TOhgpdK7nW/erT8ahdlXd27kL1HyVGzFaIfXZG3RpCS 2dIfK5/90gRpE0lr8ZGfEWFppcui9IOTcg2UWqZVDCljxm8+chcFDtx6zfpK8sKj5qX7 PnGGkgeHhhz6qucQLk3oVUKCYfZ7UBnfYSwKpGts493MqM4NcyD7qOz6lsWD7mmAvZ0c rpngI+ylzO/GkObt3HyQZ8SMIEuwkelq2W4ViFTYALbrXxlpeYeSddweFl2XuuTPUGyU I3A35sLa8PYApw69VgvSBEfyDmaPuR/ZElm/FOeiTOUGVwvacpFOc9omJENoHzwSB7Tg +N6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=cU9mOyLPoF6ZxNM7jnDLVtHU9dKeo3lsrx7E6D/L6sI=; fh=aWoMOscFk7066fEteaA7W7jw4uMzEMvrTVK/xY4P8WY=; b=EujPt2lvIicmwQXSGy2cGG4AXCqZ0tKaeuDVYPTWL/PNoMCnIVBg266IOvu6/xoNSe aCQ1YRyYeOdLpEVLzlls0CRnIui2MeXp57eyOp3rAyhyEKMGUNkKotCshbremZtE9+7D 1a429F5WehNCx09cSQFEuXobXAWvFwo8o6UtR6BO4ouTo9d/N//8KkTU9VJ8QlhmBqJD H+oTBjT95xV1CO6Epz8RzGYZkUTNCLhRKTEHyHrZm2nFp16nszaYbpjpY/YfzXtizFtZ HQMkVvZb0eLkwk21h4WovfQ0lWtCz50oajCX0sR0h7gPBFW2XpLZwBy1pZVO8NrSi48z a3PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rIee9BHF; spf=pass (google.com: domain of linux-kernel+bounces-9177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ge16-20020a170907909000b00a26ae0332ecsi573103ejb.185.2023.12.21.15.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:25:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rIee9BHF; spf=pass (google.com: domain of linux-kernel+bounces-9177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 212911F24F2F for ; Thu, 21 Dec 2023 23:25:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEF0A7B3C1; Thu, 21 Dec 2023 23:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rIee9BHF" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC98E7B3AE for ; Thu, 21 Dec 2023 23:23:46 +0000 (UTC) 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--shakeelb.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-db402e6f61dso1739083276.3 for ; Thu, 21 Dec 2023 15:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703201025; x=1703805825; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=cU9mOyLPoF6ZxNM7jnDLVtHU9dKeo3lsrx7E6D/L6sI=; b=rIee9BHFH3w3Z9YC28rgKtx4jr66VuXGwN+IQzUx04pSGohOdVOf65JlJd+b4wY7CT mb2d02bNRGYDyjAmCf35ji7Qo5w4J6W+uR4MoHcrA3sFVi28tEvIqu3o/tuL/eMBSSlx TaWrPrRdCXBVUHD5I6urFnQzzUSZvivuA/lTJVfOncmM1YtQxtJrw1vAKIpLQOPwujKu LYs2vQJkbg8cK+SfRZsV9vxpYa8hXE+XQSj1cYSgol5uj8GAPrT59Wdv9tQezatc4EEF xdCeqO6owtLWCZn/5FT8/qdhBI8a2hex6djOc5zW5mtvTPyd1qdJ0symVw27M5UT+I7u EWng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703201025; x=1703805825; h=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; bh=cU9mOyLPoF6ZxNM7jnDLVtHU9dKeo3lsrx7E6D/L6sI=; b=aKcCPInP57k2eB+TCmWx1sUjrVvFpa+eZr+Q+aKjlKnQKJ1iCMwgwRNZdhwmPZ276/ YbtMVri3ZPAbupuHixVJ5BuH2nm3L9JkENcWLsKyJIk9c6IO3IcyszkRlV626BWMqfZj MZ3ySSn6cm+9Tmg0QUY44TNLQGL81z5xm0+pLmskVtCSEvOvh19Oxz1xq/tgIqVXi8Fq Iq3fAg8yJONsbRgDPDD6JhY2fFQ9OWB5FeSgneKQz6khmzr6HqfA7WTwR5ilXTseEF0Y OvoKAH7iq9mr8sBFnxFp9FXZ8vrQP6nHr/w+JlGkNs8EMHNa1idG68fYFWLkDYMjO0Nw 7SzQ== X-Gm-Message-State: AOJu0YxMNFp4SSzn4GM1kOObtxQGJU5epn/m8QQ/hawcNr4ksI8eVXYP 9gtjmBYjb9ub7hs13ArVtNuH6HpKrgcXOtOM0R2m X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:262e]) (user=shakeelb job=sendgmr) by 2002:a25:bcc2:0:b0:db5:47c1:e82d with SMTP id l2-20020a25bcc2000000b00db547c1e82dmr189052ybm.6.1703201025720; Thu, 21 Dec 2023 15:23:45 -0800 (PST) Date: Thu, 21 Dec 2023 23:23:43 +0000 In-Reply-To: <20231220214505.2303297-3-almasrymina@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231220214505.2303297-1-almasrymina@google.com> <20231220214505.2303297-3-almasrymina@google.com> Message-ID: <20231221232343.qogdsoavt7z45dfc@google.com> Subject: Re: [PATCH net-next v3 2/3] net: introduce abstraction for network memory From: Shakeel Butt 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?=" , Yunsheng Lin , Willem de Bruijn Content-Type: text/plain; charset="us-ascii" On Wed, Dec 20, 2023 at 01:45:01PM -0800, Mina Almasry wrote: > Add the netmem_ref type, an abstraction for network memory. > > To add support for new memory types to the net stack, we must first > abstract the current memory type. Currently parts of the net stack > use struct page directly: > > - page_pool > - drivers > - skb_frag_t > > Originally the plan was to reuse struct page* for the new memory types, > and to set the LSB on the page* to indicate it's not really a page. > However, for compiler type checking we need to introduce a new type. > > netmem_ref is introduced to abstract the underlying memory type. Currently > it's a no-op abstraction that is always a struct page underneath. In > parallel there is an undergoing effort to add support for devmem to the > net stack: > > https://lore.kernel.org/netdev/20231208005250.2910004-1-almasrymina@google.com/ > > Signed-off-by: Mina Almasry > > --- > > v3: > > - Modify struct netmem from a union of struct page + new types to an opaque > netmem_ref type. I went with: > > +typedef void *__bitwise netmem_ref; > > rather than this that Jakub recommended: > > +typedef unsigned long __bitwise netmem_ref; > > Because with the latter the compiler issues warnings to cast NULL to > netmem_ref. I hope that's ok. > Can you share what the warning was? You might just need __force attribute. However you might need this __force a lot. I wonder if you can just follow struct encoded_page example verbatim here.