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 DD40C76C76; Thu, 16 May 2024 08:27:39 +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=1715848060; cv=none; b=RvDc4oqlSnjVlynd59jXYHHQiaW5ixBahfTodPni30cmxMd5lemJEkZUv91RisdvnOpdNzajj9tzOkCeVV3Eo9w6Ir/UPNnElkVFa/0IhAb642YrF53f7SKm/Hu/XJ41YeFhmE3rl9Ql5rGB6/t8wuoTnHE7HL2YRgtOcBy6HCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715848060; c=relaxed/simple; bh=9LRNAuur+huZKRDmejnPug6GuKAfA0xgXvFKeLB4wLo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c3MY8r2X+bApFrF5Ii19k48KLfSWVgdYZsmxBwjqRgpjDC4G2whS2/PfHZZpE7pBo1V+Uw1DRSctGwyZpWgwws7adlCMvmMaRWlu+6EBwG24KBOooAu3PV7LdR+ZunUUuFP12mcVgQGTQCSyzTBpuuVb20gAQgCcYqLXm3hiP8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mU5Wpl8f; 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="mU5Wpl8f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40375C32789; Thu, 16 May 2024 08:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715848059; bh=9LRNAuur+huZKRDmejnPug6GuKAfA0xgXvFKeLB4wLo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mU5Wpl8fCqZC6kZltsIgQeTYGjz4QB/WYbrXvz7R/+YdO0nxnKnRx2KdNJnYxLCs0 zCLxREkNgG/FkZ1VQ84uTCOBuPLL0tGIH5PADs083gnXzlTc/MQKYaT9nyzs/iLGeY i0OiRL7ef/29o/JLkpJxgFJak0dQpyhCVpXjaDyNEyJebiTFeHVBSIHzt9tZAR71CC KQAithRyMZ+Qza+XemZzid9Is1m3GSkn2/8cpzwnuY9yxQbxH9O39ABXJ+S/a7vgQp W1iLGegicc2MvRaHMRaGhRkRTRUw24wzkArSJLTSR/4CcB8m/BboT57kW3qAty8UNi mavlwMDJmJAMQ== Date: Thu, 16 May 2024 09:27:33 +0100 From: Simon Horman To: Larysa Zaremba Cc: intel-wired-lan@lists.osuosl.org, Jacob Keller , maciej.fijalkowski@intel.com, Magnus Karlsson , Przemek Kitszel , igor.bagnucki@intel.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH iwl-net 2/3] ice: add flag to distinguish reset from .ndo_bpf in XDP rings config Message-ID: <20240516082733.GD179178@kernel.org> References: <20240515160246.5181-1-larysa.zaremba@intel.com> <20240515160246.5181-3-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: bpf@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: <20240515160246.5181-3-larysa.zaremba@intel.com> On Wed, May 15, 2024 at 06:02:15PM +0200, Larysa Zaremba wrote: > Commit 6624e780a577 ("ice: split ice_vsi_setup into smaller functions") > has placed ice_vsi_free_q_vectors() after ice_destroy_xdp_rings() in > the rebuild process. The behaviour of the XDP rings config functions is > context-dependent, so the change of order has led to > ice_destroy_xdp_rings() doing additional work and removing XDP prog, when > it was supposed to be preserved. > > Also, dependency on the PF state reset flags creates an additional, > fortunately less common problem: > > * PFR is requested e.g. by tx_timeout handler > * .ndo_bpf() is asked to delete the program, calls ice_destroy_xdp_rings(), > but reset flag is set, so rings are destroyed without deleting the > program > * ice_vsi_rebuild tries to delete non-existent XDP rings, because the > program is still on the VSI > * system crashes > > With a similar race, when requested to attach a program, > ice_prepare_xdp_rings() can actually skip setting the program in the VSI > and nevertheless report success. > > Instead of reverting to the old order of function calls, add an enum > argument to both ice_prepare_xdp_rings() and ice_destroy_xdp_rings() in > order to distinguish between calls from rebuild and .ndo_bpf(). > > Fixes: efc2214b6047 ("ice: Add support for XDP") > Reviewed-by: Igor Bagnucki > Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 63EF8C25B74 for ; Thu, 16 May 2024 08:27:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 25DB641C91; Thu, 16 May 2024 08:27:47 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id As_7bC0ZThFe; Thu, 16 May 2024 08:27:46 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6321F40B75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1715848066; bh=+3U4xUApSYgddyfwELO5jrGeTunG7x8fJn6ivijjQlo=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=toHXRUHptlhO/XsV7fzWVH5n2njfBXnpMRwja4B+BYSqztk7QeoQwklkHFaCR0gIC 4DIrp3enYwZ0BAlP1hkGfTh4t6KKEp0aCjZ2esdb0Zp7muXAjYnrVoIVOpThrcUMZV AmhLLRHTS01OwrCaB2iDMpy7qtt+3f8MVUx89PIEpWKLLVl47C2N3yj2iu8c8k6W9w EQ7Yyg0TNlXVfNaI+8nRBgO4pbtC6+oVKH6ZdwVxIe7V1oh9wWEO4C7yE56KVpuXfT DWMgnOUsTa4rpHgx7YXKfCEyukpnXGOZUW2nDZAyQuqO6oRZu1/43cqin669EIccL6 394RFdESOn+Sw== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 6321F40B75; Thu, 16 May 2024 08:27:46 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id C46B41BF855 for ; Thu, 16 May 2024 08:27:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id ACF4740795 for ; Thu, 16 May 2024 08:27:44 +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 X_r_YMFcaux9 for ; Thu, 16 May 2024 08:27:41 +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 smtp4.osuosl.org 1AEB540794 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1AEB540794 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1AEB540794 for ; Thu, 16 May 2024 08:27:40 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 085BC615F4; Thu, 16 May 2024 08:27:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40375C32789; Thu, 16 May 2024 08:27:36 +0000 (UTC) Date: Thu, 16 May 2024 09:27:33 +0100 From: Simon Horman To: Larysa Zaremba Message-ID: <20240516082733.GD179178@kernel.org> References: <20240515160246.5181-1-larysa.zaremba@intel.com> <20240515160246.5181-3-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240515160246.5181-3-larysa.zaremba@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715848059; bh=9LRNAuur+huZKRDmejnPug6GuKAfA0xgXvFKeLB4wLo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mU5Wpl8fCqZC6kZltsIgQeTYGjz4QB/WYbrXvz7R/+YdO0nxnKnRx2KdNJnYxLCs0 zCLxREkNgG/FkZ1VQ84uTCOBuPLL0tGIH5PADs083gnXzlTc/MQKYaT9nyzs/iLGeY i0OiRL7ef/29o/JLkpJxgFJak0dQpyhCVpXjaDyNEyJebiTFeHVBSIHzt9tZAR71CC KQAithRyMZ+Qza+XemZzid9Is1m3GSkn2/8cpzwnuY9yxQbxH9O39ABXJ+S/a7vgQp W1iLGegicc2MvRaHMRaGhRkRTRUw24wzkArSJLTSR/4CcB8m/BboT57kW3qAty8UNi mavlwMDJmJAMQ== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp4.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=mU5Wpl8f Subject: Re: [Intel-wired-lan] [PATCH iwl-net 2/3] ice: add flag to distinguish reset from .ndo_bpf in XDP rings config X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maciej.fijalkowski@intel.com, Jesper Dangaard Brouer , Daniel Borkmann , Przemek Kitszel , John Fastabend , Alexei Starovoitov , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Jacob Keller , Jakub Kicinski , bpf@vger.kernel.org, Paolo Abeni , Magnus Karlsson , igor.bagnucki@intel.com, linux-kernel@vger.kernel.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Wed, May 15, 2024 at 06:02:15PM +0200, Larysa Zaremba wrote: > Commit 6624e780a577 ("ice: split ice_vsi_setup into smaller functions") > has placed ice_vsi_free_q_vectors() after ice_destroy_xdp_rings() in > the rebuild process. The behaviour of the XDP rings config functions is > context-dependent, so the change of order has led to > ice_destroy_xdp_rings() doing additional work and removing XDP prog, when > it was supposed to be preserved. > > Also, dependency on the PF state reset flags creates an additional, > fortunately less common problem: > > * PFR is requested e.g. by tx_timeout handler > * .ndo_bpf() is asked to delete the program, calls ice_destroy_xdp_rings(), > but reset flag is set, so rings are destroyed without deleting the > program > * ice_vsi_rebuild tries to delete non-existent XDP rings, because the > program is still on the VSI > * system crashes > > With a similar race, when requested to attach a program, > ice_prepare_xdp_rings() can actually skip setting the program in the VSI > and nevertheless report success. > > Instead of reverting to the old order of function calls, add an enum > argument to both ice_prepare_xdp_rings() and ice_destroy_xdp_rings() in > order to distinguish between calls from rebuild and .ndo_bpf(). > > Fixes: efc2214b6047 ("ice: Add support for XDP") > Reviewed-by: Igor Bagnucki > Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman