Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp440712pxb; Mon, 16 Aug 2021 08:50:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQpcqF5BWNTKbtIUSITp71StqsYybYAG7TTlRqkJWsT5R19l2hh9SsbQijV7EgRbzY/kL7 X-Received: by 2002:a5d:85ca:: with SMTP id e10mr13514916ios.193.1629129034635; Mon, 16 Aug 2021 08:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629129034; cv=none; d=google.com; s=arc-20160816; b=vBIpYNALle5mpTb795H0bLEZBmD12/MHNUYVMigr7doLcLGfLUzNMHBEVUH+y67cHH NLzJVoBSJ8bDBLshx+1p66pqqhfOaDpf/svwWNYkMM7mTLQg6WJT1OC6DJgGHnT4IUo5 M3NVbXObCOVKLVnaFX68Fl5HVSHa9LLnNBd0F+z/fQHsdZno36EIie0fbliZhobUjXoY P8vvFUOHKTi2s5fq7YV0my3mIKlBJ+ZyMZO47TOIV5VNrdRbiQGA0uUy+kodeVBy5PTK zDEn+eUxLlxgMUQ8xsI5WfeOgMKeGGcHxdme2+HdJstL+XFtIqide8njtfT3xgNCl0RE Rh0A== 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=LszsbYPAZXVoOBLBTun3GsmHOVfNEGQayaQu8TD94J8=; b=DRLODkZkhkjgo3AVy61AMZ6Sg279CBHgL/MCCJwXJKDD1ejPDvxRSuM2HfT8eW4kIe ZJqDXTHd27wTl1qDs2LeOc5tqFF6yLtKcuXbpojq7T+GozGw41NpQcc91N+hVqJDRjbI T9TfgwXoYiEPlVf2FSr6rt2ODu5RdbwKHys1H4aspG8J49BNNmTuGsipfAsPsplTdqhV JGJo0eiWNnMmuR8QlckQhi1rDxSJtmLsG+EyPmpN0xyrFSlYOJGU1RuzO89itqDEB0/8 PdxmwO7KZtpNhvcQ14BFIjLoQzL/ktOYeY1MLSvjg4ofjmqGYuWNXPNnNjoEHL3Z0tGg 5TiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q04xAz38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si4460495ilu.143.2021.08.16.08.50.22; Mon, 16 Aug 2021 08:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q04xAz38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236637AbhHPPsQ (ORCPT + 99 others); Mon, 16 Aug 2021 11:48:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:41436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232822AbhHPPsO (ORCPT ); Mon, 16 Aug 2021 11:48:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF71B60F42; Mon, 16 Aug 2021 15:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629128862; bh=i6mqhZa05bh0/QvKBCg/vqpuUHYgPMxb+O5ZQZYVlwA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q04xAz38cnz5G+q6BdNTGV+56X2nNyQNbX7kYAv1bZRAJllhYM0aPv8BfAGUOBPde 2TaQG/1vjjWj3DX5VjwdbMrFJDiOFexJghkCE9fEkdlo52B3SamAh8zSopudkuUvjV EY0tVxnimj2wC9chonMAf6eUa9m6MNk8x4t/g+eZH7UjL2Z29WcNFGTYgvMiR2HA2H gJ85U3QPjmH+nRo1TwF1PYCIkat63+vycqDerd1LrVni34ATaipOsWly6gYKzgGgxz o3RlRIYHMyk/p1LuI4tThV3IuTLifvL/EfDKrfZtRmRD+SD22xLJQxFq9QeKAEczJC FvseFiXu98g5g== Date: Mon, 16 Aug 2021 08:47:41 -0700 From: Jakub Kicinski To: Leon Romanovsky Cc: "David S . Miller" , Leon Romanovsky , Guangbin Huang , Jacob Keller , Jiri Pirko , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Salil Mehta , Shannon Nelson , Yisen Zhuang , Yufeng Mo Subject: Re: [PATCH net-next 3/6] devlink: Count struct devlink consumers Message-ID: <20210816084741.1dd1c415@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 14 Aug 2021 12:57:28 +0300 Leon Romanovsky wrote: > From: Leon Romanovsky > > The struct devlink itself is protected by internal lock and doesn't > need global lock during operation. That global lock is used to protect > addition/removal new devlink instances from the global list in use by > all devlink consumers in the system. > > The future conversion of linked list to be xarray will allow us to > actually delete that lock, but first we need to count all struct devlink > users. Not a problem with this set but to state the obvious the global devlink lock also protects from concurrent execution of all the ops which don't take the instance lock (DEVLINK_NL_FLAG_NO_LOCK). You most likely know this but I thought I'd comment on an off chance it helps. > The reference counting provides us a way to ensure that no new user > space commands success to grab devlink instance which is going to be > destroyed makes it is safe to access it without lock.