Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2164679pxb; Fri, 25 Mar 2022 12:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzor4Ef1wzTybtD3QBPDv4QtRvi4N5TwsyQaK5sEME9a3HSmCTRbyH3EQ/0hGsxJVSwOooV X-Received: by 2002:a63:202:0:b0:37c:4cfc:b89f with SMTP id 2-20020a630202000000b0037c4cfcb89fmr830216pgc.396.1648235668693; Fri, 25 Mar 2022 12:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648235668; cv=none; d=google.com; s=arc-20160816; b=tzt83xMwR9xRoUTXZDjmwyXbmnKqWsqWeaPEElMdNda+gmx6WujrXqrt3+Gs2WnSHi FQtXNqKiArlN8LpD30F2Ch/YaeLSa8Y2DF9bmGoBY5bF9v9MeTJpn/VFfHiEXW6YC3B6 XnIJ8nH/5i/sWePlV0VKnYEgjEQdUSxCIfU92N3IRxg8FH5/xV3au0Q3Rjs//66cjo1V jG/J06czYd6klBFctvZ+LlwQLm8BoSVRBWTqdzotn66uDCnApmx31rj7jSOZtUirtvLF XbKnvWLync1yBKYcdPpOagoJm3lkgf47eCTl3B5bmkP2oa4J8mQS2aLVeiu5+hlLn1wH ibxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Ky7J5ZnRHdCp4kiFAOSMAzdjCfPIxvg6/s5bVKZr8Sw=; b=Duodl4EyBjn1DgNFjRC1rqiAX3hSPSheADE/AV5Mh28sMdzocVtng79ktH8vUzbYbN ZibXR72k/UBB5/hV69yHh2eh+A8N5hP9t4iXMWl0mShPE/Z6xphhQUpU1rfN6kqrRPQt VtvAinDWEzteqmjWSAQU8dqqZo/nUotSKZnpPPxuEatDoEEr87Kg6BBblsFjKlBqWKli hCvTLRdqEtKuZZcFymjegTwJxxsr8KPX8F5M6t40gBx6ncCqGsTsGb6bB8DPvoY6g6mc WrcOc5ZTUEsJK6C7sHMusibtTl1qQ1BiQ1+XAz2AMyuKZIpuN21C2ZPM34Andg/9g4Gw ZhOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bhcqvKEZ; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e10-20020a170902e0ca00b00153b2d164f5si2820988pla.253.2022.03.25.12.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:14:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bhcqvKEZ; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F0D621FC62; Fri, 25 Mar 2022 11:19:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376503AbiCYQvd (ORCPT + 70 others); Fri, 25 Mar 2022 12:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353627AbiCYQvc (ORCPT ); Fri, 25 Mar 2022 12:51:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165D8C12C7; Fri, 25 Mar 2022 09:49:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3932FB82929; Fri, 25 Mar 2022 16:49:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83337C2BBE4; Fri, 25 Mar 2022 16:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648226994; bh=4G/HlMObuPl5HB4vAXSAnNPwS1bpgtplquTJ8M34Ijg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bhcqvKEZ6xBPEXWenC6BBEvEnIXURJxeibqMBU4N6HqnJ2FaKTIRuM7dmxg3WhH3A SD0RZhHr2hCZp/DETVXeJOnBr6sKYRgeFkbGOFnp5bq1DP7cS16CDBaTpB1x/b+fEs 7sNKBAgziCnHLlxP0tBEExafTg14+AB54OslSiFFbiNRc6iCoKy5la9S+eytEvJ1e4 2F6AMGRR4FTFQyhyxv8newa39UhccCaNrwbStwj6vHULRnuHGsOnTUIYOni0fGe/kc thmOYw29+wTDaPs1FRZrTcX9Iv3IPV6ppFWDyLZt/NML3O+661RITvJkIQ91HQ9vLD caz3y5QHcE8EA== Date: Fri, 25 Mar 2022 09:49:52 -0700 From: Jakub Kicinski To: Johannes Berg Cc: William McVicker , linux-wireless@vger.kernel.org, Marek Szyprowski , Kalle Valo , "David S. Miller" , netdev@vger.kernel.org, Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , kernel-team@android.com, Paolo Abeni Subject: Re: [BUG] deadlock in nl80211_vendor_cmd Message-ID: <20220325094952.10c46350@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <19e12e6b5f04ba9e5b192001fbe31a3fc47d380a.camel@sipsolutions.net> References: <0000000000009e9b7105da6d1779@google.com> <99eda6d1dad3ff49435b74e539488091642b10a8.camel@sipsolutions.net> <5d5cf050-7de0-7bad-2407-276970222635@quicinc.com> <19e12e6b5f04ba9e5b192001fbe31a3fc47d380a.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, 25 Mar 2022 13:04:23 +0100 Johannes Berg wrote: > So we can avoid the potential deadlock in cfg80211 in a few ways: > > 1) export rtnl_lock_unregistering_all() or maybe a variant after > refactoring the two versions, to allow cfg80211 to use it, that way > netdev_run_todo() can never have a non-empty todo list > > 2) export __rtnl_unlock() so cfg80211 can avoid running > netdev_run_todo() in the unlock, personally I like this less because > it might encourage random drivers to use it > > 3) completely rework cfg80211's locking, adding a separate mutex for > the wiphy list so we don't need to acquire the RTNL at all here > (unless the ops need it, but there's no issue if we don't drop it), > something like https://p.sipsolutions.net/27d08e1f5881a793.txt > > > I think I'm happy with 3) now (even if it took a couple of hours), so I > think we can go with it, just need to go through all the possibilities. I like 3) as well. FWIW a few places (e.g. mlx5, devlink, I think I've seen more) had been converting to xarray for managing the "registered" objects. It may be worth looking into if you're re-doing things, anyway.