Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1841173rdb; Tue, 3 Oct 2023 02:41:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVLZCd+sI1ycbOZ85yjQbpMv5s8wMj115KOqtvGHRQkaZCPWy47y4JqTs4YLgglf9HalAi X-Received: by 2002:a05:6a20:d430:b0:163:2dc7:d077 with SMTP id il48-20020a056a20d43000b001632dc7d077mr7716448pzb.55.1696326112392; Tue, 03 Oct 2023 02:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696326112; cv=none; d=google.com; s=arc-20160816; b=GduwU/D4vsxkZIwuf99UBUhMuItrGTMaZVkV9osF4E0Vdy6eIOzUTmSJ70oOEJsnvF sW/tmqbuTtrj9/sPtQp7wMoGiHy5D4G2Tws3XjA/yqm4hREFgEHPZrJ8vXvCcPCXJ5SP sb/F1IJY5u7PnDysMua14cZg7Qy8tSimQ+D1h2e4Vk5gqgeRbObM8BHN8qytyhUEye7/ I2Szpfoa4rnKt5QslAO4MCuzzzNM6XpvgZPj55b30jqTJJKSZlOqV6PKGOz4yx07NsFQ ibQEnjksskWAqXeeZA+58V81S5f42S4nJDvJUO4+44oqOlCirKpZ1z0WYDpNpJOt7u7s oWBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6GYoLfhpjKn+Ov/B91dyx3sCIeGji5aj/3JFe9K4TQ8=; fh=DqVtn8R6+qV81nyWi7Y5uSmvyB5D0Z1LhTbZLFZqUkA=; b=lZqQm7UB5KiX9o6FJHUn10oKyZsiCnhYn7hP+8k6BCosIeKRrsHqEmPqe1uFg9V9+s 4iptvijF6AXUeyAMHmiY+9iF355Vt3XJXex4OXvb/Py79DqXDPDDLNW1t/aWKfdQ79rP YQpgqExk+ks+WNauW/wNZT9aqJRP9UkSR4HU1DscqhiZsCtjVoA8uqBTMfaCmXb+6HKX Llm8JTJJJDaBtCbh6LgWSmpBBEIItSah3iZhb4LmnY2o1OlD0o6j0xc5ltJQxATcOzsg 9lncNqDkHbHP+x+OtUvBqCXjMvT5NQFZfDMPTBe4DcUNaHR3Tc6vPgyJWMYn75FeJ9Nw 7s+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MwXx3CX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id be11-20020a056a001f0b00b0068fd0b1bd61si1101596pfb.50.2023.10.03.02.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MwXx3CX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1B56F80267EE; Tue, 3 Oct 2023 02:41:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbjJCJk7 (ORCPT + 99 others); Tue, 3 Oct 2023 05:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239683AbjJCJkz (ORCPT ); Tue, 3 Oct 2023 05:40:55 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2CE4C6 for ; Tue, 3 Oct 2023 02:40:51 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50481a0eee7so5017601e87.0 for ; Tue, 03 Oct 2023 02:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696326049; x=1696930849; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6GYoLfhpjKn+Ov/B91dyx3sCIeGji5aj/3JFe9K4TQ8=; b=MwXx3CX/2Khx0PyMJNbeEIAG4LSuDyUFvPIPs5X39OsfSs+8bsfV0XLjEZE9pH8/me VYyp+AWWy4PxZ0UJuuX3STY/6NzTyncn6JamIs09AieqmCDZYMTRv9E6SiaxT4JLjP21 PWcLkKpO07qqAENxQtCTicpkqyzqpzaxJL5fTvecms+r95G1LNLs5XlhZn1SshCJP4bJ PYrKJD9aP3wZYAL6USlpsfDeUiz2lXbAWdg+W/i4WbJcgjx3mDf9pVSRMW0DEfKPLCTR ZBkI8tLgdxE5TL5nV3zfCLeHldMdJ34KOK/fWNp1qTKb7MqpHeCCanKFRiydecfDBZos Vxmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696326049; x=1696930849; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6GYoLfhpjKn+Ov/B91dyx3sCIeGji5aj/3JFe9K4TQ8=; b=ggA76Cy0QFysGri0wZNjzU7u3gZlS6URLTsF/yTS3VZWR5qJDk/BhfemKdWWHoBJAf WpX8N01kZ2kwMQVhk46iy79jHF/dhEoJg+/iMg3qT7JYJwv+mtwqbcg0o6OrOPtINjQc jPOkZlxdcCOTcp7Rpv7R34UeTmKu8/1Ih9ubAGj4DX6k7ToVfj+CL+NAD18OGLqNabvc dVp07KRSHabIm/YrxXfdx/Cue/iff0RTnVq3748EjZVnOXmEwVLidGBFb8OL5lSZd6Nh 0dWd/xvuscgsYu9jbyyJGqT/cHMCDPwruu/bnDV8E8/nN+fUrCOK9sNgXQ664z94oRjs Jtrg== X-Gm-Message-State: AOJu0Ywz3EY5c6v6rxMRN6z9ZkcwYAxk3OFaqGh4q7bRrwSDra5RiX+9 ZVQfENKCu0wAM6LOwMlV4FB8EKrLj8z+bBYoMCNPCw== X-Received: by 2002:a05:6512:3d04:b0:500:7aba:4d07 with SMTP id d4-20020a0565123d0400b005007aba4d07mr2044702lfv.22.1696326049577; Tue, 03 Oct 2023 02:40:49 -0700 (PDT) MIME-Version: 1.0 References: <20230922091138.18014-1-linyunsheng@huawei.com> <20230922091138.18014-2-linyunsheng@huawei.com> In-Reply-To: From: Ilias Apalodimas Date: Tue, 3 Oct 2023 12:40:13 +0300 Message-ID: Subject: Re: [PATCH net-next v10 1/6] page_pool: fragment API support for 32-bit arch with 64-bit DMA To: Paolo Abeni Cc: Yunsheng Lin , davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , Alexander Duyck , Liang Chen , Alexander Lobakin , Guillaume Tucker , Matthew Wilcox , Linux-MM , Jesper Dangaard Brouer , Eric Dumazet Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 02:41:04 -0700 (PDT) Hi Paolo On Tue, 3 Oct 2023 at 10:46, Paolo Abeni wrote: > > On Fri, 2023-09-22 at 17:11 +0800, Yunsheng Lin wrote: > > Currently page_pool_alloc_frag() is not supported in 32-bit > > arch with 64-bit DMA because of the overlap issue between > > pp_frag_count and dma_addr_upper in 'struct page' for those > > arches, which seems to be quite common, see [1], which means > > driver may need to handle it when using fragment API. > > > > It is assumed that the combination of the above arch with an > > address space >16TB does not exist, as all those arches have > > 64b equivalent, it seems logical to use the 64b version for a > > system with a large address space. It is also assumed that dma > > address is page aligned when we are dma mapping a page aligned > > buffer, see [2]. > > > > That means we're storing 12 bits of 0 at the lower end for a > > dma address, we can reuse those bits for the above arches to > > support 32b+12b, which is 16TB of memory. > > > > If we make a wrong assumption, a warning is emitted so that > > user can report to us. > > > > 1. https://lore.kernel.org/all/20211117075652.58299-1-linyunsheng@huawei.com/ > > 2. https://lore.kernel.org/all/20230818145145.4b357c89@kernel.org/ > > > > Signed-off-by: Jakub Kicinski > > Signed-off-by: Yunsheng Lin > > CC: Lorenzo Bianconi > > CC: Alexander Duyck > > CC: Liang Chen > > CC: Alexander Lobakin > > CC: Guillaume Tucker > > CC: Matthew Wilcox > > CC: Linux-MM > > --- > > include/linux/mm_types.h | 13 +------------ > > include/net/page_pool/helpers.h | 20 ++++++++++++++------ > > net/core/page_pool.c | 14 +++++++++----- > > 3 files changed, 24 insertions(+), 23 deletions(-) > > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index 36c5b43999e6..74b49c4c7a52 100644 > > --- a/include/linux/mm_types.h > > +++ b/include/linux/mm_types.h > > @@ -125,18 +125,7 @@ struct page { > > struct page_pool *pp; > > unsigned long _pp_mapping_pad; > > unsigned long dma_addr; > > - union { > > - /** > > - * dma_addr_upper: might require a 64-bit > > - * value on 32-bit architectures. > > - */ > > - unsigned long dma_addr_upper; > > - /** > > - * For frag page support, not supported in > > - * 32-bit architectures with 64-bit DMA. > > - */ > > - atomic_long_t pp_frag_count; > > - }; > > + atomic_long_t pp_frag_count; > > }; > > struct { /* Tail pages of compound page */ > > unsigned long compound_head; /* Bit zero is set */ > > As noted by Jesper, since this is touching the super-critcal struct > page, an explicit ack from the mm people is required. > > @Matthew: could you please have a look? > > I think it would be nice also an explicit ack from Jesper and/or Ilias. I am trying! Unfortunately, it's this time of the year when I have to travel a lot. I'll be back in 15 days from now and I will be able to have a look Thanks and sorry for the delay /Ilias > > Cheers, > > Paolo >