Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp600292pxh; Tue, 9 Nov 2021 15:59:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwllE7SQrikUfuHR4VB+PDsEp5Q9AL8V1qDgA1feKyTu4gGk8MgeOP/sp7X57SoRZwsVW+3 X-Received: by 2002:a92:b743:: with SMTP id c3mr8384679ilm.222.1636502376256; Tue, 09 Nov 2021 15:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636502376; cv=none; d=google.com; s=arc-20160816; b=0oraCKS7ZaQE7DWNI8Bd+BG7bS3I+0L6ABw03WyYbxcMtx8xMIHCK0kY1Fo1CehgBy hlWSrepURppPFoJ86gNwgjSzNT9Zv2DACwwmGKnuOlZ5N69/tnxjfH2EpeTS+2DDZtvD EJpt7+ZtFY5tOMGW7dm5XLThNqjS/ZHlZ5AVxqS2eCxny2BTd08T+ObIBaknrn+oTRM/ OhTUf4QLd4UYnPCp6G5JFQjGFbq7xhu+OxbIraKRzQNB25uJbvaDukEiZLB9Beh36nWf xSXEyf7ZeApcgcGpIAbOjd12S3RE46HkUo8BNtqsXbLTmJRv45MVLr4DjKxu1v0cJE/i MejQ== 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=diIBkjrtn9/nU0zV6x3O7LOC1iIS2Yt/o6W7rzwx5D4=; b=ZZ4+L8pdHDi1yIynXrwN+0X/81evxSOlgCiyrfU4gV9fA3XbN/GE0vn6PvjCJkIdlb VBK8VJWGEH3R/Ib0NK6Qnx2fYVpGMrY13TGuBSVzu35/nIoXA5RghSbUAD/Gr1Q/Dh9o 9lmPZZR9QCKGYG/WkbvKiJ1LorKViTW6DXJPe9uDG+ROCRmE3CISI35x5ZsLVEJU4ASi UvoxY8sXfYWNSX7pntvZwH0hJrQ06zhoMVYiwLvHmcbXTcRIr82yYWQygX4clPaIKqlk Ri7ipqmIr0+3Ev4tSQYFeYh9PjbPN/QTjN70PmHOe8Qy4I/18tcmhLcu1Rr8sLGNE3KR UCNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F6FNwhYY; 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 x19si35506015ioa.9.2021.11.09.15.59.23; Tue, 09 Nov 2021 15:59:36 -0800 (PST) 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=F6FNwhYY; 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 S238841AbhKIPJx (ORCPT + 97 others); Tue, 9 Nov 2021 10:09:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:34856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236716AbhKIPJw (ORCPT ); Tue, 9 Nov 2021 10:09:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E8FB610A0; Tue, 9 Nov 2021 15:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636470426; bh=NbTi1s7PPh+6WlWPla4jC2pqy03eh5nPjE8IbKVq024=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=F6FNwhYYZALUN5kw7Kbizx7aeOuEDj/i6JSmf/DWbZ+Tp0MnPhhW7iDQY1UTFP8Wf vV92T5LEbdEpvZmk3bjR50qbnmPyXClcD5dDxFEsnOoxF/mzqZlaikyF2g9L2QCAku eNudM629+IaPn99JF4svKjA495HKkTLqCW422DLYJg+37V9nwN14Vs7qNeMjRGd/rb Qy1tatHCNweCbImA61SUjBotN8ykN2hF36T8IydqpzpNZv1N7ukY/beLKRrPRNvlBp MKJUNMn7wlxHhErwxR8odEYcD+vAtwzyFusV2dBOi/lfBBjOkbOtky/KXewMS+C3wL 33s/NZm1vp5qg== Date: Tue, 9 Nov 2021 07:07:02 -0800 From: Jakub Kicinski To: Jason Gunthorpe Cc: Leon Romanovsky , Ido Schimmel , Jiri Pirko , "David S . Miller" , Jiri Pirko , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, edwin.peer@broadcom.com Subject: Re: [PATCH net-next] devlink: Require devlink lock during device reload Message-ID: <20211109070702.17364ec7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20211109144358.GA1824154@nvidia.com> References: <20211101161122.37fbb99d@kicinski-fedora-PC1C0HJN> <20211108080918.2214996c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20211108101646.0a4e5ca4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20211108104608.378c106e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20211108153126.1f3a8fe8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20211109144358.GA1824154@nvidia.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 Tue, 9 Nov 2021 10:43:58 -0400 Jason Gunthorpe wrote: > This becomes all entangled in the aux device stuff we did before. So entangled in fact that neither of you is willing to elucidate the exact need ;) > devlink reload is defined, for reasons unrelated to netns, to do a > complete restart of the aux devices below the devlink. This happens > necessarily during actual reconfiguration operations, for instance. > > So we have a situation, which seems like bad design, where reload is > also triggered by net namespace change that has nothing to do with > reconfiguring. Agreed, it is somewhat uncomfortable that the same callback achieves two things. As clear as the need for reload-for-reset is (reconfig, recovery etc.) I'm not as clear on reload for netns. The main use case for reload for netns is placing a VF in a namespace, for a container to use. Is that right? I've not seen use cases requiring the PF to be moved, are there any? devlink now lives in a networking namespace yet it spans such namespaces (thru global notifiers). I think we need to define what it means for devlink to live in a namespace. Is it just about the configuration / notification channel? Or do we expect proper isolation? Jiri? > In this case the per-net-ns becomes a BKL that gets > held across way too much stuff as it recuses down the reload path, > through aux devices, into the driver core and beyond. > > When I looked at trying to fix this from the RDMA side I could not > find any remedy that didn't involve some kind of change in netdev > land. The drivers must be able to register/unregister notifiers in > their struct device_driver probe/remove functions. > > I once sketched out fixing this by removing the need to hold the > per_net_rwsem just for list iteration, which in turn avoids holding it > over the devlink reload paths. It seemed like a reasonable step toward > finer grained locking. Seems to me the locking is just a symptom.