Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8613276rwb; Tue, 13 Dec 2022 08:22:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf7m1gIgIrRXlqdmLawuBKVQxUJLMJJZXmwjM9B13a8K2GgADkr0D3jM8ZwtUSUvrSWizD0q X-Received: by 2002:a17:906:e283:b0:7c0:cc69:571b with SMTP id gg3-20020a170906e28300b007c0cc69571bmr17351489ejb.8.1670948528624; Tue, 13 Dec 2022 08:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670948528; cv=none; d=google.com; s=arc-20160816; b=Bb3mGC4d4p9SNlTg7ZBDhM/Sv1zvhQLyTA7qcLhZPo5xto/3r2TKmWkMl33u5DOlSk d/JMfIV34PxoJyJE7jq00/LFglS0Lt6VbZe85IvlE2l1WqqgOjI5XKQQBetr/p2C2hhM itiRVrpEQkuSNAu9751DIH2j4+v3FS9ftUzY6NGbG3RxGW5/kNPT+ogLPrVYrOCKXOGj QSKkEPY4A+5dFDQqN9caZQV3/ki8ro+9NBXzpJF/MeBfG3+520Kz5TAUSn7oW9nlwQLS 45TVo4Gk2iwyrX1bELK16534RxX9yU8sMkEYnE80Qe8QoTKXAQRjpJQe/bGQ3YaPe+Mt swVQ== 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=jkkE5/Yn3ya8Oplicw+bkmkivZpDOt6LbHEz395iCHo=; b=RLtq7MwhzGaV2agD7uXC7fldzoJsFydBwPlWl0dC+Tgm3ZiGWP6gZ9X34YlZulvI5E o5+I3p0sCgl6ACm17svI8CnYoUsIJZN/FeEm28HeWIBtuyDxwNJiD3Om4JyPEEgNfcde wzSs1h8+XsL+2I7OHp/+KARsS3osXix8WfZ5IvntPr0wySW0xc7GOjlkJ0I+RS0AyR77 eYrazDEcPfaCWIcTZJPeMPuDTxRab7oK+6LES7XG+t/8sC95iMl2N3q7k940SOP4YHGK +trwRge8ZyDrP2quttkAC4b6IcMC5No01CREYb6rWb9pC1XO5lau/Rl92gOXhveWuwCl iq2g== 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 js8-20020a17090797c800b007bfdadb58e7si9050870ejc.546.2022.12.13.08.21.51; Tue, 13 Dec 2022 08:22:08 -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 S235755AbiLMQIQ (ORCPT + 72 others); Tue, 13 Dec 2022 11:08:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235081AbiLMQIN (ORCPT ); Tue, 13 Dec 2022 11:08:13 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD9C282; Tue, 13 Dec 2022 08:08:12 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id C5A8867373; Tue, 13 Dec 2022 17:08:07 +0100 (CET) Date: Tue, 13 Dec 2022 17:08:07 +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: <20221213160807.GA626@lst.de> References: <20221207075415.GB2283@lst.de> <20221207135203.GA22803@lst.de> <20221207163857.GB2010@lst.de> <20221207183333.GA7049@lst.de> <20221212075046.GB11162@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 13, 2022 at 10:01:03AM -0400, Jason Gunthorpe wrote: > > So now we need to write a vfio shim for every function even if there > > is absolutely nothing special about that function? Migrating really > > is the controlling functions behavior, and writing a new vfio bit > > for every controlled thing just does not scale. > > Huh? "does not scale?" We are looking at boilerplates of around 20-30 > lines to make a VFIO driver for a real PCI device. Why is that even > something we should worry about optimizing? But we need a new driver for every controlled function now, which is very different from the classic VFIO model where we had one vfio_pci. > And when you get into exciting future devices like SIOV you already > need to make a special VFIO driver anyhow. You need to special support for it. It's probably not another Linux driver but part of the parent one, though. > So far 100% of the drivers that have been presented, including the two > RFC ones, have entanglements between live migration and vfio. Shifting > things to dev/live_migration doesn't make the "communication problem" > away, it just shifted it into another subsystem. The main entanglement seems to be that it needs to support a vfio interface for live migration while the actual commands go to the parent device. > This is my point, I've yet to even see a driver that meets your > theoretical standard that it can exist without vfio entanglement. It can't right now due to the VFIO design. > > While creating the VFs from the PF driver makes a lot more sense, > > remember that vfio is absolutely not the only use case for VFs. > > There are plenty use cases where you want to use them with the normal > > kernel driver as well. So the interface to create VFs needs a now > > to decide if it should be vfio exported, or use the normal kernel > > binding. > > Yes, that is why this problem has been open for so long. Fixing it > well requires some reconsideration of how the driver core works :( > > It is worse than just VFIO vs one kernel driver, like mlx5 could spawn > a controlled function that is NVMe, VDPA, mlx5, virtio-net, VFIO, > etc. This seems to violate the PCIe spec, which says: "All VFs associated with a PF must be the same device type as the PF, (e.g., the same network device type or the same storage device type.)", which is also enforced by not allowing to read vendor/device/class fields from VFs. (not that I'm arguing that this is a good limit, but that's how PCIe does it). > When we create the function we really want to tell the device what > kind of function it is, and that also tells the kernel what driver > should be bound to it. I'd rather have different ways to probe by passing a "kind" or "type" argument along the device IDs during probing. E.g. "driver" and "vfio", and then only match for the kind the creator of the device added them to the device model for. > mlx5 even has weird limitations, like a controlled function that is > live migration capable has fewer features than a function that is > not. So the user must specify what parameters it wants the controlled > function to have.. I don't think that is weird. If you want to live migrate, you need to a) make sure the feature set is compatible with the other side b) there is only state that actually is migratable so I'd expect that for any other sufficiently complex device. NVMe for sure will have limits like this.