Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp281707pxj; Thu, 10 Jun 2021 00:06:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXdxJU7k7vU7t/8NY2zno8eEBxHqoicOAKpSMrdyjP3W7c8opkY/DWAjJU0JxWySow/eBo X-Received: by 2002:a17:906:5d14:: with SMTP id g20mr3044295ejt.243.1623308815389; Thu, 10 Jun 2021 00:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623308815; cv=none; d=google.com; s=arc-20160816; b=hUG9jwWU7C2ussMjdhptg461MkwJMEk/pFJjqPJBxYZC6vv1wWL/zfLhOz7+GeI50/ RRJ8PD3cV+WBtr8fV+DS3P6T/k7xBuKc/EqAHAHcyjnjqPmfDe7U80ksWuwsokkq9uju yKgxZAG90UW5yahZ/b5sIPTMlplZANv3PrTzYJCkij2Ptsdgts+gioBYlSLDbkD9+SSg 56zC2zmzPAPYDdsZgoibCa+IamAFMQxBvM59yg5lJ4ReBwMFo84TOUAhC81elMxc/CTc /xW2rrWRVfV0dkTxlD73mSIakeYz+xrehdI0Yn6a9f1y4OtiWa39bU1gdySVqUyD69N/ QcTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OIc4Wnam2HpY84jq8SfgzIDtZmGYLGaXxK/hF+UY6u8=; b=loXYpJOc/v6BTboZAbhwvXUrpznTgXaAeyPnUj5geGy2lwjevxSm1+5gKgCfBMsCct 2SeaLBss+k7ESQaHjpTbptwNSlSIN8052f48T9lsLlQsR8IqK2JLuqz+9vX7Yb+997C/ yy9s8TTncmWItaN5HeLZOMe/KNDVN6BKpUGrYyHcUkTD7WPEXCl0Xuh9cbswg+SdQXwj JdU8A6u0Fj59ypdL1ugFsbUErMi46thtUynWGJdLuMOXSOXZI22CeLS7nKKzvn4aazQp SnaOeDXYquPyV0THUcd8u5ulVCAI2dLaiqKgugmr+yXfJTeDiOaZ6D4fJi9XwvD1lrVc pPrg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si1918216edi.147.2021.06.10.00.06.32; Thu, 10 Jun 2021 00:06:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbhFJHG3 (ORCPT + 99 others); Thu, 10 Jun 2021 03:06:29 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3932 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbhFJHG1 (ORCPT ); Thu, 10 Jun 2021 03:06:27 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G0vyn0pbFz6xDh; Thu, 10 Jun 2021 15:01:21 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 10 Jun 2021 15:04:24 +0800 Received: from [127.0.0.1] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 10 Jun 2021 15:04:24 +0800 Subject: Re: [RFC net-next 0/8] Introducing subdev bus and devlink extension To: Parav Pandit , Jakub Kicinski CC: moyufeng , Jakub Kicinski , Jiri Pirko , Or Gerlitz , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "michal.lkml@markovi.net" , "davem@davemloft.net" , "gregkh@linuxfoundation.org" , Jiri Pirko , Salil Mehta , "lipeng (Y)" , Guangbin Huang , "shenjian15@huawei.com" , "chenhao (DY)" , Jiaran Zhang , "linuxarm@openeuler.org" References: <1551418672-12822-1-git-send-email-parav@mellanox.com> <857e7a19-1559-b929-fd15-05e8f38e9d45@huawei.com> <20210603105311.27bb0c4d@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <20210604114109.3a7ada85@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <4e7a41ed-3f4d-d55d-8302-df3bc42dedd4@huawei.com> <20210607124643.1bb1c6a1@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <530ff54c-3cee-0eb6-30b0-b607826f68cf@huawei.com> <20210608102945.3edff79a@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <2acd8373-b3dc-4920-1cbe-2b5ae29acb5b@huawei.com> From: Yunsheng Lin Message-ID: <387c80e7-e50f-8f2f-0fea-d699902ef84e@huawei.com> Date: Thu, 10 Jun 2021 15:04:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme705-chm.china.huawei.com (10.1.199.101) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/6/9 21:45, Parav Pandit wrote: >> From: Yunsheng Lin >> Sent: Wednesday, June 9, 2021 6:00 PM >> >> On 2021/6/9 19:59, Parav Pandit wrote: >>>> From: Yunsheng Lin >>>> Sent: Wednesday, June 9, 2021 4:35 PM >>>> >>>> On 2021/6/9 17:38, Parav Pandit wrote: >>>>> >>>>>> From: Yunsheng Lin >>>>>> Sent: Wednesday, June 9, 2021 2:46 PM >>>>>> >>>>> [..] >>>>> >>>>>>>> Is there any reason why VF use its own devlink instance? >>>>>>> >>>>>>> Primary use case for VFs is virtual environments where guest isn't >>>>>>> trusted, so tying the VF to the main devlink instance, over which >>>>>>> guest should have no control is counter productive. >>>>>> >>>>>> The security is mainly about VF using in container case, right? >>>>>> Because VF using in VM, it is different host, it means a different >>>>>> devlink instance for VF, so there is no security issue for VF using >>>>>> in VM >>>> case? >>>>>> But it might not be the case for VF using in container? >>>>> Devlink instance has net namespace attached to it controlled using >>>>> devlink >>>> reload command. >>>>> So a VF devlink instance can be assigned to a container/process >>>>> running in a >>>> specific net namespace. >>>>> >>>>> $ ip netns add n1 >>>>> $ devlink dev reload pci/0000:06:00.4 netns n1 >>>>> ^^^^^^^^^^^^^ >>>>> PCI VF/PF/SF. >>>> >>>> Could we create another devlink instance when the net namespace of >>>> devlink port instance is changed? >>> Net namespace of (a) netdevice (b) rdma device (c) devlink instance can be >> changed. >>> Net namespace of devlink port cannot be changed. >> >> Yes, net namespace is changed based on the devlink instance, not devlink >> port instance, *right now*. >> >>> >>>> It may seems we need to change the net namespace based on devlink >>>> port instance instead of devlink instance. >>>> This way container case seems be similiar to the VM case? >>> I mostly do not understand the topology you have in mind or if you >> explained previously I missed the thread. >>> In your case what is the flavour of a devlink port? >> >> flavour of the devlink port instance is FLAVOUR_PHYSICAL or >> FLAVOUR_VIRTUAL. >> >> The reason I suggest to change the net namespace on devlink port instance >> instead of devlink instance is: >> I proposed that all the PF and VF in the same ASIC are registered to the same >> devlink instance as flavour FLAVOUR_PHYSICAL or FLAVOUR_VIRTUAL when >> there are in the same host and in the same net namespace. >> >> If a VF's devlink port instance is unregistered from old devlink instance in the >> old net namespace and registered to new devlink instance in the new net >> namespace(create a new devlink instance if >> needed) when devlink port instance's net namespace is changed, then the >> security mentioned by jakub is not a issue any more? > > It seems that devlink instance of VF is not needed in your case, and if so what is the motivation to even have VIRTUAL port attach to the PF? The devlink instance is mainly used to hold the devlink port instance of VF if there is only one VF in vm, we might still need to have param/health specific to the VF to registered to the devlink port instance of that VF. > If only netdevice of the VF is of interest, it can be assigned to net namespace directly. I think that is another option, if there is nothing in the devlink port instance specific to VF that need exposing to the user in another net namespace. > > It doesn’t make sense to me to create new devlink instance in new net namespace, that also needs to be deleted when net ns is deleted. > And pre_exit() routine will mostly deadlock holding global devlink_mutex. Would you be more specific why there is deadlock? It seems more of implementation detail, which we can discuss later when we are agreed it is the right way to go down deeper? >