From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EF10C02182 for ; Thu, 23 Jan 2025 10:43:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D7FE2419C9; Thu, 23 Jan 2025 10:43:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 608O7JkhTSo5; Thu, 23 Jan 2025 10:43:33 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D6872419D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1737629012; bh=D/WqXxtLsCGyElHF1AzxitL2iMPdio8DMO8OgIsg3Zo=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=3A/iGGQveLk1yG/WRkYTStZrFFsZzMA+Lc4v2wnrUd9CItxX60ycFfCHAJ84zZMy5 aZByhfGNDtN1fnRPFgaKhy+t3FzUfxTJ2xEUemfZjFQteyvHrxIE/OmT6KbY84IJME uQaOrYlOVbG+Xmi0EHI+nm2lGgeVOSf/medsIkprdJRWK09PQ/Q0D6NvOpwGK0MHKe ZWysBSzTm738cqd2p4eVLTohFrHP94RGTFTNdUJ2Evu2otGGlP4IaNCjwDrvHFHCDM srZ5o4Uwzv/TIYZ7LRyiLaY8vUqVTPo2Qk4YVMqDShjDFQU2O1Si/OrvS1ayNnADp8 p/nO6WX47/HKw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id D6872419D9; Thu, 23 Jan 2025 10:43:32 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 8C20AF08 for ; Thu, 23 Jan 2025 10:43:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6D907848B5 for ; Thu, 23 Jan 2025 10:43:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id nHAKqClXb7p7 for ; Thu, 23 Jan 2025 10:43:30 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org CB0D0848A0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CB0D0848A0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp1.osuosl.org (Postfix) with ESMTPS id CB0D0848A0 for ; Thu, 23 Jan 2025 10:43:30 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C39A85C5489; Thu, 23 Jan 2025 10:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B340FC4CED3; Thu, 23 Jan 2025 10:43:27 +0000 (UTC) Date: Thu, 23 Jan 2025 10:43:25 +0000 From: Simon Horman To: Maciej Fijalkowski Message-ID: <20250123104325.GK395043@kernel.org> References: <20250122151046.574061-1-maciej.fijalkowski@intel.com> <20250122151046.574061-3-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250122151046.574061-3-maciej.fijalkowski@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737629009; bh=dGRhaKURQTAwCQirlBEV5EhuzLWRx5fQon9AoRuGIDY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UiwVKsH/AVaSZwLZLendFLMiiTkBEo5T5DiMJcqD4Fbmf57g1aXZ+CcViBXN3Zseo SCI9RiHYqODBKGcKA95E2UWMIbXB/HtK54C1jRtLyyUFIJSuEVvqQc1dQtU/DicjF0 vhEyhmWmAI3tk43BVLbXcEuI8obShDBPPZfZ9DCVkR4J9W+oz/XyE4kg3SwXNo03yI UTJfQ7IdYtfXpn8+iGZxxhIPKDxjAO17JaBp7tDoMzFPdXm9LDkpgrqJnJ9/QwOvsI iQZXJtw75sMpGZrWtkQsMNrPLegWK9YVm0a+Fis/iVlrUiEMxILbRoxLk3hijr1AvI 8K8P4BM/H9nkA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=UiwVKsH/ Subject: Re: [Intel-wired-lan] [PATCH v4 iwl-net 2/3] ice: gather page_count()'s of each frag right before XDP prog call X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, xudu@redhat.com, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, jacob.e.keller@intel.com, intel-wired-lan@lists.osuosl.org, jmaxwell@redhat.com, magnus.karlsson@intel.com Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Wed, Jan 22, 2025 at 04:10:45PM +0100, Maciej Fijalkowski wrote: > If we store the pgcnt on few fragments while being in the middle of > gathering the whole frame and we stumbled upon DD bit not being set, we > terminate the NAPI Rx processing loop and come back later on. Then on > next NAPI execution we work on previously stored pgcnt. > > Imagine that second half of page was used actively by networking stack > and by the time we came back, stack is not busy with this page anymore > and decremented the refcnt. The page reuse algorithm in this case should > be good to reuse the page but given the old refcnt it will not do so and > attempt to release the page via page_frag_cache_drain() with > pagecnt_bias used as an arg. This in turn will result in negative refcnt > on struct page, which was initially observed by Xu Du. > > Therefore, move the page count storage from ice_get_rx_buf() to a place > where we are sure that whole frame has been collected, but before > calling XDP program as it internally can also change the page count of > fragments belonging to xdp_buff. > > Fixes: ac0753391195 ("ice: Store page count inside ice_rx_buf") > Reported-and-tested-by: Xu Du > Reviewed-by: Przemek Kitszel > Co-developed-by: Jacob Keller > Signed-off-by: Jacob Keller > Signed-off-by: Maciej Fijalkowski Reviewed-by: Simon Horman From mboxrd@z Thu Jan 1 00:00:00 1970 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 645BF20DD7F for ; Thu, 23 Jan 2025 10:43:29 +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=1737629010; cv=none; b=JvV8L98wPFmTgSNsaDC4Gfn8iihO3tLL5pdstpnLoFqHrqUxHEhLr9CFGhz7cYtwH2u4uz9ltZN/iOUVki+1hndvTQxOeM074VF3UQr48sn2b8P24YSiFiTPQ75eNy9zh0BFsg6jCztUSkefA7mFnvZwQX0SgAVz5X/6IaMCXYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737629010; c=relaxed/simple; bh=dGRhaKURQTAwCQirlBEV5EhuzLWRx5fQon9AoRuGIDY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z3nDEHXNxc8KjEkkhScp6uFZR+cyrTPYPvDrvGDwUZcQflAWZRngm79uuH04xIKzKAKJbsxyxcn/uKtJuClrK12Si60PviRNaNqBKuVMAY/MgBAZ7R5h4Wngfugg7+PZCzyniwlREmQxV82k0id6yUXHGUOd6CAi1Ju4eV+RFxY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UiwVKsH/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UiwVKsH/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B340FC4CED3; Thu, 23 Jan 2025 10:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737629009; bh=dGRhaKURQTAwCQirlBEV5EhuzLWRx5fQon9AoRuGIDY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UiwVKsH/AVaSZwLZLendFLMiiTkBEo5T5DiMJcqD4Fbmf57g1aXZ+CcViBXN3Zseo SCI9RiHYqODBKGcKA95E2UWMIbXB/HtK54C1jRtLyyUFIJSuEVvqQc1dQtU/DicjF0 vhEyhmWmAI3tk43BVLbXcEuI8obShDBPPZfZ9DCVkR4J9W+oz/XyE4kg3SwXNo03yI UTJfQ7IdYtfXpn8+iGZxxhIPKDxjAO17JaBp7tDoMzFPdXm9LDkpgrqJnJ9/QwOvsI iQZXJtw75sMpGZrWtkQsMNrPLegWK9YVm0a+Fis/iVlrUiEMxILbRoxLk3hijr1AvI 8K8P4BM/H9nkA== Date: Thu, 23 Jan 2025 10:43:25 +0000 From: Simon Horman To: Maciej Fijalkowski Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, anthony.l.nguyen@intel.com, magnus.karlsson@intel.com, jacob.e.keller@intel.com, xudu@redhat.com, mschmidt@redhat.com, jmaxwell@redhat.com, poros@redhat.com, przemyslaw.kitszel@intel.com Subject: Re: [PATCH v4 iwl-net 2/3] ice: gather page_count()'s of each frag right before XDP prog call Message-ID: <20250123104325.GK395043@kernel.org> References: <20250122151046.574061-1-maciej.fijalkowski@intel.com> <20250122151046.574061-3-maciej.fijalkowski@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250122151046.574061-3-maciej.fijalkowski@intel.com> On Wed, Jan 22, 2025 at 04:10:45PM +0100, Maciej Fijalkowski wrote: > If we store the pgcnt on few fragments while being in the middle of > gathering the whole frame and we stumbled upon DD bit not being set, we > terminate the NAPI Rx processing loop and come back later on. Then on > next NAPI execution we work on previously stored pgcnt. > > Imagine that second half of page was used actively by networking stack > and by the time we came back, stack is not busy with this page anymore > and decremented the refcnt. The page reuse algorithm in this case should > be good to reuse the page but given the old refcnt it will not do so and > attempt to release the page via page_frag_cache_drain() with > pagecnt_bias used as an arg. This in turn will result in negative refcnt > on struct page, which was initially observed by Xu Du. > > Therefore, move the page count storage from ice_get_rx_buf() to a place > where we are sure that whole frame has been collected, but before > calling XDP program as it internally can also change the page count of > fragments belonging to xdp_buff. > > Fixes: ac0753391195 ("ice: Store page count inside ice_rx_buf") > Reported-and-tested-by: Xu Du > Reviewed-by: Przemek Kitszel > Co-developed-by: Jacob Keller > Signed-off-by: Jacob Keller > Signed-off-by: Maciej Fijalkowski Reviewed-by: Simon Horman