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 X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7D35CA9EAF for ; Thu, 24 Oct 2019 13:26:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E29C2166E for ; Thu, 24 Oct 2019 13:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571923572; bh=qPf9wh5b0F7490ToTndPlqp+QBtOXunYxp91MkuCgeE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=KO+ukwL8GPHJGAaGGXTLDlJpUKIj38/3mNOQcSFWerccrE+tlGZDxYqsA4fB+8nAN l69xRbG6ABMtgPRjUUzKbnf/1OpAzw3s1vj1cVaFnDYlfM7Jayf53G7vWHiZuCJ6kD 3MLDJsVulyWktF5CivjMh2AgqicY0fUYpxu5h3ow= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728026AbfJXN0M (ORCPT ); Thu, 24 Oct 2019 09:26:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:57470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727786AbfJXN0L (ORCPT ); Thu, 24 Oct 2019 09:26:11 -0400 Received: from localhost (unknown [77.137.89.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2C5A2084C; Thu, 24 Oct 2019 13:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571923571; bh=qPf9wh5b0F7490ToTndPlqp+QBtOXunYxp91MkuCgeE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NdwHDo+PDT6yHLZ5ZMji+kwAljg4wRIeA+ETy1LwEqpJ3F/+8ubn02ahaZ8xDVzYQ KPjAh113RvNiJHBYP0BGXkK8Bohrp1/JUnLgPaBNUfh31xIcpAgPHMWIUQUkZbByVk f3+13GsP3SYQvirZ/njWF8HVFcSgP2KRvo5dcAGA= Date: Thu, 24 Oct 2019 16:26:07 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Doug Ledford , Parav Pandit , RDMA mailing list Subject: Re: [PATCH rdma-next] IB/core: Avoid deadlock during netlink message handling Message-ID: <20191024132607.GR4853@unreal> References: <20191015080733.18625-1-leon@kernel.org> <20191024131743.GA24174@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191024131743.GA24174@ziepe.ca> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, Oct 24, 2019 at 10:17:43AM -0300, Jason Gunthorpe wrote: > On Tue, Oct 15, 2019 at 11:07:33AM +0300, Leon Romanovsky wrote: > > > diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c > > index 81dbd5f41bed..a3507b8be569 100644 > > +++ b/drivers/infiniband/core/netlink.c > > @@ -42,9 +42,12 @@ > > #include > > #include "core_priv.h" > > > > -static DEFINE_MUTEX(rdma_nl_mutex); > > static struct { > > - const struct rdma_nl_cbs *cb_table; > > + const struct rdma_nl_cbs __rcu *cb_table; > > + /* Synchronizes between ongoing netlink commands and netlink client > > + * unregistration. > > + */ > > + struct srcu_struct unreg_srcu; > > A srcu in every index is serious overkill for this. Lets just us a > rwsem: I liked previous variant more than rwsem, but it is Parav's patch. Thanks