Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2190328pxb; Sun, 18 Apr 2021 22:33:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySguJVd5EBHLG4BzFVhXhVIYPON7soYEm8yVc20QnKSk3lQ7G2sffEZzdGXNAc1e0K3z5n X-Received: by 2002:a17:90b:88f:: with SMTP id bj15mr23232265pjb.147.1618810393395; Sun, 18 Apr 2021 22:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618810393; cv=none; d=google.com; s=arc-20160816; b=ctu3o5ow+cULiq1MdryhuT2EGYxx5gOe6Y2wCyLuw69s4KDZBoo1TL2SkwldP/XBVO QKcllqweIV3szv00QOz5WfBpynjBc3wSYzCU6TO+Zrcy/Edehvk1ZJGupxjnKy4UNHa1 UzxxzHJVivLUetOZgJYXNnrjMVQymrvaFnHpeOEikaU3sWjCevdXHT5VcduNJZhMhJSe NF7ortErH1o+CwyKwpzB9NX2dVwMLV82EvXVmg6gq5poccB0LbIOkMLY10f3pilDrr0J G80tJ65mnVZWF28v8HGV6mEmefs8jE+583PuvWs80uPzkFwc/uw9k/PqWMg4Byd0eCp1 ic0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8ofWC35j+mTbhSxNhXaJK905wQN1NLDPBGPqQMOa3eQ=; b=x6dSWCEje2wIyT4yymvfDsitAbYDZoT7r3E9KAA0SKSOzBy+WuGoyt+RjTkeQ9995Z aaZKAifuT/TlD3QMH5qCRK4+HOpXNvomRP81PiVwUXwsp07zKTEcz2cw6hRzQCKYh1zF UgOb/m1DrOkyZQSklgCmSLoGWBE7mz9tLQuZeM8J57INVoTAX0JM3XrAPbJuiZRNuNXj 9WogZY8GOKU2rXlGJYca+ELSc4csAIHUjTsSUtQxZZbqRD0e/SNwvfFND7HtnXnaPC1p jzXINopeO46ReHD+CLB/N+TpfmDk1eAyvVErh5errKYnloyh38EttoxAMP6l3hakKgu0 v3uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IrctopW6; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si14476561pfe.284.2021.04.18.22.33.01; Sun, 18 Apr 2021 22:33:13 -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=@linaro.org header.s=google header.b=IrctopW6; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbhDSFM5 (ORCPT + 99 others); Mon, 19 Apr 2021 01:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbhDSFMz (ORCPT ); Mon, 19 Apr 2021 01:12:55 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E708CC061760 for ; Sun, 18 Apr 2021 22:12:24 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id sd23so42216826ejb.12 for ; Sun, 18 Apr 2021 22:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8ofWC35j+mTbhSxNhXaJK905wQN1NLDPBGPqQMOa3eQ=; b=IrctopW6n++Uebb9it23T0FZjRjZrOUlcZCKLPSu29QZNIiTLFO6vbTVHcjm67FoxX +XryZ6v1nnko8Qadw0FIa9a8U7bNDBNxOgjNi7XSRhViae4kcZDZhYqcDWBmd7Zf2t8I w+rz1dqBOXDSUqJCOi2L1S5u0gQFYtt3XFmat8ud+6GGdDXPJaPHYE2FE8KpFg4Tzba/ Y0rkksO8F/XkcMzyoqV2nJc2yT8dMRprLgJTK2weOql8Fwr+RM0WbsvbNi/LtbE8coA5 MgeifV8B/ubDmAKV2xxhqdCCVOfYkDQVe+cicPvl4Z5zW+Nq/51LGZ79wC4JwaAI+WP3 cLVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8ofWC35j+mTbhSxNhXaJK905wQN1NLDPBGPqQMOa3eQ=; b=RUwgKFx4dzIRlnwJkjlQnpZDg4h3PjQFjJFuaNg2vNM66EFpjyXzhGnZQnsTxJ1Lh+ HDcVOGtCc+Cx0ANXkVVT8qlvNSTZzxkUaIn2gIyUhjLfmiVXdcMYow7DO0UYoppZMv1e y22M7bCj4GMJEeQ7UF7VrWvoYjd3W0u0zMwb45I22DOKpQCBWgMxn02laakkrLmLs5sD /6XbmZYKM2lntUFpwiPJ1tE+BXChIf/vB1wZhxg7o3NZKyJpbS/Qml9+1Zh2Vfpfhrod Lk2x0dD8pC+F3FIbwuSTKHYyhXiz7LLkOLyYuBZQ9PzGJ19TfHoPclt4KwOD9Jg9p8Wt MKhg== X-Gm-Message-State: AOAM533EyrBD3aMGCbWR57d8hqzx48m6ncPfdvT5Tlgd+yolEMhOwX9K NzIyGPHo4Re37IJ4ckESFtDYbNq3mlK2JqlN X-Received: by 2002:a17:906:cb11:: with SMTP id lk17mr20356893ejb.517.1618809143641; Sun, 18 Apr 2021 22:12:23 -0700 (PDT) Received: from apalos.home (ppp-94-65-92-88.home.otenet.gr. [94.65.92.88]) by smtp.gmail.com with ESMTPSA id s5sm9541238ejq.52.2021.04.18.22.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 22:12:23 -0700 (PDT) Date: Mon, 19 Apr 2021 08:12:17 +0300 From: Ilias Apalodimas To: Shakeel Butt Cc: Jesper Dangaard Brouer , 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 Subject: Re: [PATCH net-next v3 2/5] mm: add a signature in struct page Message-ID: References: <20210409223801.104657-1-mcroce@linux.microsoft.com> <20210409223801.104657-3-mcroce@linux.microsoft.com> <20210410154824.GZ2531743@casper.infradead.org> <20210414214132.74f721dd@carbon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 01:09:47PM -0700, Shakeel Butt wrote: > 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. > I am not sure I like leaving out TCP RX zerocopy. Since we want driver to adopt the recycling mechanism we should try preserving the current functionality of the network stack. The question is how does it work with the current drivers that already have an internal page recycling mechanism. > > (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. Same question here. I'll have a closer look in a few days and make sure we are not breaking anything wrt zerocopy. > > > > > (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. Shakeel are you aware of any 'easy' way I can have rx zerocopy running? Thanks! /Ilias