Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp448329rwb; Wed, 7 Dec 2022 00:10:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4uoVtPUyOso3Pj1ra9L8uOvg72YCjdqa9dokO2gNM4RvgzD6ywuU/VNhf91PFAWxoEvCKe X-Received: by 2002:a17:906:144c:b0:7ad:cda3:93c7 with SMTP id q12-20020a170906144c00b007adcda393c7mr77648763ejc.500.1670400657658; Wed, 07 Dec 2022 00:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670400657; cv=none; d=google.com; s=arc-20160816; b=ZV/T5YOeApEEb8uNBrRTsNKqOHHLSfIYUsmpO6QK0qllDan94OsS84puvY9wMveCjz EvU9f+0Av6QxKzyroWgXO4vzI9MRWiDLj0cEdTaKy+SUDnT43evD42lCOeGpYf/SO983 cigBHbIuf8MMdke9FiriMiSecSPY/noJEq1QwdiKxpUY0B21Fc0XfxNmtC5aw3Rm+OdR Pof88FvpKOWNiocoF0W48WajU8Nlvdn1pEHGNP7GTjv2rIMRRuOZgz5oaRveQgGUxtQg 93v6DH4bhyBm2puYqAFc5rNhESieYZyt13y+94LhpUAWrNnYo7FqIc+RSObrVKQ0vozT ijBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cUCLAh+st4VgUdVt1mfKix9JBujpG3Vn8xrRD4knPLA=; b=mCE+fZoVuv1vvyDwur2LOOlLxNgZJ17Sjmu+y3rBJZIXPD+pK9QWNUA/qEtHPRDTTy ZTHxeBW9Enh8CDx3ieD2ElRF1NFBU0rkRjdQYI9E8IFlwY0pVU6zuLntQ7VHMQMavclE yVaqqYL3CwxFJa6hi1L4K45l4VIow6sLWRxGua4N0DsZ0Hm4YCoobdxGrNxAQxYM63bw scZv3PUkJp4Q5Yeeher1m81qSF9qi499k+SYWiv2Dyx/fZmt2HOKASvpOvbtNQVcUD4v sbWkHjzuQxbu7uB7J1oLdL0TJcyimrnm5yCb7cMMUCf7n0qn0vKuPtH7ZC7SuwxUMa98 pwVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a056402274500b0045b293121f1si4583194edd.12.2022.12.07.00.10.39; Wed, 07 Dec 2022 00:10:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbiLGHyZ (ORCPT + 76 others); Wed, 7 Dec 2022 02:54:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbiLGHyW (ORCPT ); Wed, 7 Dec 2022 02:54:22 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4FDE303E9; Tue, 6 Dec 2022 23:54:20 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 2111768AA6; Wed, 7 Dec 2022 08:54:15 +0100 (CET) Date: Wed, 7 Dec 2022 08:54:15 +0100 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Lei Rao , kbusch@kernel.org, axboe@fb.com, kch@nvidia.com, sagi@grimberg.me, alex.williamson@redhat.com, cohuck@redhat.com, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com, mjrosato@linux.ibm.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, kvm@vger.kernel.org, eddie.dong@intel.com, yadong.li@intel.com, yi.l.liu@intel.com, Konrad.wilk@oracle.com, stephen@eideticom.com, hang.yuan@intel.com Subject: Re: [RFC PATCH 1/5] nvme-pci: add function nvme_submit_vf_cmd to issue admin commands for VF driver. Message-ID: <20221207075415.GB2283@lst.de> References: <20221206055816.292304-1-lei.rao@intel.com> <20221206055816.292304-2-lei.rao@intel.com> <20221206061940.GA6595@lst.de> <20221206135810.GA27689@lst.de> <20221206153811.GB2266@lst.de> <20221206165503.GA8677@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 06, 2022 at 03:15:41PM -0400, Jason Gunthorpe wrote: > What the kernel is doing is providing the abstraction to link the > controlling function to the VFIO device in a general way. > > We don't want to just punt this problem to user space and say 'good > luck finding the right cdev for migration control'. If the kernel > struggles to link them then userspace will not fare better on its own. Yes. But the right interface for that is to issue the userspace commands for anything that is not normal PCIe function level to the controlling funtion, and to discover the controlled functions based on the controlling functions. In other words: there should be absolutely no need to have any special kernel support for the controlled function. Instead the controlling function enumerates all the function it controls exports that to userspace and exposes the functionality to save state from and restore state to the controlled functions. > Especially, we do not want every VFIO device to have its own crazy way > for userspace to link the controlling/controlled functions > together. This is something the kernel has to abstract away. Yes. But the direction must go controlling to controlled, not the other way around.