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 D949B4315D; Wed, 12 Jun 2024 21:09: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=1718226577; cv=none; b=QxlVB06q7XksvluHV/x6CpHsIbJkxFUWA/778xEYiXxggu0QJu8600smtH/+K9ozxN9NRz7rFT8Xn9+1nZXXrSkwlT5HX5JudJ/2baHdAgXCCgZ1lGpecUKXE8j0gTgJpOC40jmLgo6+j33jrU4Pf2ogglAtR4ORdVQZ4skcXxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718226577; c=relaxed/simple; bh=p/mXOYAvIuYsfLPdV+2dCK5EknA6B/HSfkaHVfEQato=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=muwwGA8FEtadBYVxW2VrRWI7vK7mzJIsN+lroo823BAFKA8S/mP2Gu+taFT8Kie1Bm4ZV+FEqVDvg788CjsAneIEHPK6havDBhpyAJz2+2A51CQxyCETetCRbF8rCNOwRP9S8B5v8m+xqe3mkj3XDVyZTXB+N5I0bv1xJOAZ4V0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QlF6deoA; 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="QlF6deoA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B25C116B1; Wed, 12 Jun 2024 21:09:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718226576; bh=p/mXOYAvIuYsfLPdV+2dCK5EknA6B/HSfkaHVfEQato=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QlF6deoALi2EBQ2PTzXnxcW3NEVc0zVQd6HRY4xR0lmS9aEe8hLk2Ts1HsmpkWiU5 2QFRDPyjhEIsalGkDUptUPth0v0OAvQzUHgJ99JOUk43vxydLlE41GbbNm4skSYcrL cjx59AuIscyowaGkOG9fFfR8jdc+axYmC2qXLpfOqPj0aUBj32b6SyTpuP/rjzoYgR J3W3ba3cpScjDHqBVKeNdYx0jPkX7iFlhbQFOXJaokA7bLqjzyMqnE1vKpkRy4RXhB v/ZO5W/iA0H8239PHoU6jp2gn0zIkIYuKG7zHrOA2qJZ3Nje6po+zF0BIhic4FG577 oWuNO3YPD1ifQ== Date: Wed, 12 Jun 2024 14:09:35 -0700 From: Jakub Kicinski To: Larysa Zaremba Cc: , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , "Daniel Borkmann" , Jesper Dangaard Brouer , John Fastabend , Maciej Fijalkowski , , , , , Michal Kubiak Subject: Re: [PATCH iwl-net 0/3] ice: fix synchronization between .ndo_bpf() and reset Message-ID: <20240612140935.54981c49@kernel.org> In-Reply-To: References: <20240610153716.31493-1-larysa.zaremba@intel.com> <20240611193837.4ffb2401@kernel.org> 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-Transfer-Encoding: 7bit On Wed, 12 Jun 2024 08:56:38 +0200 Larysa Zaremba wrote: > On Tue, Jun 11, 2024 at 07:38:37PM -0700, Jakub Kicinski wrote: > > On Mon, 10 Jun 2024 17:37:12 +0200 Larysa Zaremba wrote: > > > Fix the problems that are triggered by tx_timeout and ice_xdp() calls, > > > including both pool and program operations. > > > > Is there really no way for ice to fix the locking? :( > > The busy loops and trylocks() are not great, and seem like duct tape. > > The locking mechanisms I use here do not look pretty, but if I am not missing > anything, the synchronization they provide must be robust. Robust as in they may be correct here, but you lose lockdep and all other infra normal mutex would give you. > A prettier way of protecting the same critical sections would be replacing > ICE_CFG_BUSY around ice_vsi_rebuild() with rtnl_lock(), this would eliminate > locking code from .ndo_bpf() altogether, ice_rebuild_pending() logic will have > to stay. > > At some point I have decided to avoid using rtnl_lock(), if I do not have to. I > think this is a goal worth pursuing? Is the reset for failure recovery, rather than reconfiguration? If so netif_device_detach() is generally the best way of avoiding getting called (I think I mentioned it to someone @intal recently). 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 44E2FC27C53 for ; Wed, 12 Jun 2024 21:09:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EA7FC40184; Wed, 12 Jun 2024 21:09:49 +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 o1Cv1mKjVZXh; Wed, 12 Jun 2024 21:09:43 +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 9BFD54136F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1718226583; bh=kh7se2gWuulaBsIutEyjxwWg50MN3CFzzOM60suOp0I=; h=Date:From:To:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=YZrDyo+z8DufFWq4Yhlwj0ePG2/nRffSaMgcHRWVOkxkGDpw8l6SczVhb6AZ2LAS6 Qu40rP7vzmN1vOAnuNKBXNIXeDYXt30xKiYbUmgNzMH9NLtQBGIDIzhWrw3SXjuI3n eMMtrt0WpkP5aP7wkwfpt/GXftH+acMMqozGitkAflmpE94WD7lQrS/P/qbz+r2k/0 yUpVGNIkzxM9gRow1GHI7eHIMEtem+gD/ecQTzHl5W/cFlimf21xRjRxSwuwihWb5W DtWD9FOE4Q28SUoAhzXRQtB0ccXcfHEMG8U85YtFBLsi9LXu5dWUBkGqs8MizWRwlA yTjORtCeZGIAg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 9BFD54136F; Wed, 12 Jun 2024 21:09:43 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 0F6C81BF366 for ; Wed, 12 Jun 2024 21:09:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EEC596076D for ; Wed, 12 Jun 2024 21:09:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7y-bab0A_9jn for ; Wed, 12 Jun 2024 21:09:41 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=145.40.73.55; helo=sin.source.kernel.org; envelope-from=kuba@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 0384F6072C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0384F6072C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0384F6072C for ; Wed, 12 Jun 2024 21:09:40 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 06CD6CE22D5; Wed, 12 Jun 2024 21:09:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B25C116B1; Wed, 12 Jun 2024 21:09:35 +0000 (UTC) Date: Wed, 12 Jun 2024 14:09:35 -0700 From: Jakub Kicinski To: Larysa Zaremba Message-ID: <20240612140935.54981c49@kernel.org> In-Reply-To: References: <20240610153716.31493-1-larysa.zaremba@intel.com> <20240611193837.4ffb2401@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718226576; bh=p/mXOYAvIuYsfLPdV+2dCK5EknA6B/HSfkaHVfEQato=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QlF6deoALi2EBQ2PTzXnxcW3NEVc0zVQd6HRY4xR0lmS9aEe8hLk2Ts1HsmpkWiU5 2QFRDPyjhEIsalGkDUptUPth0v0OAvQzUHgJ99JOUk43vxydLlE41GbbNm4skSYcrL cjx59AuIscyowaGkOG9fFfR8jdc+axYmC2qXLpfOqPj0aUBj32b6SyTpuP/rjzoYgR J3W3ba3cpScjDHqBVKeNdYx0jPkX7iFlhbQFOXJaokA7bLqjzyMqnE1vKpkRy4RXhB v/ZO5W/iA0H8239PHoU6jp2gn0zIkIYuKG7zHrOA2qJZ3Nje6po+zF0BIhic4FG577 oWuNO3YPD1ifQ== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=QlF6deoA Subject: Re: [Intel-wired-lan] [PATCH iwl-net 0/3] ice: fix synchronization between .ndo_bpf() and reset 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 , Jesper Dangaard Brouer , Daniel Borkmann , netdev@vger.kernel.org, John Fastabend , Alexei Starovoitov , Eric Dumazet , Michal Kubiak , Tony Nguyen , magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org, Paolo Abeni , "David S. Miller" , linux-kernel@vger.kernel.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Wed, 12 Jun 2024 08:56:38 +0200 Larysa Zaremba wrote: > On Tue, Jun 11, 2024 at 07:38:37PM -0700, Jakub Kicinski wrote: > > On Mon, 10 Jun 2024 17:37:12 +0200 Larysa Zaremba wrote: > > > Fix the problems that are triggered by tx_timeout and ice_xdp() calls, > > > including both pool and program operations. > > > > Is there really no way for ice to fix the locking? :( > > The busy loops and trylocks() are not great, and seem like duct tape. > > The locking mechanisms I use here do not look pretty, but if I am not missing > anything, the synchronization they provide must be robust. Robust as in they may be correct here, but you lose lockdep and all other infra normal mutex would give you. > A prettier way of protecting the same critical sections would be replacing > ICE_CFG_BUSY around ice_vsi_rebuild() with rtnl_lock(), this would eliminate > locking code from .ndo_bpf() altogether, ice_rebuild_pending() logic will have > to stay. > > At some point I have decided to avoid using rtnl_lock(), if I do not have to. I > think this is a goal worth pursuing? Is the reset for failure recovery, rather than reconfiguration? If so netif_device_detach() is generally the best way of avoiding getting called (I think I mentioned it to someone @intal recently).