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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08A73C4332F for ; Sat, 15 Oct 2022 15:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbiJOPJ4 (ORCPT ); Sat, 15 Oct 2022 11:09:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiJOPJy (ORCPT ); Sat, 15 Oct 2022 11:09:54 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB1A511A37 for ; Sat, 15 Oct 2022 08:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=uOMgHb9WxbRds9ZVNHGmpGgfS18m3KTn/yda8oq66Y8=; b=KQ/Tx2vlQgS4MCawBCGawBtp2R dEKUB5kUjuKOjy999prByXxsMXuwxlF0u3ExXV9jju0owA411j6OD6ruQLz0H3NwnemVdvuwM+Eut Si2RDAYvTsqBQss7lH9oMuXD0sOkKypyfxea9li9zkY59XTrsHgKIQFUmyvtUgePrlSM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ojin8-00232R-A5; Sat, 15 Oct 2022 17:09:34 +0200 Date: Sat, 15 Oct 2022 17:09:34 +0200 From: Andrew Lunn To: =?iso-8859-1?B?zfFpZ28=?= Huguet Cc: irusskikh@marvell.com, dbogdanov@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, Li Liang Subject: Re: [PATCH net] atlantic: fix deadlock at aq_nic_stop Message-ID: References: <20221014103443.138574-1-ihuguet@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > Maybe the lock needs to be moved closer to what actually needs to be > > protect? What is it protecting? > > It's protecting the operations of aq_macsec_enable and aq_macsec_work. > The locking was closer to them, but the idea of this patch is to move > the locking to an earlier moment so, in the case we need to abort, do > it before changing anything. aq_check_txsa_expiration() seems to be one of the issues? At least, the lock is taken before and released afterwards. So what in aq_check_txsa_expiration() requires the lock? I don't like the use of rtnl_trylock(). It suggests the basic design is wrong, or overly complex, and so probably not working correctly. https://blog.ffwll.ch/2022/07/locking-engineering.html Please try to identify what is being protected. If it is driver internal state, could it be replaced with a driver mutex, rather than RTNL? Or is it network stack as a whole state, which really does require RTNL? If so, how do other drivers deal with this problem? Is it specific to MACSEC? Does MACSEC have a design problem? Andrew