Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp455428pxb; Mon, 16 Aug 2021 09:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysgnkc/0UVTXHpWiOd0sjgrOKUFFVYJhLUVlDegOv9XAS9TJifJK/2WjKW7tCfiTF05GM4 X-Received: by 2002:a50:ed05:: with SMTP id j5mr21512466eds.256.1629130214595; Mon, 16 Aug 2021 09:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629130214; cv=none; d=google.com; s=arc-20160816; b=v27d1xOe3kL7t3VQhYHP8cp0Oapo9mTPA6uXjMqdgZ7g/+cNF+egKRtGr++ek6SJoM +wZbmwoTGf2bQy2QjnP7Q95Cwhi4q0LuJEwsVzn2JLU354S0QsbZEl66/bKZDvD7mZeX +i7/iRsW70dX6YIOwdRfgOS2846/MsDq6ZG//S0elDVEn8hp7rG4di3Vhyuvo1pR9O3p Rv8r5oLvQp85JmnPisYWJOwPrCie//UxMFQVNorktWE50TET9zyHGZwKPwOaoEKjCZr0 8G5pXKJSyyOkb69swNz+2xrM0g3tN7oil6ELnuvudDVSyIFTxbwpzDP8KfQ5LNOGp8M1 0p3w== 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=ujGIRdbzC30xVJ0BA0xR5nSbhW6/C5qGUHhuxS9ZevU=; b=jYuedx6Ke4E7d9jp8VmB/G0eNqUnDTjK8WM7Kt8q2OKi6RS2zU9LAy7jbaGaIFjn9z m1+lwb+Gf8D41g37IMe/TsK4fsg73s0Ww8T0i3wgNM92wzyQt9qMHawjOx+an4k96Gcw RfuDuTOQ4WhMvIUE1LoiEIu7a6Uiq2PDqRCRmoHPZX1DxcTI9o3mm284FquyLs0KDGHW UB9L1/qY7SlO6Kv1vAkex5hIP8njod72Y3OIM5AofLC3bN6lIUEHKQtecFaBcrhAEeNl FwLL72jw6Qe4pb5TxbWMMZEsQBUh247Hz+nX9otQ8+5woiA+0UnAHD4weUpI+j5Z4kzh 1dnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lVfcuZvR; 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 w11si12459970ede.300.2021.08.16.09.09.51; Mon, 16 Aug 2021 09:10:14 -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=lVfcuZvR; 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 S230077AbhHPQHe (ORCPT + 99 others); Mon, 16 Aug 2021 12:07:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:48570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbhHPQHd (ORCPT ); Mon, 16 Aug 2021 12:07:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C8346056B; Mon, 16 Aug 2021 16:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629130021; bh=dQ7YdQ2ihh87LThyE6YAzcRBdsJeA/gOE3NhxEzSMgY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lVfcuZvRIc5hRBNPL9PCCiPON7jp6Ak1mRU0mhJwTdJK0KONo78N3qaCWN9CvUXA4 8uGhdt/P9O6QCFDYyzEiGnDoBdVuDwrHsAIbgu4yrAldXNF2WUw3SAfepnUe31Edgm v0WZb2VRhDAGLxMiW9p07N9YUoxQD/sSjIO3gE5U1HfGMqYbXcBR3A+eWqK9Pf0NWj 32RjGSAixHY10CnCvOBOUSzn6RflfHnXPZl1h8J+VnkB/GDviL1LOi00pm4m1tIQwg 2gtt2YvefCj1eaqCz743ZRH84PbcAP+J2oXlUG37Hfxr5uuiFDc2KzY+uZHooezl8R e552YDmXKOY2A== Date: Mon, 16 Aug 2021 09:07:00 -0700 From: Jakub Kicinski To: Leon Romanovsky Cc: "David S . Miller" , 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: <20210816090700.313a54ba@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20210816084741.1dd1c415@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 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 Mon, 16 Aug 2021 18:53:45 +0300 Leon Romanovsky wrote: > On Mon, Aug 16, 2021 at 08:47:41AM -0700, Jakub Kicinski wrote: > > 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 end goal will be something like that: > 1. Delete devlink lock > 2. Rely on xa_lock() while grabbing devlink instance (past devlink_try_get) > 3. Convert devlink->lock to be read/write lock to make sure that we can run > get query in parallel. > 4. Open devlink netlink to parallel ops, ".parallel_ops = true". IIUC that'd mean setting eswitch mode would hold write lock on the dl instance. What locks does e.g. registering a dl port take then?