Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp583733lqm; Wed, 1 May 2024 09:24:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvs2SlAy0lWLw2v/tGLV62kRw9jhjMXB+OGb/2U8RCA6UHtF8rpqSG3XwoimYQKNSwa4rstm44DXzIAj1wc/Z8/6s1P/UEEeKfDqmYPg== X-Google-Smtp-Source: AGHT+IGmO1z4LWXbyYvlMDd/2YgZ63Wepo7/T7njaKhntW5oodCH3k9ezU5iMYaajilwM8840QSc X-Received: by 2002:a17:902:6bc6:b0:1eb:a636:ecab with SMTP id m6-20020a1709026bc600b001eba636ecabmr2684205plt.34.1714580650076; Wed, 01 May 2024 09:24:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714580650; cv=pass; d=google.com; s=arc-20160816; b=DDaECeoqBtLyKYihfG/bwU66ALaAaNuyL2kXdzBAEyebSD8b2wxUw9Jk2vBraLKmK7 Y22PNMOAjSQRxJZuRWla3abV1eL+hWinXPhw94Nxau/IRmtDrAqfqiaAa9ucuLVP7kiq vbUejvxyCB3vc1AWB4eQs5vIFcYdwTbIaA47VkmYcyIz1heRlY2OgxrZolddZyz+dOSE wA2GEKn9IW9odxOmEIlm1seDYiOLHK5KohxH089KffG5Gj73AlaiZq3QaT3Vg9x0lh0F +CfdPJYaNYmGHTcHBjQSw0PzsKrDuwEVkIJS2TY0G8EfWonEThm5Gq1DHA3JUhVuCAQh UguA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ZzwkZ/EkeuQlBEthD/LjsTTbxL+u6lGHOizRSZMPv8Y=; fh=jiDc0DWHTurctaGNCk184WbjP/SHutCyVYfw2hPeVZs=; b=WPRiQXUXZvMbRY2bn/zmZNNy/Jr68n7rkQH3ir0Lau2aAcPRRajYLp6SHqBtpujYtx 2zn5c8zHcxDtS09xM4WnX+p+vL9CVaRcU2RKdi9ID/AeKTUUCQyPpnyHsWllgBdx5yIW TUq48tSlOvvOICpKu9PlDFn3bBom6LOyt/Dk8G9sn1LT4ULmjbQDu2zDMlkNu7QoEk5m cD7jlzqLwH4SONBsQSfKMFIsegnE3ItGHMXblxsMeCt58z5UU9i6VSVB3ST0fRDVdo47 xeGu3H1+rkdMY9AYX28juXM8vSrX//7FDfn949muCZBNcwkZXb8Ad4Ks4rx9SDhEB9nn kXoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sGRF/wER"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q14-20020a170902a3ce00b001ec32cbe1b5si3874330plb.608.2024.05.01.09.24.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="sGRF/wER"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165571-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A63FA2811A5 for ; Wed, 1 May 2024 16:23:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BB4513049C; Wed, 1 May 2024 16:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sGRF/wER" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 C6C9612FB3E for ; Wed, 1 May 2024 16:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714580617; cv=none; b=iQ1kS6z9xTOy+bHmRO5XQXTDF2M+PMCSefQmNLMl3qkzYi7KOfsI9pS1sfEjiijPYr8r0G4scNKa6gGA6QUNH82xrBNYuVhsYcgbe459yba6jZW6t+PWLlhyOfoDZIDaw3+W+omZgqNEjjvSCNSUv7pnu4TU0g9MB67uotPx2dY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714580617; c=relaxed/simple; bh=ZzwkZ/EkeuQlBEthD/LjsTTbxL+u6lGHOizRSZMPv8Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Q4Fi2xNblzzHImMVdcJCz3OCxFTv835TwOZJCvm45yfQ1IyKOgO5mQNHbLS6+MCMABrZcUaYE39dmKKL4Bz24BRanqQXiH8/1cxHgedNEfcnf1oxVxaEITGcLnxPYtmhZcjZv+kaRDwk5xohBr66edpWl10c+zM5N4aRvzc+mqE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sGRF/wER; arc=none smtp.client-ip=209.85.167.52 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=google.com Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51ef64d04b3so378754e87.3 for ; Wed, 01 May 2024 09:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714580614; x=1715185414; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZzwkZ/EkeuQlBEthD/LjsTTbxL+u6lGHOizRSZMPv8Y=; b=sGRF/wERqovuREC11lLIusyeokGjblxFViniBJ0Etw11OMIMBQ/4E4hLGNSoUsc3bp awiHqt2V1CFR/Qy9APq1IP8FocpapeCTg2Y2bzWHhX+ZLHqGCK+P6p4OdlhKmeZ5d8Co G4wg1Leyxo+Tox8bE2MKpbvkq0kji/KduODJUYu97sd3qjyhZsrhI7mRslLYHdv5LG9R Z1ck8ItDqooi6/jkr60fSzMLf7Qi8Gwwbfs6Pu912uJuxJbzlzYIz+uDxd7Za5eDKfbS Q8iEom9AfXmAG8CyUTBiAdWzr38XlgLU4GEXJdIL5ZizC65PPOkaHPmvwz6sKy9LIOSg yQqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714580614; x=1715185414; h=content-transfer-encoding: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=ZzwkZ/EkeuQlBEthD/LjsTTbxL+u6lGHOizRSZMPv8Y=; b=g/frQYKqJZPv2CKRsSKMWaXAvLe2XkYcnhK9yJYOM44kw6TCydaLj+EQKq2TygIFxA rPiUhMUNbaD+DLTRUI+6217BsH9EhlVnG/BjoVEc0hL3qczpHXMxTnEbcgWvMfcWypa+ psrvJyHY7LoIKi4dg5xdJxzNaRuIS9jH/MxKwCJJ2sOPokbOzvP69sAXARyYvnHTN7uY +36hei9N9jHHTyRPr/WPMEKqrVpoCOUjC1DlORnwkLH2A77Isyx6zpgqwZKjDhQcl8jO aYf9glA+Cit6IvmwPuMnHTLHcXPhO6YL4pzoeY4OVvbKFFjC0ltoNZfB25HZdobfrenb KNpA== X-Forwarded-Encrypted: i=1; AJvYcCVrvYlGvOFih/QxpLHG3bRDJJnuF2BbmbV0TTPjRUEuaNZTX9RYcUjhI/FsMwZyioAug4S8WnzY0hrw4bEYXRl8zV7fnsm5FNdifSxe X-Gm-Message-State: AOJu0YxSFHVSS5MY3s/IxZ/JoaFZbDKH0KQ50M2eXMTcJ7Pg+8yv/hfX 7DqifElKssIDElIk5OsVHUX3fLoiakN+bolj/xoyZKK6vV96azaWcsPDQqqZ9NQAgjkYhkyYEam TAH7AjaXMG0lqMr82bK2vIW/AxlzDjtiFDF2Z X-Received: by 2002:ac2:5f1d:0:b0:51d:aeae:27f6 with SMTP id 29-20020ac25f1d000000b0051daeae27f6mr2433245lfq.16.1714580613679; Wed, 01 May 2024 09:23:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240424165646.1625690-2-dtatulea@nvidia.com> <4ba023709249e11d97c78a98ac7db3b37f419960.camel@nvidia.com> <4c20b500c2ed615aba424c0f3c7a79f5f5a04171.camel@nvidia.com> <20240426160557.51de91f9@kernel.org> <7a5a1d74040052afc8cc6cc5c2700fdf2e836b0c.camel@nvidia.com> <20240501072434.5720fd42@kernel.org> In-Reply-To: <20240501072434.5720fd42@kernel.org> From: Mina Almasry Date: Wed, 1 May 2024 09:23:20 -0700 Message-ID: Subject: Re: [RFC PATCH] net: Fix one page_pool page leak from skb_frag_unref To: Jakub Kicinski 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 1, 2024 at 7:24=E2=80=AFAM Jakub Kicinski wro= te: > > 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? > OK, I will upload a revert sometime today. > 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. You posted a diff, I will pick it up in a separate patch. --=20 Thanks, Mina