Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp358336pxb; Wed, 14 Apr 2021 17:45:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQYk3PgHxA/m6Z2E8BUloUnGz2qA8aFRWpayhui2fE+5gSnsSgK/z88cqVGMlvMPNq9P/v X-Received: by 2002:a63:d80f:: with SMTP id b15mr987198pgh.432.1618447525280; Wed, 14 Apr 2021 17:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447525; cv=none; d=google.com; s=arc-20160816; b=diCPcwWvFlvApHefpTmdtd/QVm2SuALil22URsmJc/Wk2e9WMH1r2PCpZbtfL3WPkZ vN65gpq/N+Qez8CBgzsWk+oUwhTLk8GYEqRWMlCacL3pPb8Uc+3FqbzephRUpUJjJX8U 9YZWPK4YB0UN7d/c1l0HOglYwl8EgLBnrjQkT0trFeQunCqGyhtO5v/zQnyqiAuFyfkU Dpq1dqAddV5YKSfNk8T5Po8zyqQOmtTu3535w3FRVwym7mBrZwoAeT/faUN9IM9wI+7e b0R8BO2Cd/rtoEWT5gl9/hCPAgDZ0n+rcA9S/D0IHq26iV3oztxYi22c4VgCFYrLBHMw 1irw== 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=MwY/uAWZw4+Qy6L6BtNeYzKjt04mgG0Fmf5rVKjnxzQ=; b=Wev7qhXT0aVG8HEMfx5NQhexZQu7VwGazaXyvKSDaZtROC9YCrb114ZDm3HLrBurql JrWhar4V9Zuqf70Gg1iImLqb+9tIjRXsNOwfEczMtyNDLye2Jlky1TMflsxNl3tKCaNe Mmx62eqcqGTX+stlM21ebM/TcvYY0FcUDehKGFT1yOQTsPgGOGfthbeIcaYwh8Pzd+76 VetBF0ur8qMblithgOPgrGr+IjPcJ4rXDtg5pOOUs4SKytsOFj3T5bnlR53Tmc2o1Z8O BnneFSNJRZGRZ7dLcbemr5s1ZiZsIej0p8ib/CKFTHBsybhXlXGb62cwXT1bulqQ1BDw VJrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ap3ig7KY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si1269685plq.434.2021.04.14.17.45.13; Wed, 14 Apr 2021 17:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ap3ig7KY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbhDNUK1 (ORCPT + 99 others); Wed, 14 Apr 2021 16:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbhDNUKW (ORCPT ); Wed, 14 Apr 2021 16:10:22 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA56C061756 for ; Wed, 14 Apr 2021 13:10:00 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id u20so24586834lja.13 for ; Wed, 14 Apr 2021 13:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MwY/uAWZw4+Qy6L6BtNeYzKjt04mgG0Fmf5rVKjnxzQ=; b=ap3ig7KYnUhag1Gtyu8ju+wZN22X7hJAeGqlif08J6E2FDFZMStFf0J+i5MbXtUumS IzvuAZFclh341ng8JxtdEr2qW9XrlIZXWpjDZb+qgeWbwxE6vWjjGEB/geNPjXxIQclW dFI4IOTCs3fPKR1aHOm/iysJwoR+8kqUtA8mHyxoGySRQcfS+VCb+rZZM7/xiyt/HPID YrSMrjX8rYbjzs5DbiCl29ZXCTZgvVac75YJkITMzGqfEU5saeopAsgC9TvzTPv5274g cWQSom8PzYIEavCa1VDFHlyvioElMYcPnc9kDFdKK4GiYGWLDyOfnxPxwWSmPE8IQGU+ dUvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MwY/uAWZw4+Qy6L6BtNeYzKjt04mgG0Fmf5rVKjnxzQ=; b=uKeC/Vlnkx++qnycUKs/IAHSnzywh7zcSeukllFcXpjjyaOu07ftAMIsMbfXo6L7OC P6cUuKPsrlyXdz91p/ppyX8u7WYQBq4J50HsjAggh4xfRbtmSwV3hcV+D2pouYpRQWxU 4gLM9/bo0i+iyArTriqTe0nzGZWokNdUbMaGtpX2S+sIVV4x8xBod0jQ27r044hywzvk pjJibJFib7hkieATh3xrc0QobcnAFnwQcHeMRqxBz4vNmwED2WQhNgAImytv6uWh/WHq QJ/2tjjIr/p/OyKQLg11EZ4vbxOjHazuyJL1JzGSmGSYbxUMY9MaSoPi+dTUfM317jMT 0nUA== X-Gm-Message-State: AOAM530xvW744ovMhbsDHj8WdKTEHOaLaspju90mMFF5YrSncwphJBXW a2vwZOVDu0k/6QKS8z/VbEPVVlji6oSd3m/WFKwfKQ== X-Received: by 2002:a2e:8084:: with SMTP id i4mr25644098ljg.122.1618430998695; Wed, 14 Apr 2021 13:09:58 -0700 (PDT) MIME-Version: 1.0 References: <20210409223801.104657-1-mcroce@linux.microsoft.com> <20210409223801.104657-3-mcroce@linux.microsoft.com> <20210410154824.GZ2531743@casper.infradead.org> <20210414214132.74f721dd@carbon> In-Reply-To: <20210414214132.74f721dd@carbon> From: Shakeel Butt Date: Wed, 14 Apr 2021 13:09:47 -0700 Message-ID: Subject: Re: [PATCH net-next v3 2/5] mm: add a signature in struct page To: Jesper Dangaard Brouer Cc: Ilias Apalodimas , Matthew Wilcox , Matteo Croce , netdev , Linux MM , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Guoqing Jiang , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Aleksandr Nogikh , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , LKML , linux-rdma@vger.kernel.org, bpf , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 12:42 PM Jesper Dangaard Brouer wrote: > [...] > > > > > > Can this page_pool be used for TCP RX zerocopy? If yes then PageType > > > can not be used. > > > > Yes it can, since it's going to be used as your default allocator for > > payloads, which might end up on an SKB. > > I'm not sure we want or should "allow" page_pool be used for TCP RX > zerocopy. > For several reasons. > > (1) This implies mapping these pages page to userspace, which AFAIK > means using page->mapping and page->index members (right?). > No, only page->_mapcount is used. > (2) It feels wrong (security wise) to keep the DMA-mapping (for the > device) and also map this page into userspace. > I think this is already the case i.e pages still DMA-mapped and also mapped into userspace. > (3) The page_pool is optimized for refcnt==1 case, and AFAIK TCP-RX > zerocopy will bump the refcnt, which means the page_pool will not > recycle the page when it see the elevated refcnt (it will instead > release its DMA-mapping). Yes this is right but the userspace might have already consumed and unmapped the page before the driver considers to recycle the page. > > (4) I remember vaguely that this code path for (TCP RX zerocopy) uses > page->private for tricks. And our patch [3/5] use page->private for > storing xdp_mem_info. > > IMHO when the SKB travel into this TCP RX zerocopy code path, we should > call page_pool_release_page() to release its DMA-mapping. > I will let TCP RX zerocopy experts respond to this but from my high level code inspection, I didn't see page->private usage.