Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp507356lqm; Wed, 1 May 2024 07:24:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUl6dMDJFSq23nMXVOZbm/QH/x92zomHgMvfY7Pe6k9QqhGUzX6Wfe4w1cXjdd/sy+8KBw3TF+2v44PBA1JzEsMotG/fc7D7WHUHz22A== X-Google-Smtp-Source: AGHT+IGvsgDWKvsKQq0vpmPtyc7T5JT8iPfaii3N0o9IQL40G5lIHjajy2582TlSIAnqpMnmsAv4 X-Received: by 2002:ac8:5fc6:0:b0:43a:d386:f8eb with SMTP id k6-20020ac85fc6000000b0043ad386f8ebmr2451803qta.22.1714573485712; Wed, 01 May 2024 07:24:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714573485; cv=pass; d=google.com; s=arc-20160816; b=jb/29VHGdP+R8Q6TdfyuEx3wZCsEsEoo3ffah61tH+aOooFx55Vxzy6MpPWA3IHVD2 4zgA8MIlHKmXZUsrrxCTazc8mlCQxw8NVn8SN/ggCF1W8hw6qtdQVLs/FESfGMpLQSeX Vl+fSG7DxtURO8uoG8Q1APDV9/a+C9MwVHDhQwR3FyVqmy/iJ1a/zan+yVWsM2cnWz8J RWdUbmr40ysUJxrFPCpU73tvl2yNpMufdRIT5CYs0dbOXRt1zBm7iVHulVnO1DVAUndp LKVQqIb2jhj85hMkgCp0Kz1RDQjoZy7vr8T7Qlx6uT+XJfdAMKzDUOZ4MfQ9NJVMS+tt Lb8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=25jX8Z2FI8oiqwYb7KvyXVXLFkeEvtcntWEhVd4YQT0=; fh=Ltm6X/cs5MqNXwSymiDF56+AdMe5rzroCyDlPBmiFW8=; b=gNqzrGUq6e6sWnN1jfKwr56ot0PUS++yaii7c8aGSOS3s9nkvsT4um7FiP/d5+Uoav PQI8cEYDM0RqM8YQxXnZlJSL0LrBBpTD2ytK10rgsS0IeL+RAuODjU/zS9SNNztfYunD N13lTa4WMs4gh2OoI2botG+MwdA7guywLgZjCOli3VbD3fNYjmNAvHe8kLAYt7vWLmZy nvf2o39oa1zq9WcZ7cNxcYJfIW8EISwdjh+cZ573k2HRT/8UkmxYkqh3IlPT/aIe3Xw+ fqBAUFyAsphBQX52vIf9iB31NUb1d43/yn8IOPFCDZDWyAlwTNPKvQ2vgs1bAGx0+eW6 74EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pfrn5fwv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v14-20020a05622a014e00b0043af8d3965bsi5914902qtw.807.2024.05.01.07.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 07:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pfrn5fwv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165369-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6DF671C2110F for ; Wed, 1 May 2024 14:24:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A841C12F38B; Wed, 1 May 2024 14:24:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pfrn5fwv" 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 C813F12F369; Wed, 1 May 2024 14:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714573476; cv=none; b=gorPcIp6WM+kxx4eGpPvokp7CqQ42fIbgtyLMzaFm2cLeUWMjUWFGkK82n6pmore/vedgA8GiJI6Ka3pWzVPQ/53EYqtG1I+upAIZp1bqJWlLKq1IAwN4MxjdZPIX/H+yU6lyRM8OQ7i91cwPJSVLTiVkF16Hz6M9dJXzLP6TAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714573476; c=relaxed/simple; bh=5SMHChzXslPomkTdsmjySqWEgGtys1hP+1JViTdT/Tw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=noNwYKKZ948iuSDeiVqFJnnnBG3IexMhpJ9LfgnjhGJN6J9OglFGjE0oAdDCyzrdSBoQoESSz/ELmyjjrX8ftlqs+w9uu1JleqCsQqTTqHe0oeBTkkfBfqm7jgHO0YHj635cDvhxOKTnNHT9/kqNxFdZgNzavmPzJmbvPSoXm8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pfrn5fwv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E40B4C072AA; Wed, 1 May 2024 14:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714573476; bh=5SMHChzXslPomkTdsmjySqWEgGtys1hP+1JViTdT/Tw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pfrn5fwvvguoy5iBs6q3RWzQjvxCYThiAH1qBgxpjGW0XmbWcT1ON+jSE99g+1jVD GjOhTFTQcBuk+/t/9u7Z8RUzCw8oY2s/z0IwAHNKIuPtqJUOWNLh+DcO8ZEiIibUtv cLD2JpTuoAjuQ/xu+mAsy9gTsCUR6RGAnBwiq3jlWk81zSjFVXzEwTFX2YDuib5Q2W T301KBrX3FRrbBEKHDV8DBYGnfmys/e2cVmC9T90HKk2ar2skRkfF/y096BRiKaTpQ Eo9gMXekxMBjvwPIkwFTKdZGp2Qxhc8y0o1caJxFmp6pcTcOA7vuvhjmpqndfsB08p +Yw4CyqJ6Zg4g== Date: Wed, 1 May 2024 07:24:34 -0700 From: Jakub Kicinski To: Mina Almasry Cc: Dragos Tatulea , "davem@davemloft.net" , "ilias.apalodimas@linaro.org" , "linux-kernel@vger.kernel.org" , "jacob.e.keller@intel.com" , "pabeni@redhat.com" , Jianbo Liu , "netdev@vger.kernel.org" , "edumazet@google.com" Subject: Re: [RFC PATCH] net: Fix one page_pool page leak from skb_frag_unref Message-ID: <20240501072434.5720fd42@kernel.org> In-Reply-To: References: <20240424165646.1625690-2-dtatulea@nvidia.com> <4ba023709249e11d97c78a98ac7db3b37f419960.camel@nvidia.com> <4c20b500c2ed615aba424c0f3c7a79f5f5a04171.camel@nvidia.com> <20240426160557.51de91f9@kernel.org> <7a5a1d74040052afc8cc6cc5c2700fdf2e836b0c.camel@nvidia.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-Transfer-Encoding: 7bit On Wed, 1 May 2024 00:48:43 -0700 Mina Almasry wrote: > > 1) Revert commit 2cc3aeb5eccc > > ("skbuff: Fix a potential race while recycling page_pool packets"). I tested > > this btw and it works (for this specific scenario). > > > > 2) Revert Mina's commit a580ea994fd3 ("net: mirror skb frag ref/unref helpers") > > for now. > > I vote for #1, and IIUC Jakub's feedback, he seems to prefer this as > well. I vote #2, actually :( Or #3 make page pool ref safe to acquire concurrently, but that plus fixing all the places where we do crazy things may be tricky. Even taking the ref is not as simple as using atomic_long_inc_not_zero() sadly, partly because we try to keep the refcount at one, in an apparent attempt to avoid dirtying the cache line twice. So maybe partial revert to stop be bleeding and retry after more testing is the way to go? I had a quick look at the code and there is also a bunch of functions which "shift" frags from one skb to another, without checking whether the pp_recycle state matches.